From b982244362124a7f2ba907b08afe820e37aabaca Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sat, 25 Feb 2017 00:15:56 +0100 Subject: re PR c/79677 (Weird handling of -Werror=) PR c/79677 * opts.h (handle_generated_option): Add GENERATED_P argument. * opts-common.c (handle_option): Adjust function comment. (handle_generated_option): Add GENERATED_P argument, pass it to handle_option. (control_warning_option): Pass false to handle_generated_option GENERATED_P. * opts.c (maybe_default_option): Pass true to handle_generated_option GENERATED_P. * optc-gen.awk: Likewise. ada/ * gcc-interface/misc.c (gnat_handle_option): Pass true to handle_generated_option GENERATED_P. testsuite/ * gcc.dg/pr79677.c: New test. From-SVN: r245728 --- gcc/opts-common.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'gcc/opts-common.c') diff --git a/gcc/opts-common.c b/gcc/opts-common.c index 8b924c9..f2f7385 100644 --- a/gcc/opts-common.c +++ b/gcc/opts-common.c @@ -959,9 +959,10 @@ keep: option for options from the source file, UNKNOWN_LOCATION otherwise. GENERATED_P is true for an option generated as part of processing another option or otherwise generated internally, false - for one explicitly passed by the user. Returns false if the switch - was invalid. DC is the diagnostic context for options affecting - diagnostics state, or NULL. */ + for one explicitly passed by the user. control_warning_option + generated options are considered explicitly passed by the user. + Returns false if the switch was invalid. DC is the diagnostic + context for options affecting diagnostics state, or NULL. */ static bool handle_option (struct gcc_options *opts, @@ -1005,13 +1006,13 @@ handle_generated_option (struct gcc_options *opts, size_t opt_index, const char *arg, int value, unsigned int lang_mask, int kind, location_t loc, const struct cl_option_handlers *handlers, - diagnostic_context *dc) + bool generated_p, diagnostic_context *dc) { struct cl_decoded_option decoded; generate_option (opt_index, arg, value, lang_mask, &decoded); return handle_option (opts, opts_set, &decoded, lang_mask, kind, loc, - handlers, true, dc); + handlers, generated_p, dc); } /* Fill in *DECODED with an option described by OPT_INDEX, ARG and @@ -1503,7 +1504,7 @@ control_warning_option (unsigned int opt_index, int kind, const char *arg, handle_generated_option (opts, opts_set, opt_index, arg, value, lang_mask, - kind, loc, handlers, dc); + kind, loc, handlers, false, dc); } } } -- cgit v1.1