aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/cpp/avoidpaste1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/cpp/avoidpaste1.c')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/avoidpaste1.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/cpp/avoidpaste1.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/avoidpaste1.c
new file mode 100644
index 000000000..3591f9c08
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/avoidpaste1.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 2001, 2003 Free Software Foundation, Inc. */
+
+/* { dg-do preprocess } */
+/* { dg-options "-ansi" } */
+
+/* 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
+#define tricky 1.0e ## -1
+
+/* This should preprocess as
+
+:: : : : : :^: 1.0e- 1
+: : : .. . 0 0 .
+
+It relies on the fact that even when preprocessing C we bother to separate
+the colons of C++'s :: operator. If we confine this behavior to C++
+in future, this test needs to change. */
+
+:: :g: :f(): :f(^): tricky
+:f(:): .. .__INCLUDE_LEVEL__ __INCLUDE_LEVEL__. /* Check builtins, too. */
+
+/* { dg-final { scan-file avoidpaste1.i ":: : : : : :\\^: 1.0e- 1" } }
+ { dg-final { scan-file avoidpaste1.i ": : : \\\.\\\. \\\. 0 0 \\\." } } */