| 1 |
/* { dg-options "-fdiagnostics-show-caret" } */ |
| 2 |
|
| 3 |
extern int foo (void); |
| 4 |
|
| 5 |
void missing_open_paren (void) |
| 6 |
{ |
| 7 |
if foo ()) /* { dg-error "expected '\\(' before 'foo'" } */ |
| 8 |
{ |
| 9 |
} |
| 10 |
/* { dg-begin-multiline-output "" } |
| 11 |
if foo ()) |
| 12 |
^~~ |
| 13 |
( |
| 14 |
{ dg-end-multiline-output "" } */ |
| 15 |
} |
| 16 |
|
| 17 |
|
| 18 |
void missing_close_square (void) |
| 19 |
{ |
| 20 |
const char test [42; /* { dg-error "22: expected ']' before ';' token" } */ |
| 21 |
/* { dg-begin-multiline-output "" } |
| 22 |
const char test [42; |
| 23 |
^ |
| 24 |
] |
| 25 |
{ dg-end-multiline-output "" } */ |
| 26 |
} |
| 27 |
|
| 28 |
int missing_semicolon (void) |
| 29 |
{ |
| 30 |
return 42 /* { dg-error "expected ';'" } */ |
| 31 |
} |
| 32 |
/* { dg-begin-multiline-output "" } |
| 33 |
return 42 |
| 34 |
^ |
| 35 |
; |
| 36 |
} |
| 37 |
~ |
| 38 |
{ dg-end-multiline-output "" } */ |
| 39 |
|
| 40 |
|
| 41 |
int missing_colon_in_switch (int val) |
| 42 |
{ |
| 43 |
switch (val) |
| 44 |
{ |
| 45 |
case 42 /* { dg-error "expected ':' before 'return'" } */ |
| 46 |
return 42; |
| 47 |
/* { dg-begin-multiline-output "" } |
| 48 |
case 42 |
| 49 |
^ |
| 50 |
: |
| 51 |
return 42; |
| 52 |
~~~~~~ |
| 53 |
{ dg-end-multiline-output "" } */ |
| 54 |
|
| 55 |
default: |
| 56 |
return val; |
| 57 |
} |
| 58 |
} |