Merge from mainline (gomp-merge-2005-02-26).
[official-gcc.git] / gcc / testsuite / gcc.dg / cpp / direct2s.c
blobb2d00cf68894fc1dd9878408b2c743ffa1e17510
1 /* Copyright (C) 2001 Free Software Foundation, Inc.
2 Contributed by Nathan Sidwell 8 May 2001 <nathan@codesourcery.com> */
4 /* Test of prohibition on directives which result from macro
5 expansion. Same as direct2.c, with -save-temps applied; results
6 should be identical. */
8 /* { dg-do compile } */
9 /* { dg-options "-save-temps -ansi -pedantic-errors" } */
11 #define HASH #
12 #define HASHDEFINE #define
13 #define HASHINCLUDE #include
15 HASH include "somerandomfile" /*{ dg-error "stray" "non-include" }*/
16 /*{ dg-bogus "No such" "don't execute non-include" { target *-*-* } 15 }*/
17 int resync_parser_1; /*{ dg-error "parse|syntax|expected" "" }*/
19 HASHINCLUDE <somerandomfile> /*{ dg-error "stray|expected" "non-include 2" }*/
20 /*{ dg-bogus "No such" "don't execute non-include 2" { target *-*-* } 18 }*/
21 int resync_parser_2;
23 void g1 ()
25 HASH define X 1 /* { dg-error "stray|undeclared|parse|syntax|expected|for each" "# from macro" } */
26 int resync_parser_3;
29 void g2 ()
31 HASHDEFINE Y 1 /* { dg-error "stray|undeclared|parse|syntax|expected|for each" "#define from macro" } */
32 int resync_parser_4;
35 #pragma GCC dependency "direct2.c"
38 void f ()
40 int i = X; /* { dg-error "undeclared|for each" "no macro X" } */
41 int j = Y; /* { dg-error "undeclared|for each" "no macro Y" } */