From fb98c9da7e3015aacbfdd61b54f5394067ed68da Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Sat, 7 Feb 2015 00:43:31 +0100 Subject: [PATCH] smatch: Implement --show-checks This allows one to get an enumerated list of the checks performed. While it is currently just the internal name of an initialization function, one can later add proper short descriptions of what the checks actually do. Since we will unconditionally do all the register_* stuff, there's no point in pretending they can be disabled. Also, this makes the list somewhat more managable. --- smatch.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/smatch.c b/smatch.c index ed4c6171..65f9f65c 100644 --- a/smatch.c +++ b/smatch.c @@ -69,6 +69,17 @@ int id_from_name(const char *name) return 0; } +static void show_checks(void) +{ + int i; + + for (i = 1; i < ARRAY_SIZE(reg_funcs); i++) { + if (!strncmp(reg_funcs[i].name, "check_", 6)) + printf("%3d. %s\n", i, reg_funcs[i].name); + } + exit(1); +} + static void help(void) { printf("Usage: smatch [smatch arguments][sparse arguments] file.c\n"); @@ -125,6 +136,9 @@ void parse_args(int *argcp, char ***argvp) if (!strcmp((*argvp)[1], "--help")) help(); + if (!strcmp((*argvp)[1], "--show-checks")) + show_checks(); + if (!found && !strncmp((*argvp)[1], "--project=", 10)) { option_project_str = (*argvp)[1] + 10; (*argvp)[1] = (*argvp)[0]; -- 2.11.4.GIT