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

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

 



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
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




[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