Re: [PATCH 3/5] cgcc: add support to ignore argument(s) of options

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 24 Nov 2018 14:30:02 +0100
Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> wrote:

> cgcc only does a minimal processing and filtering of its
> command line and most options are simply forwarded to sparse
> and gcc.
> 
> However, if one of the ignored options takes an argument that
> match one of the non-ignored options, this argument will be

matches

> processed as an option with undesirable effect.
> 
> Allow options to specify the number of arguments they're taking
> and avoid any processing or filtering of these arguments while
> still forwarding them to sparse and gcc.
> 
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
> ---
>  cgcc | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/cgcc b/cgcc
> index 736cb704c..33c2ba974 100755
> --- a/cgcc
> +++ b/cgcc
> @@ -14,12 +14,18 @@ my $do_compile = 1;
>  my $gcc_base_dir;
>  my $multiarch_dir;
>  my $verbose = 0;
> +my $nargs = 0;
>  
>  while (@ARGV) {
>      $_ = shift(@ARGV);
> +
> +    if ($nargs) {
> +	$nargs--;
> +	goto add_option;
> +    }
> +
>      # Look for a .c file.  We don't want to run the checker on .o or .so files
> -    # in the link run.  (This simplistic check knows nothing about options
> -    # with arguments, but it seems to do the job.)
> +    # in the link run.
>      $do_check = 1 if /^[^-].*\.c$/;
>  
>      # Ditto for stdin.
> @@ -57,6 +63,7 @@ while (@ARGV) {
>  
>      $verbose = 1 if $_ eq '-v';
>  
> +add_option:
>      my $this_arg = ' ' . &quote_arg ($_);
>      $cc .= $this_arg unless &check_only_option ($_);
>      $check .= $this_arg;
> -- 
> 2.19.0
> 


-- 
Antonio Ospite
https://ao2.it
https://twitter.com/ao2it

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux