OSDN Git Service

* c-common.c (c_common_init): Set up CPP arithmetic.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / cpp / _Pragma1.c
1 /* Copyright (C) 2000 Free Software Foundation, Inc.  */
2
3 /* { dg-do preprocess } */
4
5 /* Tests the _Pragma operator.  Contributed by Neil Booth 1 Nov 2000.  */
6
7 /* Within the preprocessor, the easy pragma to test is "poison".  */
8
9 #pragma GCC poison p1
10 p1                              /* { dg-error "poisoned" } */
11
12 /* Standard use of _Pragma.  */
13 _Pragma ("GCC poison p2")
14 p2                              /* { dg-error "poisoned" } */
15
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" } */
19 p3
20 #endif
21
22 #define M1 _Pragma ("GCC poison p4")
23 p4                              /* No problem; not yet poisoned.  */
24 #define M2(x) _Pragma (#x)
25
26 /* Now test macro expansion with embedded _Pragmas.  */
27 M1 p4                           /* { dg-error "poisoned" } */
28 M2 (GCC poison p5) p5           /* { dg-error "poisoned" } */
29
30 /* Not interpreting _Pragma in directives means they don't nest.  */
31 _Pragma ("_Pragma (\"GCC poison p6\") GCC poison p7")
32 p6
33 p7
34
35 /* Check we ignore them in false conditionals.  */
36 #if 0
37 _Pragma ("GCC poison p8")
38 #endif
39 p8                              /* No problem.  */