2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.dg / cpp / direct2.c
blob52d1e31f45f681569364be9570a6e52de0a0cff0
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 expansion.
5 See also direct2s.c */
7 /* { dg-do compile } */
9 #define HASH #
10 #define HASHDEFINE #define
11 #define HASHINCLUDE #include
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 }*/
18 void g ()
20 HASH define X 1 /* { dg-error "syntax error" "# from macro" } */
21 HASHDEFINE Y 1 /* { dg-error "syntax error" "#define from macro" } */
24 #pragma GCC dependency "direct2.c"
27 void f ()
29 int i = X; /* { dg-error "undeclared|for each" "no macro X" } */
30 int j = Y; /* { dg-error "undeclared|for each" "no macro Y" } */
33 #define slashstar /##*
34 #define starslash *##/
36 slashstar starslash /* { dg-error "(parse|syntax) error" "not a comment" } */
37 /* { dg-warning "does not give" "paste warning(s)" { target *-*-* } 36 } */