cpphash.c (collect_expansion): Trim trailing white space from macro definitions...
* cpphash.c (collect_expansion): Trim trailing white space from macro definitions, but don't go past the last insertion point. * gcc.dg/cpp-redef.c: New test. From-SVN: r32283
This commit is contained in:
parent
2bfa73e418
commit
fbb886eb38
4 changed files with 35 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
2000-03-01 Zack Weinberg <zack@wolery.cumb.org>
|
||||
|
||||
* cpphash.c (collect_expansion): Trim trailing white space
|
||||
from macro definitions, but don't go past the last insertion
|
||||
point.
|
||||
|
||||
Wed Mar 1 12:14:31 MET 2000 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
* i386.md (mulqi3): New pattern.
|
||||
|
|
|
@ -487,6 +487,12 @@ collect_expansion (pfile, arglist)
|
|||
else if (last_token == PASTE)
|
||||
cpp_error (pfile, "`##' at end of macro definition");
|
||||
|
||||
/* Trim trailing white space from definition. */
|
||||
here = CPP_WRITTEN (pfile);
|
||||
while (here > last && is_hspace (pfile->token_buffer [here-1]))
|
||||
here--;
|
||||
CPP_SET_WRITTEN (pfile, here);
|
||||
|
||||
CPP_NUL_TERMINATE (pfile);
|
||||
len = CPP_WRITTEN (pfile) - start + 1;
|
||||
exp = xmalloc (len + 4); /* space for no-concat markers at either end */
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2000-03-01 Zack Weinberg <zack@wolery.cumb.org>
|
||||
|
||||
* gcc.dg/cpp-redef.c: New test.
|
||||
|
||||
2000-02-29 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* g++.old-deja/g++.pt/unify7.C: New test.
|
||||
|
|
19
gcc/testsuite/gcc.dg/cpp-redef.c
Normal file
19
gcc/testsuite/gcc.dg/cpp-redef.c
Normal file
|
@ -0,0 +1,19 @@
|
|||
/* Test for redefining macros with insignificant (i.e. whitespace)
|
||||
differences. */
|
||||
|
||||
/* { dg-do preprocess } */
|
||||
|
||||
#define foo bar
|
||||
#define /* x */ foo /* x */ bar /* x */
|
||||
|
||||
#define quux(thud) a one and a thud and a two
|
||||
#define /**/ quux( thud ) /**/ a one and a /**/ thud /**/ and /**/ a two
|
||||
#define quux(thud) a one and a thud and a two /* bah */
|
||||
|
||||
/* { dg-bogus "redefined" "foo redefined" { target *-*-* } 7 } */
|
||||
/* { dg-bogus "redefined" "quux redefined" { target *-*-* } 10 } */
|
||||
/* { dg-bogus "redefined" "quux redefined" { target *-*-* } 11 } */
|
||||
|
||||
/* { dg-bogus "previous def" "foo prev def" { target *-*-* } 6 } */
|
||||
/* { dg-bogus "previous def" "quux prev def" { target *-*-* } 9 } */
|
||||
/* { dg-bogus "previous def" "quux prev def" { target *-*-* } 10 } */
|
Loading…
Add table
Reference in a new issue