OSDN Git Service

* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Procedure>: Set default
[pf3gnuchains/gcc-fork.git] / gcc / ada / gnat1drv.adb
index 6b4ef9a..7982486 100644 (file)
@@ -50,6 +50,7 @@ with Prepcomp;
 with Repinfo;  use Repinfo;
 with Restrict;
 with Rtsfind;
+with SCOs;
 with Sem;
 with Sem_Ch8;
 with Sem_Ch12;
@@ -111,9 +112,12 @@ procedure Gnat1drv is
 
    procedure Adjust_Global_Switches is
    begin
-      --  Debug flag -gnatd.I is a synonym of Generate_SCIL
+      --  Debug flag -gnatd.I is a synonym for Generate_SCIL and requires code
+      --  generation.
 
-      if Debug_Flag_Dot_II then
+      if Debug_Flag_Dot_II
+        and then Operating_Mode = Generate_Code
+      then
          Generate_SCIL := True;
       end if;
 
@@ -154,23 +158,41 @@ procedure Gnat1drv is
          Front_End_Inlining := False;
          Inline_Active      := False;
 
-         --  Turn off ASIS mode: incompatible with front-end expansion.
+         --  Turn off ASIS mode: incompatible with front-end expansion
 
          ASIS_Mode := False;
 
-         --  Suppress overflow checks and access checks since they are handled
-         --  implicitly by CodePeer.
+         --  Disable front-end optimizations, to keep the tree as close to the
+         --  source code as possible, and also to avoid inconsistencies between
+         --  trees when using different optimization switches.
+
+         Optimization_Level := 0;
+
+         --  Disable specific expansions for Restrictions pragmas to avoid
+         --  tree inconsistencies between compilations with different pragmas
+         --  that will cause different SCIL files to be generated for the
+         --  same Ada spec.
+
+         Treat_Restrictions_As_Warnings := True;
+
+         --  Suppress overflow, division by zero and access checks since they
+         --  are handled implicitly by CodePeer.
 
          --  Turn off dynamic elaboration checks: generates inconsistencies in
          --  trees between specs compiled as part of a main unit or as part of
          --  a with-clause.
 
+         --  Turn off alignment checks: these cannot be proved statically by
+         --  CodePeer and generate false positives.
+
          --  Enable all other language checks
 
          Suppress_Options :=
-           (Overflow_Check    => True,
-            Access_Check      => True,
+           (Access_Check      => True,
+            Alignment_Check   => True,
+            Division_Check    => True,
             Elaboration_Check => True,
+            Overflow_Check    => True,
             others            => False);
          Enable_Overflow_Checks := False;
          Dynamic_Elaboration_Checks := False;
@@ -454,25 +476,6 @@ procedure Gnat1drv is
       end if;
    end Check_Bad_Body;
 
-   --------------------
-   -- Check_Rep_Info --
-   --------------------
-
-   procedure Check_Rep_Info is
-   begin
-      if List_Representation_Info /= 0
-        or else List_Representation_Info_Mechanisms
-      then
-         Set_Standard_Error;
-         Write_Eol;
-         Write_Str
-           ("cannot generate representation information, no code generated");
-         Write_Eol;
-         Write_Eol;
-         Set_Standard_Output;
-      end if;
-   end Check_Rep_Info;
-
    -------------------------
    -- Check_Library_Items --
    -------------------------
@@ -502,6 +505,25 @@ procedure Gnat1drv is
       Walk;
    end Check_Library_Items;
 
+   --------------------
+   -- Check_Rep_Info --
+   --------------------
+
+   procedure Check_Rep_Info is
+   begin
+      if List_Representation_Info /= 0
+        or else List_Representation_Info_Mechanisms
+      then
+         Set_Standard_Error;
+         Write_Eol;
+         Write_Str
+           ("cannot generate representation information, no code generated");
+         Write_Eol;
+         Write_Eol;
+         Set_Standard_Output;
+      end if;
+   end Check_Rep_Info;
+
 --  Start of processing for Gnat1drv
 
 begin
@@ -532,6 +554,7 @@ begin
       Urealp.Initialize;
       Errout.Initialize;
       Namet.Initialize;
+      SCOs.Initialize;
       Snames.Initialize;
       Stringt.Initialize;
       Inline.Initialize;