At least GCC does so.
-/* 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 <stdio.h>
#include "src/conf/msg.h"
}
yy15:
++YYCURSOR;
- { warn.set_all (Warn::W); goto opt; }
+ { warn.set_all (); goto opt; }
yy17:
yych = *++YYCURSOR;
if (yych == 'r') goto 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;
"-" { 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; }
mask[t] &= ~WARNING;
break;
case WERROR:
- mask[t] |= ERROR;
+ // unlike -Werror, -Werror-<warning> implies -W<warning>
+ mask[t] |= (WARNING | ERROR);
break;
case WNOERROR:
mask[t] &= ~ERROR;
}
}
-void Warn::set_all (option_t o)
+void Warn::set_all ()
{
for (uint32_t i = 0; i < TYPES; ++i)
{
- set (static_cast<type_t> (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;
}
}
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<std::pair<uint32_t, uint32_t> > & stray_cunits, const std::string & cond);