aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-11-22 23:55:23 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-11-24 14:01:31 +0100
commit3d41c2d953c15c455081276f64ae30676e3f9f38 (patch)
tree075606c7cef8690c03871af8b497bcfa6e895102
parent21df8a9d5763dfdcdec8b3e540d6c67459d75f74 (diff)
downloadsparse-dev-3d41c2d953c15c455081276f64ae30676e3f9f38.tar.gz
teach sparse about '-x <language>'
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@gmail.com>
-rw-r--r--lib.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib.c b/lib.c
index c5f5b1cd..81820745 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;