Skip to content

Commit 6864cab

Browse files
committed
gnatcov_rts.gpr: Add configuration for use with CCG toolchain
The CCG toolchain does not support compiling C code. As such, in order to be able to use GNATcov_RTS with this toolchain, there must be no C sources in the project, and no references to C files. This change introduces a new configuration variable, For_CCG, which when active removes C from the source languages, and removes C source exclusions.
1 parent 14ae4c9 commit 6864cab

File tree

1 file changed

+27
-10
lines changed

1 file changed

+27
-10
lines changed

tools/gnatcov/rts/gnatcov_rts.gpr

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,36 @@ library project GNATcov_RTS is
3535
-- gnatcov_rts_c-base_io.c C unit instead (implemented on top of libc's
3636
-- stdout/fwrite/putchar).
3737

38+
For_CCG : Boolean := external ("GNATCOV_RTS_FOR_CCG", "false");
39+
-- Whether to configure the project for compilation with CCG. This means
40+
-- excluding C from the source languages, as there is no C compiler for that
41+
-- environment and C sources need to be managed manually.
42+
3843
RTS_Profile : RTS_Profile_Type :=
3944
external ("GNATCOV_RTS_RTS_PROFILE", "full");
4045

4146
-------------------------
4247
-- Configuration logic --
4348
-------------------------
4449

45-
Languages := ("C");
50+
Languages := ();
4651
Excluded_Source_Files := ();
4752

4853
-- Compute the set of languages for this project. When Ada is enabled,
4954
-- exclude the C implementation for stdout output primitives.
5055

5156
case With_Ada is
52-
when "false" => null;
57+
when "false" =>
58+
Languages := ("C");
5359
when "true" =>
54-
Languages := Languages & ("Ada");
55-
Excluded_Source_Files :=
56-
Excluded_Source_Files & ("gnatcov_rts_c-base_io.c");
60+
Languages := ("Ada");
61+
case For_CCG is
62+
when "true" => null;
63+
when "false" =>
64+
Excluded_Source_Files :=
65+
Excluded_Source_Files & ("gnatcov_rts_c-base_io.c");
66+
Languages := Languages & ("C");
67+
end case;
5768
end case;
5869

5970
-- If the runtime does not have support to create files, exclude units that
@@ -64,11 +75,17 @@ library project GNATcov_RTS is
6475
Excluded_Source_Files :=
6576
Excluded_Source_Files
6677
& ("gnatcov_rts-traces-output-files.adb",
67-
"gnatcov_rts-traces-output-files.ads",
68-
"gnatcov_rts_c-os_interface.c",
69-
"gnatcov_rts_c-os_interface.h",
70-
"gnatcov_rts_c-traces-output-files.c",
71-
"gnatcov_rts_c-traces-output-files.h");
78+
"gnatcov_rts-traces-output-files.ads");
79+
case For_CCG is
80+
when "true" => null;
81+
when "false" =>
82+
Excluded_Source_Files :=
83+
Excluded_Source_Files
84+
& ("gnatcov_rts_c-os_interface.c",
85+
"gnatcov_rts_c-os_interface.h",
86+
"gnatcov_rts_c-traces-output-files.c",
87+
"gnatcov_rts_c-traces-output-files.h");
88+
end case;
7289
when "full" => null;
7390
end case;
7491

0 commit comments

Comments
 (0)