1 /* { dg-options "-fdiagnostics-show-caret -Wc++-compat -std=c11 -pedantic" } */
3 /* Verify that various diagnostics show source code ranges. */
5 long double nanl (const char *);
7 /* These ones merely use token ranges; they don't use tree ranges. */
9 void undeclared_identifier (void)
11 name
; /* { dg-error "'name' undeclared" } */
13 { dg-begin-multiline-output "" }
16 { dg-end-multiline-output "" }
20 void unknown_type_name (void)
22 foo bar
; /* { dg-error "unknown type name 'foo'" } */
24 { dg-begin-multiline-output "" }
27 { dg-end-multiline-output "" }
30 qux
*baz
; /* { dg-error "unknown type name 'qux'" } */
32 { dg-begin-multiline-output "" }
35 { dg-end-multiline-output "" }
39 void test_identifier_conflicts_with_cplusplus (void)
41 int new; /* { dg-warning "identifier 'new' conflicts with" } */
43 { dg-begin-multiline-output "" }
46 { dg-end-multiline-output "" }
51 bogus_varargs (...); /* { dg-warning "ISO C requires a named argument before '...'" } */
53 { dg-begin-multiline-output "" }
56 { dg-end-multiline-output "" }
60 foo (unknown_type param
); /* { dg-error "unknown type name 'unknown_type'" } */
62 { dg-begin-multiline-output "" }
63 foo (unknown_type param);
65 { dg-end-multiline-output "" }
68 void wide_string_literal_in_asm (void)
70 __asm (L
"nop"); /* { dg-error "a wide string is invalid in this context" } */
72 { dg-begin-multiline-output "" }
75 { dg-end-multiline-output "" }
79 void break_and_continue_in_wrong_places (void)
82 break; /* { dg-error "break statement not within loop or switch" } */
83 /* { dg-begin-multiline-output "" }
86 { dg-end-multiline-output "" } */
91 continue; /* { dg-error "continue statement not within a loop" } */
92 /* { dg-begin-multiline-output "" }
95 { dg-end-multiline-output "" } */
98 /* Various examples of bad type decls. */
100 int float bogus
; /* { dg-error "two or more data types in declaration specifiers" } */
101 /* { dg-begin-multiline-output "" }
104 { dg-end-multiline-output "" } */
106 long long long bogus2
; /* { dg-error "'long long long' is too long for GCC" } */
107 /* { dg-begin-multiline-output "" }
108 long long long bogus2;
110 { dg-end-multiline-output "" } */
112 long short bogus3
; /* { dg-error "both 'long' and 'short' in declaration specifiers" } */
113 /* { dg-begin-multiline-output "" }
116 { dg-end-multiline-output "" } */
118 signed unsigned bogus4
; /* { dg-error "both 'signed' and 'unsigned' in declaration specifiers" } */
119 /* { dg-begin-multiline-output "" }
120 signed unsigned bogus4;
122 { dg-end-multiline-output "" } */