diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-11-22 23:23:24 +0100 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-11-24 18:03:11 +0100 |
commit | 756844b2a77ddf5396891cb4dd055de315dfdfdc (patch) | |
tree | c847ed8f17489fc02b008d91a8a283d7de783c6e | |
parent | c118480c756badbc477356b4f83c126eca6ea1f7 (diff) | |
download | sparse-756844b2a77ddf5396891cb4dd055de315dfdfdc.tar.gz |
cgcc: teach about '-x c'
Currently, cgcc only checks input files if their names end with
'.c' or if given as stdout. Other files are explicitly ignored.
This generally corresponds to what is wanted but GCC allows
arbitrary input files if the option '-x <language>' is given.
Some projects use this mechanism, for example to use the C
pre-processor on non-C files.
This fails when cgcc is used as wrapper around sparse + GCC.
Fix this by teaching cgcc about the '-x c' option.
Reported-by: Antonio Ospite <ao2@ao2.it>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rwxr-xr-x | cgcc | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -39,6 +39,14 @@ while (@ARGV) { $nargs = 1; } + # Ignore the extension if '-x c' is given. + if ($_ eq '-x') { + die ("$0: missing argument for $_") if !@ARGV; + die ("$0: invalid argument for $_") if $ARGV[0] ne 'c'; + $do_check = 1; + $nargs = 1; + } + $m32 = 1 if /^-m32$/; $m64 = 1 if /^-m64$/; $gendeps = 1 if /^-M$/; |