- add --version to command line
Subsystems (2)
PATCH 1/1 - add --version to command line
sparse doesn't support --version.
Perhaps a patch like this is acceptable?
Signed-off-by Joe Perches <[email protected]>
Makefile +1 -0
@@ -5,6 +5,7 @@ OS ?= linux CC ?= gcc CFLAGS ?= -O2 -finline-functions -fno-strict-aliasing -g CFLAGS += -Wall -Wwrite-strings +CFLAGS += -DSPARSE_VERSION=$(VERSION) LDFLAGS ?= -g AR ?= ar
lib.c +18 -1
@@ -823,6 +823,19 @@ static struct symbol_list *sparse_initial(void)return sparse_tokenstream (token); } +#define stringize_1 (x) #x +#define stringize (x) stringize_1(x) + +static void handle_version (char *name) +{ +char * exe =strrchr (name,'/' ); +if (exe) + exe++; +else + exe = name; +die ("%s %s" , exe,stringize (SPARSE_VERSION )); +} +struct symbol_list *sparse_initialize (int argc,char **argv,struct string_list **filelist) {char **args;
@@ -838,7 +851,11 @@ struct symbol_list *sparse_initialize(int argc, char **argv, struct string_listbreak ;if (arg[0 ] =='-' && arg[1 ]) { - args =handle_switch (arg+1 , args); +if (!strcmp ("-version" , &arg[1 ])) { +handle_version (argv[0 ]); + }else { + args =handle_switch (arg+1 , args); + }continue ; }add_ptr_list_notag (filelist, arg);