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" } */
10 
11 #define HASH #
12 #define HASHDEFINE #define
13 #define HASHINCLUDE #include
14 
15 HASH include "somerandomfile" /*{ dg-error "syntax|parse" "non-include" }*/
16 /*{ dg-bogus "No such" "don't execute non-include" { target *-*-* } 15 }*/
17 HASHINCLUDE <somerandomfile> /*{ dg-error "syntax|parse" "non-include 2" }*/
18 /*{ dg-bogus "No such" "don't execute non-include 2" { target *-*-* } 17 }*/
19 
20 void g ()
21 {
22 HASH define X 1 /* { dg-error "syntax error" "# from macro" } */
23 HASHDEFINE  Y 1 /* { dg-error "syntax error" "#define from macro" } */
24 }
25 
26 #pragma GCC dependency "direct2s.c"
27 #
28 
f()29 void f ()
30 {
31   int i = X;    /* { dg-error "undeclared|for each" "no macro X" } */
32   int j = Y;    /* { dg-error "undeclared|for each" "no macro Y" } */
33 }
34