From: Ulya Trofimovich Date: Wed, 5 Aug 2015 09:33:55 +0000 (+0100) Subject: Now -Werror- turns on (unlike -Werror in general). X-Git-Tag: 0.15~160 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=58d151e702e32f6f84d915c0b82bfd0a477d4a25;p=re2c Now -Werror- turns on (unlike -Werror in general). At least GCC does so. --- diff --git a/re2c/bootstrap/src/conf/parse_opts.cc b/re2c/bootstrap/src/conf/parse_opts.cc index ce4c30ce..d22a093d 100644 --- a/re2c/bootstrap/src/conf/parse_opts.cc +++ b/re2c/bootstrap/src/conf/parse_opts.cc @@ -1,4 +1,4 @@ -/* Generated by re2c 0.14.3 on Thu Jul 30 14:53:05 2015 */ +/* Generated by re2c 0.14.3 on Tue Aug 4 21:08:00 2015 */ #include #include "src/conf/msg.h" @@ -125,7 +125,7 @@ yy13: } yy15: ++YYCURSOR; - { warn.set_all (Warn::W); goto opt; } + { warn.set_all (); goto opt; } yy17: yych = *++YYCURSOR; if (yych == 'r') goto yy30; @@ -177,7 +177,7 @@ yy30: { option = Warn::WERROR; goto opt_warn; } yy36: ++YYCURSOR; - { warn.set_all (Warn::WERROR); goto opt; } + { warn.set_all_error (); goto opt; } yy38: ++YYCURSOR; yych = *YYCURSOR; diff --git a/re2c/src/conf/parse_opts.re b/re2c/src/conf/parse_opts.re index b0ab34f0..8dca8435 100644 --- a/re2c/src/conf/parse_opts.re +++ b/re2c/src/conf/parse_opts.re @@ -59,8 +59,8 @@ opt: "-" { goto opt_short; } "--" { goto opt_long; } - "-W" end { warn.set_all (Warn::W); goto opt; } - "-Werror" end { warn.set_all (Warn::WERROR); goto opt; } + "-W" end { warn.set_all (); goto opt; } + "-Werror" end { warn.set_all_error (); goto opt; } "-W" { option = Warn::W; goto opt_warn; } "-Wno-" { option = Warn::WNO; goto opt_warn; } "-Werror-" { option = Warn::WERROR; goto opt_warn; } diff --git a/re2c/src/conf/warn.cc b/re2c/src/conf/warn.cc index f06263be..88e5896a 100644 --- a/re2c/src/conf/warn.cc +++ b/re2c/src/conf/warn.cc @@ -46,7 +46,8 @@ void Warn::set (type_t t, option_t o) mask[t] &= ~WARNING; break; case WERROR: - mask[t] |= ERROR; + // unlike -Werror, -Werror- implies -W + mask[t] |= (WARNING | ERROR); break; case WNOERROR: mask[t] &= ~ERROR; @@ -54,11 +55,21 @@ void Warn::set (type_t t, option_t o) } } -void Warn::set_all (option_t o) +void Warn::set_all () { for (uint32_t i = 0; i < TYPES; ++i) { - set (static_cast (i), o); + mask[i] |= WARNING; + } +} + +// -Werror doesn't set any warnings: it only guarantees that if a warning +// has been set by now or will be set later then it will result into error. +void Warn::set_all_error () +{ + for (uint32_t i = 0; i < TYPES; ++i) + { + mask[i] |= ERROR; } } diff --git a/re2c/src/conf/warn.h b/re2c/src/conf/warn.h index 44229bd4..7d819b13 100644 --- a/re2c/src/conf/warn.h +++ b/re2c/src/conf/warn.h @@ -42,7 +42,8 @@ public: Warn (); bool error () const; void set (type_t t, option_t o); - void set_all (option_t o); + void set_all (); + void set_all_error (); void empty_class (uint32_t line); void match_empty_string (uint32_t line); void naked_default (uint32_t line, const std::vector > & stray_cunits, const std::string & cond);