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 # assert bar(baz)	/* { dg-warning "indented" "^# ext"   } */
24  #assert baz(quux)	/* { dg-bogus "indented" "^ #ext"     } */
25  # assert quux(weeble)	/* { dg-bogus "indented" "^ # ext"    } */
26 
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
35 
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 } */
40