diff options
author | Neil Booth <neilb@earthling.net> | 2000-12-03 12:07:40 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2000-12-03 12:07:40 +0000 |
commit | 881bc7db37d9dc2e8836338d4167f23ab34a8163 (patch) | |
tree | 7597f908bb1ae42734096368a61f8092642fc5f6 /gcc | |
parent | 8aaef6e0c9109dd291029f543042900660fae287 (diff) | |
download | gcc-881bc7db37d9dc2e8836338d4167f23ab34a8163.zip gcc-881bc7db37d9dc2e8836338d4167f23ab34a8163.tar.gz gcc-881bc7db37d9dc2e8836338d4167f23ab34a8163.tar.bz2 |
* gcc.dg/cpp/macro6.c: New test cases.
From-SVN: r37972
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/macro6.c | 32 |
2 files changed, 36 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b205469..c1f0c03 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2000-12-03 Neil Booth <neilb@earthling.net> + + * gcc.dg/cpp/macro6.c: New test cases. + 2000-12-02 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> * gcc.c-torture/execute/string-opt-9.c: New test. diff --git a/gcc/testsuite/gcc.dg/cpp/macro6.c b/gcc/testsuite/gcc.dg/cpp/macro6.c new file mode 100644 index 0000000..0fe52ee --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/macro6.c @@ -0,0 +1,32 @@ +/* { dg-do run } */ + +/* Test that, when a macro expansion spills into the source file, we + expand macros we suck in from there, as the standard clearly states + they are not nested. + + Submitter: Neil Booth, with minor modifications to the originals. 3 + Dec 2000. + Source: PR 962 and Thomas Pornin. */ + +extern void abort (void); +int e = 10, f = 100; + +#define e(n) 4 + n +#define X e +#define f(x) x +#define h(x) x + f + +int +main () +{ + if (X(X) != 14) /* Should expand to "4 + e". */ + abort (); + + if (X(X(f)) != 108) /* Should expand to "4 + 4 + f". */ + abort (); + + if (h(e)(h(e)) != 120) /* Should expand to "e + e + f". */ + abort (); + + return 0; +} |