diff options
author | Neil Booth <neil@daikokuya.demon.co.uk> | 2001-01-28 11:27:22 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2001-01-28 11:27:22 +0000 |
commit | 14e2799a89991e4c9f1c520a27aa88cf9ba2a4b0 (patch) | |
tree | d414672bdbfac05998d28c38bdbab5140cd55c25 | |
parent | 26ec42ee4d266cf25be73a29888abf906b2d10ef (diff) | |
download | gcc-14e2799a89991e4c9f1c520a27aa88cf9ba2a4b0.zip gcc-14e2799a89991e4c9f1c520a27aa88cf9ba2a4b0.tar.gz gcc-14e2799a89991e4c9f1c520a27aa88cf9ba2a4b0.tar.bz2 |
* gcc.dg/cpp/avoidpaste1.c: Test case.
From-SVN: r39319
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/avoidpaste1.c | 32 |
2 files changed, 36 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index edd5222..d5e7c9e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2001-01-28 Neil Booth <neil@daikokuya.demon.co.uk> + + * gcc.dg/cpp/avoidpaste1.c: Test case. + 2001-01-28 Jakub Jelinek <jakub@redhat.com> * g++.old-deja/g++.other/inline18.C: New test. diff --git a/gcc/testsuite/gcc.dg/cpp/avoidpaste1.c b/gcc/testsuite/gcc.dg/cpp/avoidpaste1.c new file mode 100644 index 0000000..54233e8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/avoidpaste1.c @@ -0,0 +1,32 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* This tests that we avoid accidental pasting only before and after + macros and arguments, and not when the tokens are already pasted + in the souce file (e.g. "::" in a C source file). + + Neil Booth, 28 Jan 2001. */ + +#define f(x) x +#define g + +/* This should preprocess as + +:: : : : : :^: +: : : .. . 0 + +It relies on the fact that even preprocessing C we bother to separate +the colons of C++'s :: operator. If we confine this behaviour to C++ +in future, this test needs to change. */ + +:: :g: :f(): :f(^): +:f(:): .. .__INCLUDE_LEVEL__ /* Check builtins, too. */ + +/* + { dg-final { if ![file exists avoidpaste1.i] { return } } } + { dg-final { if { [grep avoidpaste1.i ":: : : : : :\\^:"] != "" } \{ } } + { dg-final { if { [grep avoidpaste1.i ": : : \\\.\\\. \\\. 0"] != "" } \{ } } + { dg-final { return \} \} } } + { dg-final { fail "avoidpaste1.c: paste avoidance" } } +*/ |