diff options
author | Martin Liska <mliska@suse.cz> | 2019-04-30 15:50:24 +0200 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2019-04-30 13:50:24 +0000 |
commit | 5bcc5a3b28d56bff2c70e5f52ce25f2cd7ee055e (patch) | |
tree | b434cee79d7c973543f21d75b421d156dc9a3bf1 /gcc/c-family/c-pragma.c | |
parent | 44bf4743079e18380ff7ef208299545675f05671 (diff) | |
download | gcc-5bcc5a3b28d56bff2c70e5f52ce25f2cd7ee055e.zip gcc-5bcc5a3b28d56bff2c70e5f52ce25f2cd7ee055e.tar.gz gcc-5bcc5a3b28d56bff2c70e5f52ce25f2cd7ee055e.tar.bz2 |
Add option suggestion for -Werror=foo and corresponding pragma.
2019-04-30 Martin Liska <mliska@suse.cz>
* opts.c (enable_warning_as_error): Provide hints
for unknown options.
2019-04-30 Martin Liska <mliska@suse.cz>
* c-pragma.c (handle_pragma_diagnostic): Provide hints
for unknown options.
2019-04-30 Martin Liska <mliska@suse.cz>
* gcc.dg/Werror-13.c: Add new tests for it.
* gcc.dg/pragma-diag-6.c: Likewise.
From-SVN: r270693
Diffstat (limited to 'gcc/c-family/c-pragma.c')
-rw-r--r-- | gcc/c-family/c-pragma.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/c-family/c-pragma.c b/gcc/c-family/c-pragma.c index fbc734a..6b8ada5 100644 --- a/gcc/c-family/c-pragma.c +++ b/gcc/c-family/c-pragma.c @@ -33,6 +33,7 @@ along with GCC; see the file COPYING3. If not see #include "c-pragma.h" #include "opts.h" #include "plugin.h" +#include "opt-suggestions.h" #define GCC_BAD(gmsgid) \ do { warning (OPT_Wpragmas, gmsgid); return; } while (0) @@ -804,8 +805,16 @@ handle_pragma_diagnostic(cpp_reader *ARG_UNUSED(dummy)) unsigned int option_index = find_opt (option_string + 1, lang_mask); if (option_index == OPT_SPECIAL_unknown) { - warning_at (loc, OPT_Wpragmas, - "unknown option after %<#pragma GCC diagnostic%> kind"); + option_proposer op; + const char *hint = op.suggest_option (option_string + 1); + if (hint) + warning_at (loc, OPT_Wpragmas, + "unknown option after %<#pragma GCC diagnostic%> kind;" + " did you mean %<-%s%>", hint); + else + warning_at (loc, OPT_Wpragmas, + "unknown option after %<#pragma GCC diagnostic%> kind"); + return; } else if (!(cl_options[option_index].flags & CL_WARNING)) |