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 10p1 /* { dg-error "poisoned" } */ 11 12/* Standard use of _Pragma. */ 13_Pragma ("GCC poison p2") 14p2 /* { 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" } */ 19p3 20#endif 21 22#define M1 _Pragma ("GCC poison p4") 23p4 /* No problem; not yet poisoned. */ 24#define M2(x) _Pragma (#x) 25 26/* Now test macro expansion with embedded _Pragmas. */ 27M1 p4 /* { dg-error "poisoned" } */ 28M2 (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") 32p6 33p7 34 35/* Check we ignore them in false conditionals. */ 36#if 0 37_Pragma ("GCC poison p8") 38#endif 39p8 /* No problem. */ 40