[PATCH 2/5] teach sparse about '-x <language>'

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

 



Sparse ignores unknown options but then doesn't know if
they have arguments or not. So, if '-x c' is given as option,
sparse will try to process a file named 'c'.

Fix this by teaching sparse about the option '-x' and its argument.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 lib.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib.c b/lib.c
index c5f5b1cdf..818207450 100644
--- a/lib.c
+++ b/lib.c
@@ -1067,6 +1067,13 @@ static char **handle_switch_g(char *arg, char **next)
 	return next;
 }
 
+static char **handle_switch_x(char *arg, char **next)
+{
+	if (!*++next)
+		die("missing argument for -x option");
+	return next;
+}
+
 
 static char **handle_version(char *arg, char **next)
 {
@@ -1136,6 +1143,7 @@ static char **handle_switch(char *arg, char **next)
 	case 'U': return handle_switch_U(arg, next);
 	case 'v': return handle_switch_v(arg, next);
 	case 'W': return handle_switch_W(arg, next);
+	case 'x': return handle_switch_x(arg, next);
 	case '-': return handle_long_options(arg + 1, next);
 	default:
 		break;
-- 
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