]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Improve detection of deactivated code for warnings with -gnatwt
authorYannick Moy <moy@adacore.com>
Fri, 4 Aug 2023 13:01:28 +0000 (15:01 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Thu, 14 Sep 2023 12:42:39 +0000 (14:42 +0200)
commit8517317ce8e9fbea0b4c7a8f87a86d07d95dc8c7
tree6687b66cf676e246ef7a0322ccb883ed45a3b3b4
parentfa16e3229499f4c7c5375bd1bc4b713fb1d2e30e
ada: Improve detection of deactivated code for warnings with -gnatwt

Switch -gnatwt is used in GNAT to track deleted code. It can be emitted
by GNAT on code that is intentionally deactivated for a given configuration.
The current test to suppress spurious warnings is not complex enough to
detect all such cases. Now improved, by using the same test as used in
GNATprove to suppress warnings related to a "statically disabled condition
which evaluates to a given value", as described in SPARK UG 7.3.2.

gcc/ada/

* exp_util.adb (Is_Statically_Disabled): New function to detect a
"statically disabled condition which evaluates to a given value",
as described in SPARK UG 7.3.2.
(Kill_Dead_Code): Call the new function Is_Statically_Disabled for
conditions of if statements.
* exp_util.ads (Is_Statically_Disabled): New function spec.
gcc/ada/exp_util.adb
gcc/ada/exp_util.ads