diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-11-22 23:17:34 +0100 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-11-24 17:57:22 +0100 |
commit | 7bd25cdec3ffd4611540d56bd3470f66fb866ff2 (patch) | |
tree | e66218fcadfc7554133c6c11808144e45e4710bd | |
parent | 3d41c2d953c15c455081276f64ae30676e3f9f38 (diff) | |
download | sparse-7bd25cdec3ffd4611540d56bd3470f66fb866ff2.tar.gz |
cgcc: add support to ignore argument(s) of options
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
matches 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@gmail.com>
-rwxr-xr-x | cgcc | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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 = ' ' . "e_arg ($_); $cc .= $this_arg unless &check_only_option ($_); $check .= $this_arg; |