[Bug c/65403] -Wno-error=<not implemented> is an error
manu at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Mar 12 17:19:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65403
--- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
In fact, this version seems much more straightforward:
Index: opts-global.c
===================================================================
--- opts-global.c (revision 221118)
+++ opts-global.c (working copy)
@@ -60,13 +60,12 @@ along with GCC; see the file COPYING3.
#include "toplev.h"
#include "tree-pass.h"
#include "context.h"
#include "asan.h"
-typedef const char *const_char_p; /* For DEF_VEC_P. */
-
-static vec<const_char_p> ignored_options;
+static vec<const char *> ignored_options;
+static vec<const char *> ignored_wnoerror_options;
/* Input file names. */
const char **in_fnames;
unsigned num_in_fnames;
@@ -145,23 +144,35 @@ static void
postpone_unknown_option_warning (const char *opt)
{
ignored_options.safe_push (opt);
}
+/* This function is equivalent to the above, but it should be used to
+ buffer options passed to -Wno-error=. */
+void
+postpone_unknown_wnoerror_warning (const char *opt)
+{
+ ignored_wnoerror_options.safe_push (opt);
+}
+
/* Produce a warning for each option previously buffered. */
void
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,
+ "-Wno-error=%s: no option -W%s", opt, opt);
+ }
}
/* Handle an unknown option DECODED, returning true if an error should
be given. */
Index: opts.c
===================================================================
--- opts.c (revision 221118)
+++ opts.c (working copy)
@@ -2341,11 +2341,14 @@ enable_warning_as_error (const char *arg
new_option[0] = 'W';
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
+ postpone_unknown_wnoerror_warning (arg);
}
else
{
const diagnostic_t kind = value ? DK_ERROR : DK_WARNING;
Index: opts.h
===================================================================
--- opts.h (revision 221118)
+++ opts.h (working copy)
@@ -400,6 +400,7 @@ extern void default_options_optimization
extern void set_struct_debug_option (struct gcc_options *opts,
location_t loc,
const char *value);
extern bool opt_enum_arg_to_value (size_t opt_index, const char *arg,
int *value, unsigned int lang_mask);
+extern void postpone_unknown_wnoerror_warning (const char *opt);
#endif
More information about the Gcc-bugs
mailing list