X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/12bc1c9e47a5c043e1d2bba599846732b93d062c..cc8962bdde81b04aa728aef21e53b4a08a0debfe:/src/complain.c?ds=inline diff --git a/src/complain.c b/src/complain.c index 1162da29..fdc4b542 100644 --- a/src/complain.c +++ b/src/complain.c @@ -63,10 +63,12 @@ static const char * const warnings_args[] = "conflicts-sr", "conflicts-rr", "deprecated", + "empty-rule", "precedence", "other", "all", "error", + "everything", 0 }; @@ -78,10 +80,12 @@ static const int warnings_types[] = Wconflicts_sr, Wconflicts_rr, Wdeprecated, + Wempty_rule, Wprecedence, Wother, Wall, - Werror + Werror, + Weverything }; ARGMATCH_VERIFY (warnings_args, warnings_types); @@ -92,10 +96,10 @@ warning_argmatch (char const *arg, size_t no, size_t err) int value = XARGMATCH ("--warning", arg + no + err, warnings_args, warnings_types); - /* -Wnone == -Wno-all, and -Wno-none == -Wall. */ + /* -Wnone == -Wno-everything, and -Wno-none == -Weverything. */ if (!value) { - value = Wall; + value = Weverything; no = !no; } @@ -143,7 +147,7 @@ warnings_argmatch (char *args) else if (STREQ (args, "no-error")) { warnings_are_errors = false; - warning_argmatch ("no-error=all", 3, 6); + warning_argmatch ("no-error=everything", 3, 6); } else { @@ -194,6 +198,15 @@ warning_severity (warnings flags) } } +bool +warning_is_unset (warnings flags) +{ + size_t b; + for (b = 0; b < warnings_size; ++b) + if (flags & 1 << b && warnings_flag[b] != severity_unset) + return false; + return true; +} /** Display a "[-Wyacc]" like message on \a f. */ @@ -354,3 +367,13 @@ deprecated_directive (location const *loc, char const *old, char const *upd) _("deprecated directive: %s, use %s"), quote (old), quote_n (1, upd)); } + +void +duplicate_directive (char const *directive, + location first, location second) +{ + unsigned i = 0; + complain (&second, complaint, _("only one %s allowed per rule"), directive); + i += SUB_INDENT; + complain_indent (&first, complaint, &i, _("previous declaration")); +}