1 /* { dg-do compile } */
2 /* { dg-options "-fdiagnostics-format=sarif-file" } */
4 /* Verify that SARIF output can capture chains of include files in
7 Generate two warning/note pairs, using a chain of header files.
8 In textual form, we'd expect something like:
10 In file included from PATH/include-chain-1.h:5,
11 from PATH/include-chain-1.c:9:
12 PATH/include-chain-1-2.h:1:6: error: conflicting types for 'p'; have 'char'
15 In file included from PATH/include-chain-1.h:2:
16 PATH/include-chain-1-1.h:1:5: note: previous declaration of 'p' with type 'int'
19 PATH/include-chain-1-2.h:2:6: error: conflicting types for 'q'; have 'char'
22 PATH/include-chain-1-1.h:2:5: note: previous declaration of 'q' with type 'int'
26 We should have two result objects (for each of 'p' and 'q'), each with
27 a related location for its note, and additional related locations describing
28 the include chains. */
30 #include "include-chain-1.h"
32 /* We expect a failing compile due to the errors, but the use of
33 -fdiagnostics-format=sarif-file means there should be no output to stderr.
34 DejaGnu injects this message; ignore it:
35 { dg-prune-output "exit status is 1" } */
37 /* Verify that some JSON was written to a file with the expected name:
38 { dg-final { verify-sarif-file } } */
40 /* Use a Python script to verify various properties about the generated
42 { dg-final { run-sarif-pytest include-chain-1.c "test-include-chain-1.py" } } */