diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-09-01 12:46:28 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-07 21:03:01 -0700 |
commit | 2e34026cba4bc35539f9039a6ee5801a96fc2290 (patch) | |
tree | 058e162367e44e25e76a99b84caac2bf09f6df6d /lib.c | |
parent | Make "next_path" be per-stream for better "include_next". (diff) | |
download | sparse-2e34026cba4bc35539f9039a6ee5801a96fc2290.tar.gz sparse-2e34026cba4bc35539f9039a6ee5801a96fc2290.tar.bz2 sparse-2e34026cba4bc35539f9039a6ee5801a96fc2290.zip |
Make "-nostdinc" command line flag actually work.
Also add some infrastructure to make it easier to add new
random command line options.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 32 |
1 files changed, 28 insertions, 4 deletions
@@ -679,9 +679,25 @@ char **handle_switch_W(char *arg, char **next) return next; } +char **handle_nostdinc(char *arg, char **next) +{ + add_pre_buffer("#nostdinc\n"); + return next; +} + +struct switches { + const char *name; + char **(*fn)(char *, char**); +}; + char **handle_switch(char *arg, char **next) { char **rc = next; + static struct switches cmd[] = { + { "nostdinc", handle_nostdinc }, + { NULL, NULL } + }; + struct switches *s; switch (*arg) { case 'D': rc = handle_switch_D(arg, next); break; @@ -694,12 +710,20 @@ char **handle_switch(char *arg, char **next) case 'o': rc = handle_switch_o(arg, next); break; case 'W': rc = handle_switch_W(arg, next); break; default: - /* - * Ignore unknown command line options: - * they're probably gcc switches - */ break; } + + s = cmd; + while (s->name) { + if (!strcmp(s->name, arg)) + return s->fn(arg, next); + s++; + } + + /* + * Ignore unknown command line options: + * they're probably gcc switches + */ return rc; } |