2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.dg / cpp / direct2s.c
blob4d970a63722b17479d59195eae9d86573dcf232e
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 "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 }*/
20 void g ()
22 HASH define X 1 /* { dg-error "syntax error" "# from macro" } */
23 HASHDEFINE Y 1 /* { dg-error "syntax error" "#define from macro" } */
26 #pragma GCC dependency "direct2s.c"
29 void f ()
31 int i = X; /* { dg-error "undeclared|for each" "no macro X" } */
32 int j = Y; /* { dg-error "undeclared|for each" "no macro Y" } */