[PATCH 5/5] cgcc: teach about '-x c'

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

 



Currently, cgcc only checks input files if their name 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 '-c <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@xxxxxx>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 cgcc | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/cgcc b/cgcc
index 400044253..e215827c7 100755
--- a/cgcc
+++ b/cgcc
@@ -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$/;
-- 
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