diff mbox

PR48524 spec language does not cover switches with separated form

Message ID 1410982.DYbR97LmGy@laptop1.gw.ume.nu
State New
Headers show

Commit Message

Magnus Granberg Dec. 20, 2011, 8:40 p.m. UTC
Hi

This patch make -D and -U work in the spec language, bug pr48524.
Tested on x86_64-unknown-linux-gnu snapshot 4.7-20111217

Magnus.

2011-12-18  Magnus Granberg  <zorry@gentoo.org>

			pr48524
			* gcc/gcc.c	(switch_matches) Support switches with separated 
			form, -D and -U.
			* gcc/testsuite/gcc.dg/pr48524.c	New testcase.
			* gcc/testsuite/gcc.dg/pr48524.spec	New spec file for the testcase.

----

Comments

Joseph Myers Dec. 20, 2011, 10:56 p.m. UTC | #1
On Tue, 20 Dec 2011, Magnus Granberg wrote:

> This patch make -D and -U work in the spec language, bug pr48524.
> Tested on x86_64-unknown-linux-gnu snapshot 4.7-20111217

Thanks for your contributions.  As you've contributed before, this patch 
brings things to about the point where a copyright assignment will be 
needed.  Please see <http://gcc.gnu.org/wiki/CopyrightAssignment> for the 
information to send to the FSF to get the assignment form.
Magnus Granberg Feb. 7, 2012, 11:43 p.m. UTC | #2
tisdag 20 december 2011 22.56.45 skrev du:
> On Tue, 20 Dec 2011, Magnus Granberg wrote:
> > This patch make -D and -U work in the spec language, bug pr48524.
> > Tested on x86_64-unknown-linux-gnu snapshot 4.7-20111217
> 
> Thanks for your contributions.  As you've contributed before, this patch
> brings things to about the point where a copyright assignment will be
> needed.  Please see <http://gcc.gnu.org/wiki/CopyrightAssignment> for the
> information to send to the FSF to get the assignment form.

The copyright assignment is done. (718297)
Wait for gcc 4.8?
/Magnus
Joseph Myers Feb. 8, 2012, 9:38 p.m. UTC | #3
On Tue, 20 Dec 2011, Magnus Granberg wrote:

> Hi
> 
> This patch make -D and -U work in the spec language, bug pr48524.
> Tested on x86_64-unknown-linux-gnu snapshot 4.7-20111217

Thanks.  I've fixed up the whitespace and the ChangeLog entry formatting 
and applied this patch now the copyright assignment is in.
diff mbox

Patch

--- a/gcc/gcc.c	2011-11-03 15:46:26.000000000 +0100
+++ b/gcc/gcc.c	2011-12-17 21:05:02.353999101 +0100
@@ -5445,6 +5445,21 @@ 
 	&& check_live_switch (i, plen))
       return true;
 
+    /* Check if a switch with separated form matching the atom.
+	We check -D and -U switches. */
+    else if (switches[i].args != 0)
+      {
+	if ((*switches[i].part1 == 'D' || *switches[i].part1 == 'U')
+	    && *switches[i].part1 == atom[0])
+	  {
+	    if (!strncmp (switches[i].args[0], &atom[1], len -1)
+		&& (starred || (switches[i].part1[1]== '\0'
+		&& switches[i].args[0][len -1] == '\0'))
+		&& check_live_switch (i, (starred ? 1 : -1)))
+	      return true;
+	  }
+      }
+
   return false;
 }
 
--- a/gcc/testsuite/gcc.dg/pr48524.c	2011-12-18 16:34:59.592259140 +0100
+++ b/gcc/testsuite/gcc.dg/pr48524.c	2011-12-18 02:11:22.000000000 +0100
@@ -0,0 +1,6 @@ 
+/* { dg-do preprocess } */
+/* { dg-options "-specs=${srcdir}/gcc.dg/pr48524.spec -D_TEST_D" } */
+# ifdef _FOO
+# error works /* { dg-error "works" } */
+# endif
+
--- a/gcc/testsuite/gcc.dg/pr48524.spec	2011-12-18 16:35:21.120259782 +0100
+++ b/gcc/testsuite/gcc.dg/pr48524.spec	2011-12-18 00:44:32.000000000 +0100
@@ -0,0 +1,5 @@ 
+*cpp_options:
+%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
+ %{f*} %{g*:%{!g0:%{g*} %{!fno-working-directory:-fworking-directory}}} %{O*}\
+ %{undef} %{save-temps*:-fpch-preprocess} %{D_TEST_D:-D_FOO}
+