public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Joseph S. Myers" <joseph@codesourcery.com>
To: gcc-patches@gcc.gnu.org
Subject: Fix optc-gen.awk handling of variables with both Variable and Var
Date: Mon, 04 Apr 2011 14:21:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.64.1104041420420.22197@digraph.polyomino.org.uk> (raw)

In the course of testing another patch I noticed an "excess elements
in struct initializer" warning building options.c for iq2000-elf.  The
problem turns out to be that if a .opt variable is specified both with
a Variable entry, without an initializer, and with Var on individual
options, then it gets listed in var_seen in two different ways,
resulting in two initializers even though there is only one structure
field for the variable.  This patch fixes this, making the logic on
optc-gen.awk follow that in opth-gen.awk more closely.

Tested building cc1 and xgcc for cross to iq2000-elf and committed to
trunk.  (Though the bug in optc-gen.awk is present on 4.6 branch, I
don't think it actually affects any targets there.)

2011-04-04  Joseph Myers  <joseph@codesourcery.com>

	* optc-gen.awk: Always remove type from Variable entry before
	recording in var_seen.

Index: optc-gen.awk
===================================================================
--- optc-gen.awk	(revision 171932)
+++ optc-gen.awk	(working copy)
@@ -202,14 +202,15 @@
 	init = extra_vars[i]
 	if (var ~ "=" ) {
 		sub(".*= *", "", init)
-		sub(" *=.*", "", var)
-		sub("^.*[ *]", "", var)
-		sub("\\[.*\\]$", "", var)
 	} else {
 		init = "0"
 	}
-	var_seen[var] = 1
-	print "  " init ", /* " var " */"
+	sub(" *=.*", "", var)
+	name = var
+	sub("^.*[ *]", "", name)
+	sub("\\[.*\\]$", "", name)
+	var_seen[name] = 1
+	print "  " init ", /* " name " */"
 }
 for (i = 0; i < n_opts; i++) {
 	if (flag_set_p("Save", flags[i]))

-- 
Joseph S. Myers
joseph@codesourcery.com

                 reply	other threads:[~2011-04-04 14:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=Pine.LNX.4.64.1104041420420.22197@digraph.polyomino.org.uk \
    --to=joseph@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    /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).