X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=warning.c;h=975f2d05817bc648e6bd5af1328e265d8856849c;hb=47b73b80e0b34b1e716253384d0a7c56f2a5e268;hp=8caacbfb826eddcd39107e3bdb9673ac28305800;hpb=6833c6f5a5ade3d5ad0c9ec21c9a89b7985517f4;p=cparser diff --git a/warning.c b/warning.c index 8caacbf..975f2d0 100644 --- a/warning.c +++ b/warning.c @@ -92,7 +92,9 @@ void print_warning_opt_help(void) { /* TODO: write explanations */ for (warning_switch_t* i = warning; i != endof(warning); ++i) { - put_help(i->name, ""); + char buf[256]; + snprintf(buf, sizeof(buf), "-W%s", i->name); + put_help(buf, ""); } } @@ -119,7 +121,7 @@ void set_warning_opt(const char *const opt) } for (warning_switch_t* i = warning; i != endof(warning); ++i) { - if (strcmp(i->name, s) == 0) { + if (streq(i->name, s)) { i->state = (i->state & ~off) | on; return; } @@ -128,7 +130,7 @@ void set_warning_opt(const char *const opt) if (s[0] == '\0') { // -W is an alias for -Wextra goto extra; } -#define OPTX(x) else if (strcmp(s, x) == 0) +#define OPTX(x) else if (streq(s, x)) #define SET(y) (void)(warning[y].state = (warning[y].state & ~off) | on) OPTX("all") { /* Note: this switched on a lot more warnings than gcc's -Wall */ @@ -186,7 +188,7 @@ extra: } #undef SET #undef OPT_X - else if (strcmp(opt /* sic */, "error-implicit-function-declaration") == 0) { + else if (streq(opt /* sic */, "error-implicit-function-declaration")) { /* GCC legacy: This way it only can be activated. */ warning[WARN_IMPLICIT_FUNCTION_DECLARATION].state = WARN_STATE_ON | WARN_STATE_ERROR; return;