]> gcc.gnu.org Git - gcc.git/commitdiff
ada: Only reject volatile ghost objects when SPARK_Mode is On
authorPiotr Trojanek <trojanek@adacore.com>
Thu, 8 Sep 2022 12:58:24 +0000 (14:58 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 26 Sep 2022 09:02:30 +0000 (11:02 +0200)
SPARK rule that forbids ghost volatile objects is only affecting proof
and not generation of object code. It is now only applied where SPARK_Mode
is On. This flexibility is needed to compile code automatically instrumented
by GNATcoverage.

gcc/ada/

* contracts.adb (Analyze_Object_Contract): Check SPARK_Mode before
applying SPARK rule.

gcc/ada/contracts.adb

index 34db67a8cabf2d4ac72c4d044c3fbf52a9dd9b14..dd573d374c690f1e7157dcee02529ea9a33309a7 100644 (file)
@@ -1207,7 +1207,7 @@ package body Contracts is
          --  A Ghost object cannot be effectively volatile (SPARK RM 6.9(7) and
          --  SPARK RM 6.9(19)).
 
-         elsif Is_Effectively_Volatile (Obj_Id) then
+         elsif SPARK_Mode = On and then Is_Effectively_Volatile (Obj_Id) then
             Error_Msg_N ("ghost object & cannot be volatile", Obj_Id);
 
          --  A Ghost object cannot be imported or exported (SPARK RM 6.9(7)).
This page took 0.0668 seconds and 5 git commands to generate.