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 expansion.
5 See also direct2s.c */
6
7 /* { dg-do compile } */
8
9 #define HASH #
10 #define HASHDEFINE #define
11 #define HASHINCLUDE #include
12
13 HASH include "somerandomfile" /*{ dg-error "syntax|parse" "non-include" }*/
14 /*{ dg-bogus "No such" "don't execute non-include" { target *-*-* } 13 }*/
15 HASHINCLUDE <somerandomfile> /*{ dg-error "syntax|parse" "non-include 2" }*/
16 /*{ dg-bogus "No such" "don't execute non-include 2" { target *-*-* } 15 }*/
17
18 void g ()
19 {
20 HASH define X 1 /* { dg-error "syntax error" "# from macro" } */
21 HASHDEFINE Y 1 /* { dg-error "syntax error" "#define from macro" } */
22 }
23
24 #pragma GCC dependency "direct2.c"
25 #
26
f()27 void f ()
28 {
29 int i = X; /* { dg-error "undeclared|for each" "no macro X" } */
30 int j = Y; /* { dg-error "undeclared|for each" "no macro Y" } */
31 }
32
33 #define slashstar /##*
34 #define starslash *##/
35
36 slashstar starslash /* { dg-error "(parse|syntax) error" "not a comment" } */
37 /* { dg-warning "does not give" "paste warning(s)" { target *-*-* } 36 } */
38