]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Disable ghost context checks before context is set
authorViljar Indus <indus@adacore.com>
Wed, 27 Aug 2025 07:54:05 +0000 (10:54 +0300)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Mon, 15 Sep 2025 12:59:25 +0000 (14:59 +0200)
commit33876c5ea8b671f1d79177a4d577897f4a546e69
treec9a86361f537016389dcc67e0bf0eda1aab71ea1
parent78551d9e13a20a281546cdb5f6feaa336d5951bd
ada: Disable ghost context checks before context is set

There are cases where we need to analyze the argument of the pragma
in order to determine the ghostliness of the pragma. However during
that analysis the ghost region of the pragma is not set yet so we
cannot perform the ghost context checks at that moment.

This patch provides the mechanism for disabling ghost context checks
and disables them for pragma arguments that determine the ghostliness
of the pragma.

gcc/ada/ChangeLog:

* ghost.adb (Check_Ghost_Context): Avoid context checks when they
are globally disabled.
* sem.ads (Ghost_Context_Checks_Disabled): New flag to control
whether ghost context checks are activated or not.
* sem_prag.adb (Analyze_Pragma): Disable ghost context checks for
pragmas that determine their ghostliness based on one of its arguments.
gcc/ada/ghost.adb
gcc/ada/sem.ads
gcc/ada/sem_prag.adb