FSF GCC merge 02/23/03
[official-gcc.git] / gcc / testsuite / gcc.dg / cpp / _Pragma1.c
blob0f211a9858b48a4cda97627561d78fffd3452bd4
1 /* Copyright (C) 2000 Free Software Foundation, Inc. */
3 /* { dg-do preprocess } */
5 /* Tests the _Pragma operator. Contributed by Neil Booth 1 Nov 2000. */
7 /* Within the preprocessor, the easy pragma to test is "poison". */
9 #pragma GCC poison p1
10 p1 /* { dg-error "poisoned" } */
12 /* Standard use of _Pragma. */
13 _Pragma ("GCC poison p2")
14 p2 /* { dg-error "poisoned" } */
16 /* Don't interpret _Pragmas in directives. The standard is not clear
17 on this, but I think this makes most sense. */
18 #if 1 _Pragma (L"GCC poison p3") /* { dg-error "missing binary operator" } */
20 #endif
22 #define M1 _Pragma ("GCC poison p4")
23 p4 /* No problem; not yet poisoned. */
24 #define M2(x) _Pragma (#x)
26 /* Now test macro expansion with embedded _Pragmas. */
27 M1 p4 /* { dg-error "poisoned" } */
28 M2 (GCC poison p5) p5 /* { dg-error "poisoned" } */
30 /* Not interpreting _Pragma in directives means they don't nest. */
31 _Pragma ("_Pragma (\"GCC poison p6\") GCC poison p7")
35 /* Check we ignore them in false conditionals. */
36 #if 0
37 _Pragma ("GCC poison p8")
38 #endif
39 p8 /* No problem. */