From: Alexey Zaytsev <alexey.zaytsev@xxxxxxxxx> Signed-off-by: Alexey Zaytsev <alexey.zaytsev@xxxxxxxxx> --- lib.c | 19 ++++++++++++++++--- lib.h | 3 +++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/lib.c b/lib.c index e274750..edb8ac9 100644 --- a/lib.c +++ b/lib.c @@ -214,6 +214,8 @@ int dbg_entry = 0; int dbg_dead = 0; int preprocess_only; +int emit_code = 0; +const char *output_file = "a.out"; static enum { STANDARD_C89, STANDARD_C94, @@ -347,11 +349,14 @@ static char **handle_switch_m(char *arg, char **next) static char **handle_switch_o(char *arg, char **next) { - if (!strcmp (arg, "o")) { // "-o foo" - if (!*++next) + if (!strcmp (arg, "o")) { // "-o foo" + next++; + if (!*next) die("argument to '-o' is missing"); + output_file = *next; + } else { // "-ofoo" + output_file = ++arg; } - // else "-ofoo" return next; } @@ -587,6 +592,12 @@ static char **handle_dirafter(char *arg, char **next) return next; } +static char **handle_emit_code(char *arg, char **next) +{ + emit_code = 1; + return next; +} + struct switches { const char *name; char **(*fn)(char *, char **); @@ -597,6 +608,7 @@ static char **handle_switch(char *arg, char **next) static struct switches cmd[] = { { "nostdinc", handle_nostdinc }, { "dirafter", handle_dirafter }, + { "emit-code", handle_emit_code }, { NULL, NULL } }; struct switches *s; @@ -849,6 +861,7 @@ struct symbol_list *sparse_initialize(int argc, char **argv, struct string_list continue; } add_ptr_list_notag(filelist, arg); + } handle_switch_W_finalize(); handle_switch_v_finalize(); diff --git a/lib.h b/lib.h index b22fa93..b74be7c 100644 --- a/lib.h +++ b/lib.h @@ -112,6 +112,9 @@ extern int Wdeclarationafterstatement; extern int dbg_entry; extern int dbg_dead; +extern int emit_code; +extern const char *output_file; + extern void declare_builtin_functions(void); extern void create_builtin_stream(void); extern struct symbol_list *sparse_initialize(int argc, char **argv, struct string_list **files); -- 1.5.6.3 -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html