The attached patch fixes a glicht in the error message generated
for invalid values of enum options.  When a "DriverOnly" option
was passed directoy top the compiler, it would still list that as
valid in the error message, e.g. on s390:

  $ cc1 <...> -march=native
  cc1: error: unrecognized argument in option ‘-march=native’
  cc1: note: valid arguments to ‘-march=’ are: g5 g6 native z10 z13 z196 z9-109 
z9-ec z900 z990 zEC12

The patched code prints DriverOnly enum values only when the
driver generates the error message.

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany
/gcc/ChangeLog

        * opts-common.c (read_cmdline_option): List DriverOnly enum values as
        valid only in the error message of the driver, not in the messages of
        the language compilers.
>From 6d59f56f33804e70ab5be6ced734ed2e95eeea7b Mon Sep 17 00:00:00 2001
From: Dominik Vogt <v...@linux.vnet.ibm.com>
Date: Mon, 27 Jul 2015 12:39:30 +0100
Subject: [PATCH] Honour DriverOnly for enum values in error messages.

---
 gcc/opts-common.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/opts-common.c b/gcc/opts-common.c
index 8e51974..3bcbaf1 100644
--- a/gcc/opts-common.c
+++ b/gcc/opts-common.c
@@ -1079,6 +1079,8 @@ read_cmdline_option (struct gcc_options *opts,
       p = s;
       for (i = 0; e->values[i].arg != NULL; i++)
 	{
+	  if (!enum_arg_ok_for_language (&e->values[i], lang_mask))
+	    continue;
 	  size_t arglen = strlen (e->values[i].arg);
 	  memcpy (p, e->values[i].arg, arglen);
 	  p[arglen] = ' ';
-- 
2.3.0

Reply via email to