aboutsummaryrefslogtreecommitdiff
path: root/gcc/opts.c
diff options
context:
space:
mode:
authorManuel López-Ibáñez <manu@gcc.gnu.org>2015-09-24 16:37:43 +0000
committerManuel López-Ibáñez <manu@gcc.gnu.org>2015-09-24 16:37:43 +0000
commit3563212292d643dee54ff75771032ea92fe34e78 (patch)
tree65b1cf01a9ae795a5ecb148e8eac6ed626108fc6 /gcc/opts.c
parent2af16a7c1e190f54a2d276a1088d39bcc9cbdce4 (diff)
downloadgcc-3563212292d643dee54ff75771032ea92fe34e78.zip
gcc-3563212292d643dee54ff75771032ea92fe34e78.tar.gz
gcc-3563212292d643dee54ff75771032ea92fe34e78.tar.bz2
fdiagnostics-color=never does not disable color for some diagnostics
Actually, I was trying to reject non-warning options as argument to -Werror=. However, the new test fails because -fdiagnostics-color=never is always placed by the driver after the warning options when calling the compiler proper. This patch prunes all -fdiagnostics-color from the command-line but the last one, which is moved to the first position. gcc/ChangeLog: 2015-09-24 Manuel López-Ibáñez <manu@gcc.gnu.org> PR driver/67640 * opts-common.c (prune_options): Discard all -fdiagnostics-color but the last one, which is moved to the front to be processed first. * opts.c (enable_warning_as_error): Reject options that do not control warnings. gcc/testsuite/ChangeLog: 2015-09-24 Manuel López-Ibáñez <manu@gcc.gnu.org> PR driver/67640 * gcc.dg/Werror-13.c: New test. From-SVN: r228094
Diffstat (limited to 'gcc/opts.c')
-rw-r--r--gcc/opts.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/opts.c b/gcc/opts.c
index f1a9acd..b437114 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -2359,9 +2359,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);
- }
+ error_at (loc, "-Werror=%s: no option -%s", arg, new_option);
+ 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);
else
{
const diagnostic_t kind = value ? DK_ERROR : DK_WARNING;