@@ -26,6 +26,8 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic.h"
#include "spellcheck.h"
+vec<const char *> ignored_wnoerror_options;
+
static void prune_options (struct cl_decoded_option **, unsigned int *);
/* An option that is undocumented, that takes a joined argument, and
@@ -132,12 +132,16 @@ print_ignored_options (void)
{
while (!ignored_options.is_empty ())
{
- const char *opt;
-
- opt = ignored_options.pop ();
+ const char * opt = ignored_options.pop ();
warning_at (UNKNOWN_LOCATION, 0,
"unrecognized command line option %qs", opt);
}
+ while (!ignored_wnoerror_options.is_empty ())
+ {
+ const char * opt = ignored_wnoerror_options.pop ();
+ warning_at (UNKNOWN_LOCATION, 0,
+ "%<-Werror=%s%>: no option -W%s", opt, opt);
+ }
}
/* Handle an unknown option DECODED, returning true if an error should
@@ -3087,7 +3087,10 @@ enable_warning_as_error (const char *arg, int value, unsigned int lang_mask,
strcpy (new_option + 1, arg);
option_index = find_opt (new_option, lang_mask);
if (option_index == OPT_SPECIAL_unknown)
- error_at (loc, "%<-Werror=%s%>: no option -%s", arg, new_option);
+ if (value)
+ error_at (loc, "%<-Werror=%s%>: no option -%s", arg, new_option);
+ else
+ ignored_wnoerror_options.safe_push (arg);
else if (!(cl_options[option_index].flags & CL_WARNING))
error_at (loc, "%<-Werror=%s%>: -%s is not an option that controls "
"warnings", arg, new_option);
@@ -456,4 +456,6 @@ extern bool parse_and_check_align_values (const char *flag,
bool report_error,
location_t loc);
+extern vec<const char *> ignored_wnoerror_options;
+
#endif
From: Manuel López-Ibáñez <manu@gcc.gnu.org> * opts.c: Ignore -Wno-error=<some-future-warning> except if there are other diagnostics. --- gcc/opts-common.c | 2 ++ gcc/opts-global.c | 10 +++++++--- gcc/opts.c | 5 ++++- gcc/opts.h | 2 ++ 4 files changed, 15 insertions(+), 4 deletions(-)