]> gcc.gnu.org Git - gcc.git/commitdiff
[Ada] Keep assertions in internal units enabled for GNATprove
authorPiotr Trojanek <trojanek@adacore.com>
Thu, 4 Jul 2019 08:05:27 +0000 (08:05 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Thu, 4 Jul 2019 08:05:27 +0000 (08:05 +0000)
In GNATprove mode the assertion policy is now always enabled, even when
analysing internal units. Otherwise, assertion expressions (e.g.
Default_Initial_Condition) in internal units (e.g. Ada.Text_IO)
disappear in the semantic analysis phase of the frontend and the
GNATprove backend can't see them.

No frontend test provided, because only the GNATprove backend is
affected (and there appear to be no difference in the output with -gnatG
switch, because the expansion of Default_Initial_Condition is not
attached to the AST).

2019-07-04  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

* opt.adb (Set_Config_Switches): Keep assertions policy as
enabled when analysing internal units in GNATprove mode.

From-SVN: r273048

gcc/ada/ChangeLog
gcc/ada/opt.adb

index 1a86a4d439a67271e7cf6dc8e53fa91b5e316e29..ea1d75df7e01a1e922d4f97708dfbb71fbe2565c 100644 (file)
@@ -1,3 +1,8 @@
+2019-07-04  Piotr Trojanek  <trojanek@adacore.com>
+
+       * opt.adb (Set_Config_Switches): Keep assertions policy as
+       enabled when analysing internal units in GNATprove mode.
+
 2019-07-04  Arnaud Charlet  <charlet@adacore.com>
 
        * exp_ch4.adb (Expand_Short_Circuit_Operator): Strip
index 43d340b5da93ef96014bd2cd4edeb753ecc15c35..05f9059eaa0de64b5e9946ca32af23a752ffe5c1 100644 (file)
@@ -248,7 +248,13 @@ package body Opt is
             SPARK_Mode_Pragma        := SPARK_Mode_Pragma_Config;
 
          else
-            if GNAT_Mode_Config then
+            --  In GNATprove mode assertions should be always enabled, even
+            --  when analysing internal units.
+
+            if GNATprove_Mode then
+               pragma Assert (Assertions_Enabled);
+               null;
+            elsif GNAT_Mode_Config then
                Assertions_Enabled    := Assertions_Enabled_Config;
             else
                Assertions_Enabled    := False;
This page took 0.08257 seconds and 5 git commands to generate.