Debian Codegraph @

gcc/testsuite/c-c++-common/diagnostic-format-sarif-file-Wbidi-chars.c

raw
1 /* Adapted from Wbidi-chars-1.c */
2
3 /* PR preprocessor/103026 */
4 /* { dg-do compile } */
5 /* { dg-options "-fdiagnostics-format=sarif-file" } */
6
7 int main() {
8 int isAdmin = 0;
9 /*‮ } ⁦if (isAdmin)⁩ ⁦ begin admins only */
10 __builtin_printf("You are an admin.\n");
11 /* end admins only ‮ { ⁦*/
12 return 0;
13 }
14
15 /* Verify that we generate a valid UTF-8 .sarif file.
16
17 { dg-final { verify-sarif-file } }
18
19 Verify that we captured the expected warnings.
20
21 { dg-final { scan-sarif-file {"text": "unpaired UTF-8 bidirectional control characters detected"} } }
22 { dg-final { scan-sarif-file {"text": "unpaired UTF-8 bidirectional control characters detected"} } }
23
24 Verify that the expected property bag property is present.
25 { dg-final { scan-sarif-file {"gcc/escapeNonAscii": true} } }
26
27 Verify that the snippets have a "rendered" property.
28 We check the contents of the property via a selftest.
29
30 { dg-final { scan-sarif-file {"rendered": } } }
31
32 Verify that we have an "annotations" property for the
33 labelled ranges (3.28.6).
34 { dg-final { scan-sarif-file {"annotations": } } }
35 and that the annotations capture the labels as messages,
36 using "." in place of awkard characters:
37 { dg-final { scan-sarif-file {"message": ."text": "end of bidirectional context"} } }
38 { dg-final { scan-sarif-file {"message": ."text": "U.202E .RIGHT-TO-LEFT OVERRIDE."} } }
39 { dg-final { scan-sarif-file {"message": ."text": "U.2066 .LEFT-TO-RIGHT ISOLATE."} } }
40 */