diff options
author | Dodji Seketeli <dodji@redhat.com> | 2012-04-30 11:41:21 +0000 |
---|---|---|
committer | Dodji Seketeli <dodji@gcc.gnu.org> | 2012-04-30 13:41:21 +0200 |
commit | 0ff2b8a0225c3b1adeb0ebde107b7f30ba9e2fd1 (patch) | |
tree | 1d4cb06aa5ecf72c6a60528b1d81bb97c5bb8175 /gcc | |
parent | 4e65a47055ed1e7fb0068125bd95708ed86ab9af (diff) | |
download | gcc-0ff2b8a0225c3b1adeb0ebde107b7f30ba9e2fd1.zip gcc-0ff2b8a0225c3b1adeb0ebde107b7f30ba9e2fd1.tar.gz gcc-0ff2b8a0225c3b1adeb0ebde107b7f30ba9e2fd1.tar.bz2 |
Fix token pasting with -ftrack-macro-expansion
This patch makes token pasting work with -ftrack-macro-expansion
turned on. It improves some pasting related tests of the gcc.dg/cpp
subdirectory.
Tested and bootstrapped on x86_64-unknown-linux-gnu against trunk.
Note that the bootstrap with -ftrack-macro-expansion exhibits other
separate issues that are addressed in subsequent patches. This patch
just fixes one class of problems.
The patch does pass bootstrap with -ftrack-macro-expansion turned off,
though.
libcpp/
* macro.c (paste_all_tokens): Put the token resulting from pasting
into an extended token context with -ftrack-macro-location is in
effect.
gcc/testsuite/
* gcc.dg/cpp/paste17.c: New test case for
-ftrack-macro-expansion=2 mode only.
* gcc.dg/cpp/macro-exp-tracking-5.c: Likewise.
From-SVN: r186966
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-5.c | 18 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/paste17.c | 8 |
3 files changed, 33 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 45bda58..c7f6419 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2012-04-30 Dodji Seketeli <dodji@redhat.com> + + Fix token pasting with -ftrack-macro-expansion + * gcc.dg/cpp/paste17.c: New test case for + -ftrack-macro-expansion=2 mode only. + * gcc.dg/cpp/macro-exp-tracking-5.c: Likewise. + 2012-04-30 Eric Botcazou <ebotcazou@adacore.com> * gnat.dg/warn6.ad[sb]: New test. diff --git a/gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-5.c b/gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-5.c new file mode 100644 index 0000000..7933660 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-5.c @@ -0,0 +1,18 @@ +/* + { dg-options "-fshow-column -ftrack-macro-expansion" } + { dg-do compile } + */ + +#define PASTED var ## iable /* { dg-error "undeclared" } */ +#define call_foo(p1, p2) \ + foo (p1, \ + p2); /* { dg-message "in expansion of macro" } */ + +void foo(int, char); + +void +bar() +{ + call_foo(1,PASTED); /* { dg-message "expanded from here" } */ +} + diff --git a/gcc/testsuite/gcc.dg/cpp/paste17.c b/gcc/testsuite/gcc.dg/cpp/paste17.c new file mode 100644 index 0000000..9c6506f --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/paste17.c @@ -0,0 +1,8 @@ + /* { dg-options "-ftrack-macro-expansion=2" } */ +/* { dg-do preprocess } */ + +#define do_paste 1.0e ## -1 + +do_paste + +/* { dg-final {scan-file paste17.i "1.0e- 1" } }*/ |