1 /* { dg-options "-fdiagnostics-show-caret -Wc++-compat -std=c11" } */
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 .first use in this function.; did you mean .nanl." } */
13 { dg-begin-multiline-output "" }
17 { dg-end-multiline-output "" }
21 void unknown_type_name (void)
23 foo bar
; /* { dg-error "unknown type name 'foo'" } */
25 { dg-begin-multiline-output "" }
28 { dg-end-multiline-output "" }
31 qux
*baz
; /* { dg-error "unknown type name 'qux'" } */
33 { dg-begin-multiline-output "" }
36 { dg-end-multiline-output "" }
40 void test_identifier_conflicts_with_cplusplus (void)
42 int new; /* { dg-warning "identifier 'new' conflicts with" } */
44 { dg-begin-multiline-output "" }
47 { dg-end-multiline-output "" }
52 bogus_varargs (...); /* { dg-error "ISO C requires a named argument before '...'" } */
54 { dg-begin-multiline-output "" }
57 { dg-end-multiline-output "" }
61 foo (unknown_type param
); /* { dg-error "unknown type name 'unknown_type'" } */
63 { dg-begin-multiline-output "" }
64 foo (unknown_type param);
66 { dg-end-multiline-output "" }
69 void wide_string_literal_in_asm (void)
71 __asm (L
"nop"); /* { dg-error "wide string literal in 'asm'" } */
73 { dg-begin-multiline-output "" }
76 { dg-end-multiline-output "" }
80 void break_and_continue_in_wrong_places (void)
83 break; /* { dg-error "break statement not within loop or switch" } */
84 /* { dg-begin-multiline-output "" }
87 { dg-end-multiline-output "" } */
92 continue; /* { dg-error "continue statement not within a loop" } */
93 /* { dg-begin-multiline-output "" }
96 { dg-end-multiline-output "" } */
99 /* Various examples of bad type decls. */
101 int float bogus
; /* { dg-error "two or more data types in declaration specifiers" } */
102 /* { dg-begin-multiline-output "" }
105 { dg-end-multiline-output "" } */
107 long long long bogus2
; /* { dg-error "'long long long' is too long for GCC" } */
108 /* { dg-begin-multiline-output "" }
109 long long long bogus2;
111 { dg-end-multiline-output "" } */
113 long short bogus3
; /* { dg-error "both 'long' and 'short' in declaration specifiers" } */
114 /* { dg-begin-multiline-output "" }
117 { dg-end-multiline-output "" } */
119 signed unsigned bogus4
; /* { dg-error "both 'signed' and 'unsigned' in declaration specifiers" } */
120 /* { dg-begin-multiline-output "" }
121 signed unsigned bogus4;
123 { dg-end-multiline-output "" } */