summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2000-11-15 19:23:41 +0000
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2000-11-15 19:23:41 +0000
commitc5c321bf0b0ddf59a949253080281132d73205ac (patch)
tree8b147fe2b8f784946b7ccc7782cc6912ebc7b0f3
parent8fed5d5e2d04f93340379e5195b9ceed1855eee1 (diff)
downloadppe42-gcc-c5c321bf0b0ddf59a949253080281132d73205ac.tar.gz
ppe42-gcc-c5c321bf0b0ddf59a949253080281132d73205ac.zip
* gcc.dg/cpp/_Pragma1.c: Update.
* gcc.dg/cpp/_Pragma2.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37486 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/cpp/_Pragma1.c16
-rw-r--r--gcc/testsuite/gcc.dg/cpp/_Pragma2.c13
3 files changed, 25 insertions, 9 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6a01b9243a1..1ff1fac31e7 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2000-11-15 Neil Booth <neilb@earthling.net>
+
+ gcc.dg/cpp/_Pragma1.c: Update.
+ gcc.dg/cpp/_Pragma2.c: New test.
+
2000-11-15 Nathan Sidwell <nathan@codesourcery.com>
* g++.old-deja/g++.other/anon5.C: New test.
diff --git a/gcc/testsuite/gcc.dg/cpp/_Pragma1.c b/gcc/testsuite/gcc.dg/cpp/_Pragma1.c
index 8759b0a0824..0f211a9858b 100644
--- a/gcc/testsuite/gcc.dg/cpp/_Pragma1.c
+++ b/gcc/testsuite/gcc.dg/cpp/_Pragma1.c
@@ -13,12 +13,10 @@ p1 /* { dg-error "poisoned" } */
_Pragma ("GCC poison p2")
p2 /* { dg-error "poisoned" } */
-/* I can see no reason it cannot appear in a directive. Check we
- enter the conditional. Putting the _Pragma at EOL also catches
- nasties like not saving current lexer state properly. Also test
- that wide strings are OK. */
-#if 1 _Pragma (L"GCC poison p3")
-p3 /* { dg-error "poisoned" } */
+/* Don't interpret _Pragmas in directives. The standard is not clear
+ on this, but I think this makes most sense. */
+#if 1 _Pragma (L"GCC poison p3") /* { dg-error "missing binary operator" } */
+p3
#endif
#define M1 _Pragma ("GCC poison p4")
@@ -29,10 +27,10 @@ p4 /* No problem; not yet poisoned. */
M1 p4 /* { dg-error "poisoned" } */
M2 (GCC poison p5) p5 /* { dg-error "poisoned" } */
-/* Look, ma! These things even nest. */
+/* Not interpreting _Pragma in directives means they don't nest. */
_Pragma ("_Pragma (\"GCC poison p6\") GCC poison p7")
-p6 /* { dg-error "poisoned" } */
-p7 /* { dg-error "poisoned" } */
+p6
+p7
/* Check we ignore them in false conditionals. */
#if 0
diff --git a/gcc/testsuite/gcc.dg/cpp/_Pragma2.c b/gcc/testsuite/gcc.dg/cpp/_Pragma2.c
new file mode 100644
index 00000000000..24c4457ede7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/_Pragma2.c
@@ -0,0 +1,13 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc. */
+
+/* { dg-do preprocess } */
+
+/* Don't allow directives in a _Pragma string. */
+
+/* Contributed by Neil Booth 14 Nov 2000. */
+
+_Pragma("#define test")
+
+#ifdef test
+#error Do not allow directives in _Pragma strings
+#endif
OpenPOWER on IntegriCloud