Require target lra in gcc.dg/pr108095.c
[official-gcc.git] / gcc / testsuite / c-c++-common / diagnostic-format-json-4.c
blobcec1cf924b4f77a26202cf9269e9f54560b3e89c
1 /* { dg-do compile } */
2 /* { dg-options "-fdiagnostics-format=json -Wmisleading-indentation" } */
4 int test (void)
6 if (1)
7 return 3;
8 return 4;
9 return 5;
12 /* Use dg-regexp to consume the JSON output starting with
13 the innermost values, and working outwards. */
15 /* Verify nested diagnostics. */
17 /* The nested diagnostic. */
19 /* { dg-regexp "\"kind\": \"note\"" } */
20 /* { dg-regexp "\"message\": \"...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'\"" } */
21 /* { dg-regexp "\"escape-source\": false" } */
23 /* { dg-regexp "\"caret\": \{" } */
24 /* { dg-regexp "\"file\": \"\[^\n\r\"\]*diagnostic-format-json-4.c\"" } */
25 /* { dg-regexp "\"line\": 8" } */
26 /* { dg-regexp "\"column\": 5" } */
27 /* { dg-regexp "\"display-column\": 5" } */
28 /* { dg-regexp "\"byte-column\": 5" } */
30 /* { dg-regexp "\"finish\": \{" } */
31 /* { dg-regexp "\"file\": \"\[^\n\r\"\]*diagnostic-format-json-4.c\"" } */
32 /* { dg-regexp "\"line\": 8" } */
33 /* { dg-regexp "\"column\": 10" } */
34 /* { dg-regexp "\"display-column\": 10" } */
35 /* { dg-regexp "\"byte-column\": 10" } */
37 /* The outer diagnostic. */
39 /* { dg-regexp "\"kind\": \"warning\"" } */
40 /* { dg-regexp "\"column-origin\": 1" } */
41 /* { dg-regexp "\"message\": \"this 'if' clause does not guard...\"" } */
42 /* { dg-regexp "\"escape-source\": false" } */
43 /* { dg-regexp "\"option\": \"-Wmisleading-indentation\"" } */
44 /* { dg-regexp "\"option_url\": \"https:\[^\n\r\"\]*#index-Wmisleading-indentation\"" } */
46 /* { dg-regexp "\"caret\": \{" } */
47 /* { dg-regexp "\"file\": \"\[^\n\r\"\]*diagnostic-format-json-4.c\"" } */
48 /* { dg-regexp "\"line\": 6" } */
49 /* { dg-regexp "\"column\": 3" } */
50 /* { dg-regexp "\"display-column\": 3" } */
51 /* { dg-regexp "\"byte-column\": 3" } */
53 /* { dg-regexp "\"finish\": \{" } */
54 /* { dg-regexp "\"file\": \"\[^\n\r\"\]*diagnostic-format-json-4.c\"" } */
55 /* { dg-regexp "\"line\": 6" } */
56 /* { dg-regexp "\"column\": 4" } */
57 /* { dg-regexp "\"display-column\": 4" } */
58 /* { dg-regexp "\"byte-column\": 4" } */
60 /* More from the nested diagnostic (we can't guarantee what order the
61 "file" keys are consumed). */
63 /* { dg-regexp "\"locations\": \[\[\{\}, \]*\]" } */
65 /* More from the outer diagnostic. */
67 /* { dg-regexp "\"locations\": \[\[\{\}, \]*\]" } */
69 /* { dg-regexp "\"children\": \[\[\{\}, \]*\]" } */
70 /* { dg-regexp "\[\[\{\}, \]*\]" } */