2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.dg / cpp / tr-warn1.c
blob259f928825359615c7e5072606f349502b1a4ae7
1 /* Test for warnings about nontraditional directives. */
2 /* { dg-do preprocess } */
3 /* { dg-options "-pedantic -Wtraditional -fno-show-column" } */
5 /* Block 1: K+R directives should have the # indented. */
7 #define foo bar /* { dg-bogus "indented" "^#kandr" } */
8 # define foo bar /* { dg-bogus "indented" "^# kandr" } */
9 #define foo bar /* { dg-warning "indented" "^ #kandr" } */
10 # define foo bar /* { dg-warning "indented" "^ # kandr" } */
12 /* Block 2: C89 directives should not have the # indented. */
14 #pragma whatever /* { dg-warning "indented" "^#c89" } */
15 # pragma whatever /* { dg-warning "indented" "^# c89" } */
16 #pragma whatever /* { dg-bogus "indented" "^ #c89" } */
17 # pragma whatever /* { dg-bogus "indented" "^ # c89" } */
19 /* Block 3: Extensions should not have the # indented,
20 _and_ they should get a -pedantic warning. */
22 #assert foo(bar) /* { dg-warning "indented" "^#ext" } */
23 # assert bar(baz) /* { dg-warning "indented" "^# ext" } */
24 #assert baz(quux) /* { dg-bogus "indented" "^ #ext" } */
25 # assert quux(weeble) /* { dg-bogus "indented" "^ # ext" } */
27 /* We warn of #elif regardless of whether we're skipping or not, and
28 do not warn about indentaion. */
29 #if 0
30 #if 1
31 #elif 1 /* { dg-warning "#elif" "#elif skipping" } */
32 #endif
33 #elif 0 /* { dg-warning "#elif" "#elif not skipping" } */
34 #endif
36 /* { dg-warning "GCC extension" "extension warning" { target *-*-* } 22 } */
37 /* { dg-warning "GCC extension" "extension warning" { target *-*-* } 23 } */
38 /* { dg-warning "GCC extension" "extension warning" { target *-*-* } 24 } */
39 /* { dg-warning "GCC extension" "extension warning" { target *-*-* } 25 } */