/** Diagnostics severity. */
typedef enum
{
- severity_disabled = 0,
- severity_unset = 1,
- severity_warning = 2,
- severity_error = 3,
- severity_fatal = 4
+ severity_disabled = 0, /**< Explicitly disabled via -Wno-foo. */
+ severity_unset = 1, /**< Unspecified status. */
+ severity_warning = 2, /**< A warning. */
+ severity_error = 3, /**< An error (continue, but die soon). */
+ severity_fatal = 4 /**< Fatal error (die now). */
} severity;
"other",
"all",
"error",
+ "everything",
0
};
Wprecedence,
Wother,
Wall,
- Werror
+ Werror,
+ Weverything
};
ARGMATCH_VERIFY (warnings_args, warnings_types);
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;
}
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
{
+ // The length of the possible 'no-' prefix: 3, or 0.
size_t no = STRPREFIX_LIT ("no-", args) ? 3 : 0;
+ // The length of the possible 'error=' (possibly after
+ // 'no-') prefix: 6, or 0.
size_t err = STRPREFIX_LIT ("error=", args + no) ? 6 : 0;
warning_argmatch (args, no, err);
_("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"));
+}