public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Dominik Vogt <vogt@linux.vnet.ibm.com>
To: gcc-patches@gcc.gnu.org
Cc: Andreas Krebbel <krebbel@linux.vnet.ibm.com>
Subject: [PATCH] Honour DriverOnly for enum values in error messages.
Date: Mon, 27 Jul 2015 12:41:00 -0000	[thread overview]
Message-ID: <20150727114555.GA7180@linux.vnet.ibm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 603 bytes --]

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

[-- Attachment #2: 0001-ChangeLog --]
[-- Type: text/plain, Size: 183 bytes --]

/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.

[-- Attachment #3: 0001-Honour-DriverOnly-for-enum-values-in-error-messages.patch --]
[-- Type: text/x-diff, Size: 754 bytes --]

From 6d59f56f33804e70ab5be6ced734ed2e95eeea7b Mon Sep 17 00:00:00 2001
From: Dominik Vogt <vogt@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	other threads:[~2015-07-27 11:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-27 12:41 Dominik Vogt [this message]
2015-07-27 17:29 ` Jeff Law
2015-07-28  6:52 ` Andreas Krebbel
2015-07-30 19:13 ` Gunther Nikl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150727114555.GA7180@linux.vnet.ibm.com \
    --to=vogt@linux.vnet.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=krebbel@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).