Debian Codegraph @

gcc/testsuite/c-c++-common/missing-close-func-paren.c

raw
1 /* { dg-options "-fdiagnostics-show-caret" } */
2
3 /* Verify that the C/C++ frontends show the pertinent opening symbol when
4 a closing symbol is missing for a function call. */
5
6 /* Verify that, when they are on the same line, that the opening symbol is
7 shown as a secondary range within the main diagnostic. */
8
9 extern int __attribute__((const)) foo (int a, int b, int c);
10
11 void single_func ()
12 {
13 int single =
14 foo (1, (1 + 2), (1 + 2 + 3):); /* { dg-error "expected '\\)' before ':' token" } */
15 /* { dg-begin-multiline-output "" }
16 foo (1, (1 + 2), (1 + 2 + 3):);
17 ~ ^
18 )
19 { dg-end-multiline-output "" } */
20 }
21
22 /* Verify that, when they are on different lines, that the opening symbol is
23 shown via a secondary diagnostic. */
24
25 void multi_func ()
26 {
27 int multi =
28 foo (1, /* { dg-message "to match this '\\('" } */
29 (1 + 2),
30 (1 + 2 + 3):); /* { dg-error "expected '\\)' before ':' token" } */
31 /* { dg-begin-multiline-output "" }
32 (1 + 2 + 3):);
33 ^
34 )
35 { dg-end-multiline-output "" } */
36 /* { dg-begin-multiline-output "" }
37 foo (1,
38 ^
39 { dg-end-multiline-output "" } */
40 }