From 66285deadc46366723208fad0adcf28c5dc4f36d Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Wed, 15 Jun 2011 18:46:37 +0200 Subject: [PATCH] Accept -W as alias for -Wextra. --- cparser.1 | 2 ++ main.c | 5 +---- warning.c | 5 ++++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/cparser.1 b/cparser.1 index f68901d..3470227 100644 --- a/cparser.1 +++ b/cparser.1 @@ -147,6 +147,8 @@ Treat warnings as errors, i.e. do not continue after parsing when a warning is e .It Fl Werror-implicit-function-declaration Generate an error, when calling a function without a prior declaration. .It Fl Wextra +(Alias +.Fl W Ns ) Activate some more warnings. In particular these are .Fl Wempty-statement , diff --git a/main.c b/main.c index 1c8cfd0..190f932 100644 --- a/main.c +++ b/main.c @@ -634,7 +634,6 @@ static void print_help_parser(void) static void print_help_warnings(void) { put_help("-w", "disable all warnings"); - put_help("-W", "ignored (gcc compatibility)"); put_help("-Wno-trigraphs", "warn if input contains trigraphs"); put_help("-Wundef", "Warn if an undefined macro is used in an #if"); print_warning_opt_help(); @@ -1135,9 +1134,7 @@ int main(int argc, char **argv) } } } else if (option[0] == 'W') { - if (option[1] == '\0') { - /* ignore -W, our defaults are already quite verbose */ - } else if (strstart(option + 1, "p,")) { + if (strstart(option + 1, "p,")) { // pass options directly to the preprocessor const char *opt; GET_ARG_AFTER(opt, "-Wp,"); diff --git a/warning.c b/warning.c index 9b09d2c..044af8d 100644 --- a/warning.c +++ b/warning.c @@ -147,7 +147,9 @@ void set_warning_opt(const char *const opt) state = false; } - if (0) {} + if (s[0] == '\0') { // -W is an alias for -Wextra + goto extra; + } #define OPTX(x) else if (strcmp(s, x) == 0) #define SET(y) (void)(warning.y = state) #define OPT(x, y) OPTX(x) SET(y) @@ -197,6 +199,7 @@ void set_warning_opt(const char *const opt) OPT("error", s_are_errors); OPT("error-implicit-function-declaration", error_implicit_function_declaration); OPTX("extra") { +extra: /* TODO */ // TODO SET(function_end_without_return); SET(empty_statement); -- 2.20.1