diff options
Diffstat (limited to 'gnu/gcc')
-rw-r--r-- | gnu/gcc/gcc/opts.c | 24 | ||||
-rw-r--r-- | gnu/gcc/gcc/opts.h | 1 | ||||
-rw-r--r-- | gnu/gcc/gcc/toplev.c | 3 |
3 files changed, 26 insertions, 2 deletions
diff --git a/gnu/gcc/gcc/opts.c b/gnu/gcc/gcc/opts.c index b6217e8df4a..003fa82745c 100644 --- a/gnu/gcc/gcc/opts.c +++ b/gnu/gcc/gcc/opts.c @@ -195,6 +195,18 @@ complain_wrong_lang (const char *text, const struct cl_option *option, free (bad_lang); } +static const char *bad_option = NULL; + +void +late_options_error (void) +{ + if (bad_option) + { + input_location = unknown_location; + error ("unrecognized command line option \"%s\"", bad_option); + } +} + /* Handle the switch beginning at ARGV for the language indicated by LANG_MASK. Returns the number of switches consumed. */ static unsigned int @@ -226,8 +238,16 @@ handle_option (const char **argv, unsigned int lang_mask) opt_index = find_opt (opt + 1, lang_mask | CL_COMMON | CL_TARGET); } - if (opt_index == cl_options_count) - goto done; + if (opt_index == cl_options_count) + { + /* ignore unknown -Wno-* options */ + if (value == 0 && opt[1] == 'W') + { + bad_option = argv[0]; + result = 1; + } + goto done; + } option = &cl_options[opt_index]; diff --git a/gnu/gcc/gcc/opts.h b/gnu/gcc/gcc/opts.h index 3af501fbf99..fee202dcb4b 100644 --- a/gnu/gcc/gcc/opts.h +++ b/gnu/gcc/gcc/opts.h @@ -88,6 +88,7 @@ extern unsigned num_in_fnames; size_t find_opt (const char *input, int lang_mask); extern void prune_options (int *argcp, char ***argvp); extern void decode_options (unsigned int argc, const char **argv); +extern void late_options_error (void); extern int option_enabled (int opt_idx); extern bool get_option_state (int, struct cl_option_state *); diff --git a/gnu/gcc/gcc/toplev.c b/gnu/gcc/gcc/toplev.c index 39b92e10b23..501505fe30a 100644 --- a/gnu/gcc/gcc/toplev.c +++ b/gnu/gcc/gcc/toplev.c @@ -2045,7 +2045,10 @@ toplev_main (unsigned int argc, const char **argv) do_compile (); if (errorcount || sorrycount) + { + late_options_error (); return (FATAL_EXIT_CODE); + } return (SUCCESS_EXIT_CODE); } |