1 /* { dg-options "-fdiagnostics-show-caret -Wno-switch-unreachable" } */
5 void missing_open_paren (void)
7 if foo ()) /* { dg-line missing_open_paren } */
10 /* { dg-error "expected '\\(' before 'foo'" "" { target c } missing_open_paren } */
11 /* { dg-begin-multiline-output "" }
15 { dg-end-multiline-output "" } */
16 /* { dg-error "expected statement before '\\)' token" "" { target c } missing_open_paren } */
17 /* { dg-begin-multiline-output "" }
20 { dg-end-multiline-output "" } */
23 void missing_close_square (void)
25 const char test
[42; /* { dg-error "22: expected ']' before ';' token" } */
26 /* { dg-begin-multiline-output "" }
30 { dg-end-multiline-output "" } */
33 int missing_semicolon (void)
35 return 42 /* { dg-error "expected ';'" } */
37 /* { dg-begin-multiline-output "" }
43 { dg-end-multiline-output "" } */
46 /* We don't offer a fix-it hint for this case in C, as it could be
48 TODO: we could be smarter about error-recovery here; given the
49 return perhaps we could assume a missing colon. */
51 int missing_colon_in_switch (int val
)
56 return 42; /* { dg-error "expected ':' or '...' before 'return'" } */
57 /* { dg-begin-multiline-output "" }
60 { dg-end-multiline-output "" } */
67 /* { dg-begin-multiline-output "" }
70 { dg-end-multiline-output "" } */
71 int dummy
;/* { dg-error "expected declaration or statement at end of input" "" { target c } } */