1 /* Copyright (C) 2001 Free Software Foundation, Inc.
2    Contributed by Nathan Sidwell 8 May 2001 <nathan@codesourcery.com> */
3 
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.  */
7 
8 /* { dg-do compile } */
9 /* { dg-options "-save-temps -ansi -pedantic-errors -ftrack-macro-expansion=0" } */
10 
11 #define HASH #
12 #define HASHDEFINE #define
13 #define HASHINCLUDE #include
14 
15 HASH include "somerandomfile" /*{ dg-error "stray" "non-include" }*/
16 /*{ dg-bogus "No such" "don't execute non-include" { target *-*-* } .-1 }*/
17 int resync_parser_1; /*{ dg-error "parse|syntax|expected" "" { target *-*-* } .-2 }*/
18 
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;
22 
g1()23 void g1 ()
24 {
25 HASH define X 1 /* { dg-error "stray|unknown|expected" "# from macro" } */
26   int resync_parser_3;
27 }
28 
g2()29 void g2 ()
30 {
31 HASHDEFINE  Y 1 /* { dg-error "stray|unknown|expected" "#define from macro" } */
32   int resync_parser_4;
33 }
34 
35 #pragma GCC dependency "direct2.c"
36 #
37 
f()38 void f ()
39 {
40   int i = X;    /* { dg-error "undeclared|for each" "no macro X" } */
41   int j = Y;    /* { dg-error "undeclared|for each" "no macro Y" } */
42 }
43 
44