1 /* Test for warnings about nontraditional directives.  */
2 /* { dg-do preprocess } */
3 /* { dg-options "-pedantic -Wtraditional" } */
4 
5 /* Block 1: K+R directives should have the # indented.  */
6 
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" } */
11 
12 /* Block 2: C89 directives should not have the # indented.  */
13 
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"     } */
18 
19 /* Block 3: Extensions should not have the # indented,
20    _and_ they should get a -pedantic warning. */
21 
22 #assert foo(bar)	/* { dg-warning "indented" "^#ext"    } */
23 /* { dg-warning "GCC extension" "extension warning" { target *-*-* } .-1 } */
24 # assert bar(baz)	/* { dg-warning "indented" "^# ext"   } */
25 /* { dg-warning "GCC extension" "extension warning" { target *-*-* } .-1 } */
26  #assert baz(quux)	/* { dg-bogus "indented" "^ #ext"     } */
27 /* { dg-warning "GCC extension" "extension warning" { target *-*-* } .-1 } */
28  # assert quux(weeble)	/* { dg-bogus "indented" "^ # ext"    } */
29 /* { dg-warning "GCC extension" "extension warning" { target *-*-* } .-1 } */
30 
31 /* We warn of #elif regardless of whether we're skipping or not, and
32    do not warn about indentaion.  */
33 #if 0
34 #if 1
35 #elif 1			/* { dg-warning "#elif" "#elif skipping" }  */
36 #endif
37 #elif 0			/* { dg-warning "#elif" "#elif not skipping" }  */
38 #endif
39