]> gcc.gnu.org Git - gcc.git/blob - gcc/testsuite/gcc.dg/cpp-tradwarn1.c
cppinit.c (cpp_start_read): Turn off -Wtraditional if processing C++.
[gcc.git] / gcc / testsuite / gcc.dg / cpp-tradwarn1.c
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 /* { dg-warning "ISO C does not" "extension warning" { target native } 22 } */
28 /* { dg-warning "ISO C does not" "extension warning" { target native } 23 } */
29 /* { dg-warning "ISO C does not" "extension warning" { target native } 24 } */
30 /* { dg-warning "ISO C does not" "extension warning" { target native } 25 } */
This page took 0.037209 seconds and 5 git commands to generate.