diff gcc/ada/gnat1drv.adb @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
line wrap: on
line diff
--- a/gcc/ada/gnat1drv.adb	Fri Oct 27 22:46:09 2017 +0900
+++ b/gcc/ada/gnat1drv.adb	Thu Oct 25 07:37:49 2018 +0900
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2017, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2018, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -50,7 +50,7 @@
 with Output;    use Output;
 with Par_SCO;
 with Prepcomp;
-with Repinfo;   use Repinfo;
+with Repinfo;
 with Restrict;
 with Rident;    use Rident;
 with Rtsfind;
@@ -136,6 +136,13 @@
    --  Start of processing for Adjust_Global_Switches
 
    begin
+      --  Define pragma GNAT_Annotate as an alias of pragma Annotate, to be
+      --  able to work around bootstrap limitations with the old syntax of
+      --  pragma Annotate, and use pragma GNAT_Annotate in compiler sources
+      --  when needed.
+
+      Map_Pragma_Name (From => Name_Gnat_Annotate, To => Name_Annotate);
+
       --  -gnatd.M enables Relaxed_RM_Semantics
 
       if Debug_Flag_Dot_MM then
@@ -154,12 +161,20 @@
          Modify_Tree_For_C := True;
       end if;
 
+      --  -gnatd_A disables generation of ALI files
+
+      if Debug_Flag_Underscore_AA then
+         Disable_ALI_File := True;
+      end if;
+
       --  Set all flags required when generating C code
 
       if Generate_C_Code then
          Modify_Tree_For_C := True;
          Unnest_Subprogram_Mode := True;
+         Building_Static_Dispatch_Tables := False;
          Minimize_Expression_With_Actions := True;
+         Expand_Nonbinary_Modular_Ops := True;
 
          --  Set operating mode to Generate_Code to benefit from full front-end
          --  expansion (e.g. generics).
@@ -238,14 +253,19 @@
          GNATprove_Mode := False;
          Debug_Flag_Dot_FF := False;
 
+         --  Turn off length expansion. CodePeer has its own mechanism to
+         --  handle length attribute.
+
+         Debug_Flag_Dot_PP := True;
+
          --  Turn off C tree generation, not compatible with CodePeer mode. We
          --  do not expect this to happen in normal use, since both modes are
          --  enabled by special tools, but it is useful to turn off these flags
          --  this way when we are doing CodePeer tests on existing test suites
          --  that may have -gnateg set, to avoid the need for special casing.
 
-         Modify_Tree_For_C := False;
-         Generate_C_Code := False;
+         Modify_Tree_For_C      := False;
+         Generate_C_Code        := False;
          Unnest_Subprogram_Mode := False;
 
          --  Turn off inlining, confuses CodePeer output and gains nothing
@@ -383,6 +403,15 @@
 
          Relaxed_RM_Semantics := True;
 
+         if not Generate_CodePeer_Messages then
+
+            --  Suppress compiler warnings by default when generating SCIL for
+            --  CodePeer, except when combined with -gnateC where we do want to
+            --  emit GNAT warnings.
+
+            Warning_Mode := Suppress;
+         end if;
+
          --  Disable all simple value propagation. This is an optimization
          --  which is valuable for code optimization, and also for generation
          --  of compiler warnings, but these are being turned off by default,
@@ -444,6 +473,12 @@
 
          Ineffective_Inline_Warnings := True;
 
+         --  Do not issue warnings for possible propagation of exception.
+         --  GNATprove already issues messages about possible exceptions.
+
+         No_Warn_On_Non_Local_Exception := True;
+         Warn_On_Non_Local_Exception := False;
+
          --  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.
@@ -581,7 +616,7 @@
       --  problems with subtypes of type Ada.Tags.Dispatch_Table_Wrapper. ???
 
       if Debug_Flag_Dot_T then
-         Static_Dispatch_Tables := False;
+         Building_Static_Dispatch_Tables := False;
       end if;
 
       --  Flip endian mode if -gnatd8 set
@@ -1180,6 +1215,7 @@
       if Compilation_Errors then
          Treepr.Tree_Dump;
          Post_Compilation_Validation_Checks;
+         Errout.Finalize (Last_Call => True);
          Errout.Output_Messages;
          Namet.Finalize;
 
@@ -1190,7 +1226,6 @@
             Tree_Gen;
          end if;
 
-         Errout.Finalize (Last_Call => True);
          Exit_Program (E_Errors);
       end if;
 
@@ -1419,7 +1454,9 @@
          Exit_Program (Ecode);
       end if;
 
-      --  In -gnatc mode, we only do annotation if -gnatt or -gnatR is also set
+      --  In -gnatc mode we only do annotation if -gnatt or -gnatR is also set,
+      --  or if -gnatwz is enabled (default setting) and there is an unchecked
+      --  conversion that involves a type whose size is not statically known,
       --  as indicated by Back_Annotate_Rep_Info being set to True.
 
       --  We don't call for annotations on a subunit, because to process those
@@ -1432,6 +1469,9 @@
       --  representation information will be provided by the GNSA back end, not
       --  gigi.
 
+      --  A special back end is always called in CodePeer and GNATprove modes,
+      --  unless this is a subunit.
+
       if Back_End_Mode = Declarations_Only
         and then
           (not (Back_Annotate_Rep_Info or Generate_SCIL or GNATprove_Mode)
@@ -1445,7 +1485,11 @@
          Tree_Dump;
          Tree_Gen;
          Namet.Finalize;
-         Check_Rep_Info;
+
+         if not (Generate_SCIL or GNATprove_Mode) then
+            Check_Rep_Info;
+         end if;
+
          return;
       end if;
 
@@ -1528,7 +1572,7 @@
 
       Errout.Finalize (Last_Call => True);
       Errout.Output_Messages;
-      List_Rep_Info (Ttypes.Bytes_Big_Endian);
+      Repinfo.List_Rep_Info (Ttypes.Bytes_Big_Endian);
       Inline.List_Inlining_Info;
 
       --  Only write the library if the backend did not generate any error