]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Thu, 11 Apr 2013 10:18:47 +0000 (12:18 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Thu, 11 Apr 2013 10:18:47 +0000 (12:18 +0200)
2013-04-11  Johannes Kanig  <kanig@adacore.com>

* opt.ads New global boolean Frame_Condition_Mode to avoid
referring to command line switch.
* gnat1drv.adb (Gnat1drv) set frame condition mode when -gnatd.G
is present, and disable Code generation in that case. Disable
ALI file generation when switch is *not* present.

2013-04-11  Ed Schonberg  <schonberg@adacore.com>

* sem_ch6.adb (Analyze_Expression_Function): Perform the
pre-analysis on a copy of the expression, to prevent downstream
visbility issues involving operators and instantiations.

From-SVN: r197758

gcc/ada/ChangeLog
gcc/ada/gnat1drv.adb
gcc/ada/opt.ads
gcc/ada/sem_ch6.adb

index dc0dd405be590db0e34276e5fba07fa5ce9f5e44..098860356950fda1f0423a46c424ebbd34196695 100644 (file)
@@ -1,3 +1,17 @@
+2013-04-11  Johannes Kanig  <kanig@adacore.com>
+
+       * opt.ads New global boolean Frame_Condition_Mode to avoid
+       referring to command line switch.
+       * gnat1drv.adb (Gnat1drv) set frame condition mode when -gnatd.G
+       is present, and disable Code generation in that case. Disable
+       ALI file generation when switch is *not* present.
+
+2013-04-11  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch6.adb (Analyze_Expression_Function): Perform the
+       pre-analysis on a copy of the expression, to prevent downstream
+       visbility issues involving operators and instantiations.
+
 2013-04-11  Johannes Kanig  <kanig@adacore.com>
 
        * debug.adb: Reservation and documentation for -gnatd.G switch.
index 47c27da01141360f4c1e265bff1f0c77890a4b19..37a4fb2fcae973f03b05867ec3b8c3cb6f404b5a 100644 (file)
@@ -302,6 +302,18 @@ procedure Gnat1drv is
             Strict_Alfa_Mode := True;
          end if;
 
+         --  Distinguish between the two modes of gnat2why: frame condition
+         --  generation (generation of ALI files) and translation of Why (no
+         --  ALI files generated). This is done with the switch -gnatd.G,
+         --  which activates frame condition mode. The other changes in
+         --  behavior depending on this switch are done in gnat2why directly.
+
+         if Debug_Flag_Dot_GG then
+            Frame_Condition_Mode := True;
+         else
+            Opt.Disable_ALI_File := True;
+         end if;
+
          --  Turn off inlining, which would confuse formal verification output
          --  and gain nothing.
 
@@ -409,16 +421,6 @@ procedure Gnat1drv is
 
          Tagged_Type_Expansion := False;
 
-         --  Distinguish between the two modes of gnat2why: frame condition
-         --  generation (generation of ALI files) and translation of Why (no
-         --  ALI files generated). This is done with the switch -gnatd.G,
-         --  which activates frame condition mode. The other changes in
-         --  behavior depending on this switch are done in gnat2why directly.
-
-         if not Debug_Flag_Dot_GG then
-            Opt.Disable_ALI_File := True;
-         end if;
-
       end if;
 
       --  Set Configurable_Run_Time mode if system.ads flag set
@@ -1041,10 +1043,11 @@ begin
       elsif Main_Kind in N_Generic_Renaming_Declaration then
          Back_End_Mode := Generate_Object;
 
-      --  It is not an error to analyze (in CodePeer or Alfa modes) a spec
-      --  which requires a body, when the body is not available.
+      --  It is not an error to analyze (in CodePeer mode or Alfa mode with
+      --  generation of Why) a spec which requires a body, when the body is
+      --  not available.
 
-      elsif CodePeer_Mode or Alfa_Mode then
+      elsif CodePeer_Mode or (Alfa_Mode and not Frame_Condition_Mode) then
          Back_End_Mode := Generate_Object;
 
       --  In all other cases (specs which have bodies, generics, and bodies
index ee1c73f87e1fce60102e13ba892a1063c98d723c..5e80dc76fe1cdea2382f26daec450469e01ed36b 100644 (file)
@@ -1984,6 +1984,12 @@ package Opt is
    --  generation of Why code for those parts of the input code that belong to
    --  the Alfa subset of Ada. Set by debug flag -gnatd.F.
 
+   Frame_Condition_Mode : Boolean := False;
+   --  Specific mode to be used in combination with Alfa_Mode. If set to
+   --  true, ALI files containing the frame conditions (global effects) are
+   --  generated, and Why files are *not* generated. If not true, Why files
+   --  are generated. Set by debug flag -gnatd.G.
+
    Strict_Alfa_Mode : Boolean := False;
    --  Interpret compiler permissions as strictly as possible. E.g. base ranges
    --  for integers are limited to the strict minimum with this option. Set by
index 7b31ff572e6ae8857723a8170bc028347a9b4437..707ed45f56c7a0f16081d7ed114c4e9d81108774 100644 (file)
@@ -444,7 +444,12 @@ package body Sem_Ch6 is
             Insert_After (Last (Decls), New_Body);
             Push_Scope (Id);
             Install_Formals (Id);
-            Preanalyze_Spec_Expression (Expression  (Ret), Etype (Id));
+
+            --  Do a preanalysis of the expression on a separate copy, to
+            --  prevent visibility issues later with operators in instances.
+
+            Preanalyze_Spec_Expression
+              (New_Copy_Tree (Expression  (Ret)), Etype (Id));
             End_Scope;
          end;
       end if;