13 const uint32_t Warn::SILENT = 0;
14 const uint32_t Warn::WARNING = 1u << 0;
15 const uint32_t Warn::ERROR = 1u << 1;
17 const char * Warn::names [TYPES] =
26 , error_accuml (false)
28 for (uint32_t i = 0; i <
TYPES; ++i)
51 mask[t] |= (WARNING | ERROR);
61 for (uint32_t i = 0; i <
TYPES; ++i)
71 for (uint32_t i = 0; i <
TYPES; ++i)
79 if (mask[t] & WARNING)
82 warning (names[t], line,
false,
"%s", s);
93 "looks like you use hardcoded numbers instead of autogenerated condition names: "
94 "better add '/*!types:re2c*/' directive or '-t, --type-header' option "
95 "and don't rely on fixed condition order.");
125 warning (names[
SWAPPED_RANGE], line, e,
"range lower bound (0x%X) is greater than upper bound (0x%X), swapping", l, u);
137 std::sort (ways.begin (), ways.end (),
cmp_ways);
140 fprintf (stderr,
"control flow %sis undefined for strings that match ",
incond (cond).c_str ());
141 const size_t count = ways.size ();
148 for (
size_t i = 0; i < count; ++i)
150 fprintf (stderr,
"\n\t");
153 fprintf (stderr,
"\n");
157 fprintf (stderr,
" ... and a few more");
159 fprintf (stderr,
", use default rule '*'");
171 fprintf (stderr,
"unreachable rule %s",
incond (cond).c_str ());
172 const size_t shadows = rule.
shadow.size ();
175 const char * pl = shadows > 1
178 std::set<rule_rank_t>::const_iterator i = rule.
shadow.begin ();
179 fprintf (stderr,
"(shadowed by rule%s at line%s %u", pl, pl, rules.find (*i)->second.line);
180 for (++i; i != rule.
shadow.end (); ++i)
182 fprintf (stderr,
", %u", rules.find (*i)->second.line);
184 fprintf (stderr,
")");
void undefined_control_flow(uint32_t line, const std::string &cond, std::vector< way_t > &ways, bool overflow)
void swapped_range(uint32_t line, uint32_t l, uint32_t u)
std::map< rule_rank_t, rule_info_t > rules_t
void warning_start(uint32_t line, bool error)
void empty_class(uint32_t line)
void match_empty_string(uint32_t line)
void warning(const char *type, uint32_t line, bool error, const char *fmt,...)
void useless_escape(uint32_t line, uint32_t col, char c)
#define RE2C_WARNING_TYPES
void warning_end(const char *type, bool error)
std::set< rule_rank_t > shadow
void unreachable_rule(const std::string &cond, const rule_info_t &rule, const rules_t &rules)
void fail(type_t t, uint32_t line, const char *s)
void condition_order(uint32_t line)
void fprint_way(FILE *f, const way_t &w)
bool cmp_ways(const way_t &w1, const way_t &w2)
void set(type_t t, option_t o)
std::string incond(const std::string &cond)