re PR driver/48524 (spec language does not cover switches with separated form)

2012-02-08  Magnus Granberg  <zorry@gentoo.org>

	PR driver/48524
	* gcc.c (switch_matches) Support switches with separated form, -D
	and -U.

testsuite:
	* gcc.dg/pr48524.c: New test.
	* gcc.dg/pr48524.spec: New spec file for test.

From-SVN: r184022
This commit is contained in:
Magnus Granberg 2012-02-08 21:37:50 +00:00 committed by Joseph Myers
parent 893f430128
commit 5371f7195e
5 changed files with 38 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2012-02-08 Magnus Granberg <zorry@gentoo.org>
PR driver/48524
* gcc.c (switch_matches) Support switches with separated form, -D
and -U.
2012-02-08 Georg-Johann Lay <avr@gjlay.de>
* config/avr/avr.md (SREG_ADDR): Remove constant definition.

View File

@ -5455,6 +5455,21 @@ switch_matches (const char *atom, const char *end_atom, int starred)
&& 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;
}

View File

@ -1,3 +1,9 @@
2012-02-08 Magnus Granberg <zorry@gentoo.org>
PR driver/48524
* gcc.dg/pr48524.c: New test.
* gcc.dg/pr48524.spec: New spec file for test.
2012-02-08 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/32380

View File

@ -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

View File

@ -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}