diff options
| author | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-03-01 19:12:18 +0000 |
|---|---|---|
| committer | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-03-01 19:12:18 +0000 |
| commit | d2ea3099e669c23b21d2f88ccc54c1f6e9794722 (patch) | |
| tree | 45dc3801feb7b5799c53891d276d988e0de65f2d | |
| parent | f11a48172d13c61e6a2385a92d6232c780e371eb (diff) | |
| download | ppe42-gcc-d2ea3099e669c23b21d2f88ccc54c1f6e9794722.tar.gz ppe42-gcc-d2ea3099e669c23b21d2f88ccc54c1f6e9794722.zip | |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32283 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/ChangeLog | 6 | ||||
| -rw-r--r-- | gcc/cpphash.c | 6 | ||||
| -rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
| -rw-r--r-- | gcc/testsuite/gcc.dg/cpp-redef.c | 19 |
4 files changed, 35 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 38a25c5a713..29dee244b2f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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. diff --git a/gcc/cpphash.c b/gcc/cpphash.c index c5c20ac9bf8..d44bdcb48c9 100644 --- a/gcc/cpphash.c +++ b/gcc/cpphash.c @@ -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 */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 10a4b14284b..f51ec94bf15 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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. diff --git a/gcc/testsuite/gcc.dg/cpp-redef.c b/gcc/testsuite/gcc.dg/cpp-redef.c new file mode 100644 index 00000000000..a5fe2bacc53 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp-redef.c @@ -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 } */ |

