Skip to content

Set Externally_Built to prevent GNATprove from trying to analyse the runtime#26

Merged
damaki merged 1 commit into
mainfrom
topic/prevent-gnatprove-analysis
May 7, 2026
Merged

Set Externally_Built to prevent GNATprove from trying to analyse the runtime#26
damaki merged 1 commit into
mainfrom
topic/prevent-gnatprove-analysis

Conversation

@damaki

@damaki damaki commented May 7, 2026

Copy link
Copy Markdown
Owner

This uses the GPR_TOOL external variable to detect when GNATprove is running on the runtime_build.gpr and ravenscar_build.gpr files, in which case Externally_Built is set to True to prevent GNATprove from analysing the runtime sources.

This is necessary since some versions of GNATprove have problems processing certain runtime units. For example, GNAT FSF 15 errors out on a-synbar.adb due to the use of the 'Count attribute on an entry, which this version of GNATprove erroneously thinks is not permitted when pure-barriers is in effect. These problems are avoided by preventing GNATprove from trying to analyse the runtime as a whole.

The reason why GNATprove tries to process the runtime sources is because the expected usage of these runtime crates is to "with" runtime_build.gpr and/or ravenscar_build.gpr in the user's GPR project, so the runtime project files are automatically included as subprojects in the user's project. By default, GNATprove tries to prove all subprojects, which would include the runtime in this case.

Other GNAT runtimes do not have this problem because they are not "with"ed as a subproject, and are instead selected using the --RTS switch or for Runtime ("Ada") use "<path>";, so GNATprove does not see them as a subproject. This would not work for community-bb-runtimes crates, however, because this ensures the runtime is built properly as part of the project build, and because some attributes of the runtime project files need to be referenced in the user's project file (such as Target, Runtime, and sometimes also Linker_Options).

…runtime

This uses the GPR_TOOL external variable to detect when GNATprove is
running on the runtime_build.gpr and ravenscar_build.gpr files, in which
case Externally_Built is set to True to prevent GNATprove from analysing
the runtime sources.

This is necessary since some versions of GNATprove have problems processing
certain runtime units. For example, GNAT FSF 15 errors out on a-synbar.adb
due to the use of the 'Count attribute on an entry, which this version of
GNATprove erroneously thinks is not permitted when pure-barriers is in
effect. These problems are avoided by preventing GNATprove from trying to
analyse the runtime as a whole.

The reason why GNATprove tries to process the runtime sources is because
the expected usage of these runtime crates is to "with" runtime_build.gpr
and/or ravenscar_build.gpr in the user's GPR project, so the runtime
project files are automatically included as subprojects in the user's
project. By default, GNATprove tries to prove all subprojects, which would
include the runtime in this case.

Other GNAT runtimes do not have this problem because they are not "with"ed
as a subproject, and are instead selected using the --RTS switch or
`for Runtime ("Ada") use "<path>";`, so GNATprove does not see them as a
subproject. This would not work for community-bb-runtimes crates, however,
because this ensures the runtime is built properly as part of the project
build, and because some attributes of the runtime project files need to be
referenced in the user's project file (such as Target, Runtime, and sometimes
also Linker_Options).
@damaki damaki self-assigned this May 7, 2026
@damaki damaki added the enhancement New feature or request label May 7, 2026
@damaki damaki merged commit 1087aae into main May 7, 2026
2 checks passed
@damaki damaki deleted the topic/prevent-gnatprove-analysis branch May 7, 2026 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant