]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2014-07-18 Robert Dewar <dewar@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 18 Jul 2014 09:34:17 +0000 (09:34 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 18 Jul 2014 09:34:17 +0000 (09:34 +0000)
* sem_attr.adb, s-os_lib.ads, prj-tree.adb: Minor reformatting.
* types.h: Fix typo.

2014-07-18  Robert Dewar  <dewar@adacore.com>

* freeze.adb (Check_Address_Clause): Use Kill_Rep_Clause (no
functional change).
* gnat_ugn.texi: Document that -gnatI removes rep clauses from
ASIS trees.
* sem_ch13.adb (Kill_Rep_Clause): New procedure
(Analyze_Attribute_Definition_Clause): Use
Kill_Rep_Clause. This is just a cleanup, no functional effect.
(Analyze_Enumeration_Representation_Clause):
Use Kill_Rep_Clause. This means that enum rep
clauses are now properly removed from -gnatct trees.
(Analyze_Record_Representation_Clause): Same change.
* sem_ch13.ads (Kill_Rep_Clause): New procedure.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@212789 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/freeze.adb
gcc/ada/gnat_ugn.texi
gcc/ada/prj-tree.adb
gcc/ada/s-os_lib.ads
gcc/ada/sem_attr.adb
gcc/ada/sem_ch13.adb
gcc/ada/sem_ch13.ads
gcc/ada/types.h

index 897853b0bf183614f894edeb88b25e702ad1785e..90853093d7855882b7fb2d99b3f2e01044fd6daa 100644 (file)
@@ -1,3 +1,23 @@
+2014-07-18  Robert Dewar  <dewar@adacore.com>
+
+       * sem_attr.adb, s-os_lib.ads, prj-tree.adb: Minor reformatting.
+       * types.h: Fix typo.
+
+2014-07-18  Robert Dewar  <dewar@adacore.com>
+
+       * freeze.adb (Check_Address_Clause): Use Kill_Rep_Clause (no
+       functional change).
+       * gnat_ugn.texi: Document that -gnatI removes rep clauses from
+       ASIS trees.
+       * sem_ch13.adb (Kill_Rep_Clause): New procedure
+       (Analyze_Attribute_Definition_Clause): Use
+       Kill_Rep_Clause. This is just a cleanup, no functional effect.
+       (Analyze_Enumeration_Representation_Clause):
+       Use Kill_Rep_Clause. This means that enum rep
+       clauses are now properly removed from -gnatct trees.
+       (Analyze_Record_Representation_Clause): Same change.
+       * sem_ch13.ads (Kill_Rep_Clause): New procedure.
+
 2014-07-18  Pascal Obry  <obry@adacore.com>
 
        * s-os_lib.ads, s-os_lib.adb (GM_Time_Of): New routine to create an
index 26e2e0d3a4ee84101a947d4cb586819c9fe7de14..84914106097b043a2e1cfc64f46598c96ce8ff72 100644 (file)
@@ -604,7 +604,9 @@ package body Freeze is
                end if;
             end;
 
-            Rewrite (Addr, Make_Null_Statement (Sloc (E)));
+            --  And now remove the address clause
+
+            Kill_Rep_Clause (Addr);
 
          elsif not Error_Posted (Expr)
            and then not Needs_Finalization (Typ)
index 83b06792c87c2d581598c6e6486fb2291dec993d..c8b8ca699062f7020ac1935fdf798e049fa097b4 100644 (file)
@@ -4091,6 +4091,12 @@ Object_Size, Size, Small, Stream_Size, and Value_Size.
 Note that this option should be used only for compiling -- the
 code is likely to malfunction at run time.
 
+Note that when @code{-gnatct} is used to generate trees for input
+into @code{ASIS} tools, these representation clauses are removed
+from the tree. This means that the tool will not see them. For
+example, if you use @command{gnatpp} with @code{-gnatI}, the pretty printed
+output will not include the ignored representation clauses.
+
 @item -gnatjnn
 @cindex @option{-gnatjnn} (@command{gcc})
 Reformat error messages to fit on nn character lines
index e4a23602e20f7a1a1b506254b4c52e3e21456c05..2ff5a9fff18043e828b332bf2e4eeb56e41e3cd9 100644 (file)
@@ -1121,20 +1121,19 @@ package body Prj.Tree is
       In_Tree   : Project_Node_Tree_Ref;
       With_Name : Name_Id) return Project_Node_Id
    is
-      With_Clause : Project_Node_Id :=
-        First_With_Clause_Of (Project, In_Tree);
+      With_Clause : Project_Node_Id;
       Result      : Project_Node_Id := Empty_Node;
 
    begin
       --  First check all the imported projects
 
+      With_Clause := First_With_Clause_Of (Project, In_Tree);
       while Present (With_Clause) loop
 
-         --  Only non limited imported project may be used as prefix
-         --  of variable or attributes.
+         --  Only non limited imported project may be used as prefix of
+         --  variables or attributes.
 
          Result := Non_Limited_Project_Node_Of (With_Clause, In_Tree);
-
          while Present (Result) loop
             if Name_Of (Result, In_Tree) = With_Name then
                return Result;
index 810d7d4414a187c47298862c75b5e292c1a6f94c..50574a932e44a6c56612e2828862ad777a741d51 100644 (file)
@@ -159,9 +159,9 @@ package System.OS_Lib is
       Hour   : Hour_Type;
       Minute : Minute_Type;
       Second : Second_Type) return OS_Time;
-   --  Analogous to the Time_Of routine in Ada.Calendar, takes a set of
-   --  time component parts and returns an OS_Time. Returns Invalid_Time
-   --  if the creation fails.
+   --  Analogous to the Time_Of routine in Ada.Calendar, takes a set of time
+   --  component parts and returns an OS_Time. Returns Invalid_Time if the
+   --  creation fails.
 
    ----------------
    -- File Stuff --
index e65fecd339e39df5c5380339b553b44cf529f9de..d76f8ce341734fa17d814819bf0ed78d3c400673 100644 (file)
@@ -6336,11 +6336,13 @@ package body Sem_Attr is
                               Hi := High_Bound (Index);
 
                               Analyze_And_Resolve (Lo, Etype (Index_Type));
+
                               if not Is_OK_Static_Expression (Lo) then
                                  Set_Do_Range_Check (Lo);
                               end if;
 
                               Analyze_And_Resolve (Hi, Etype (Index_Type));
+
                               if not Is_OK_Static_Expression (Hi) then
                                  Set_Do_Range_Check (Hi);
                               end if;
index a9cdc2cb533e3698b7932510f0d1e10d65335c75..aab0ea10df4b654a8a7e4e8331e331cc5c049672 100644 (file)
@@ -3647,19 +3647,12 @@ package body Sem_Ch13 is
                  Attribute_Machine_Radix  |
                  Attribute_Object_Size    |
                  Attribute_Size           |
+                 Attribute_Small          |
                  Attribute_Stream_Size    |
                  Attribute_Value_Size     =>
-               Rewrite (N, Make_Null_Statement (Sloc (N)));
+               Kill_Rep_Clause (N);
                return;
 
-            --  Perhaps 'Small should not be ignored by Ignore_Rep_Clauses ???
-
-            when Attribute_Small =>
-               if Ignore_Rep_Clauses then
-                  Rewrite (N, Make_Null_Statement (Sloc (N)));
-                  return;
-               end if;
-
             --  The following should not be ignored, because in the first place
             --  they are reasonably portable, and should not cause problems in
             --  compiling code from another target, and also they do affect
@@ -3676,6 +3669,13 @@ package body Sem_Ch13 is
                  Attribute_Write               =>
                null;
 
+            --  We do not do anything here with address clauses, they will be
+            --  removed by Freeze later on, but for now, it works better to
+            --  keep then in the tree.
+
+            when Attribute_Address =>
+               null;
+
             --  Other cases are errors ("attribute& cannot be set with
             --  definition clause"), which will be caught below.
 
@@ -3830,7 +3830,7 @@ package body Sem_Ch13 is
 
             --  Even when ignoring rep clauses we need to indicate that the
             --  entity has an address clause and thus it is legal to declare
-            --  it imported.
+            --  it imported. Freeze will get rid of the address clause later.
 
             if Ignore_Rep_Clauses then
                if Ekind_In (U_Ent, E_Variable, E_Constant) then
@@ -5365,6 +5365,7 @@ package body Sem_Ch13 is
 
    begin
       if Ignore_Rep_Clauses then
+         Kill_Rep_Clause (N);
          return;
       end if;
 
@@ -5740,6 +5741,7 @@ package body Sem_Ch13 is
 
    begin
       if Ignore_Rep_Clauses then
+         Kill_Rep_Clause (N);
          return;
       end if;
 
@@ -10286,6 +10288,16 @@ package body Sem_Ch13 is
       end if;
    end Is_Operational_Item;
 
+   ---------------------
+   -- Kill_Rep_Clause --
+   ---------------------
+
+   procedure Kill_Rep_Clause (N : Node_Id) is
+   begin
+      pragma Assert (Ignore_Rep_Clauses);
+      Rewrite (N, Make_Null_Statement (Sloc (N)));
+   end Kill_Rep_Clause;
+
    ------------------
    -- Minimum_Size --
    ------------------
index 0f31265b621c369c6cc31f62598bcf2a3173edf1..9bef91cc3849f6f240bb4e9530a6992bb5e5a7df 100644 (file)
@@ -79,6 +79,11 @@ package Sem_Ch13 is
    procedure Initialize;
    --  Initialize internal tables for new compilation
 
+   procedure Kill_Rep_Clause (N : Node_Id);
+   --  This procedure is called for a rep clause N when we are in -gnatI mode
+   --  (Ignore_Rep_Clauses). It rewrites the node N to a null statement. This
+   --  is only called if Ignore_Rep_Clauses is True.
+
    procedure Set_Enum_Esize (T : Entity_Id);
    --  This routine sets the Esize field for an enumeration type T, based
    --  on the current representation information available for T. Note that
index 1330730b71b7a8fdf4e9d61f1d21365f28e93e06..dc3f82fec31c3c1f8837a38071c0be4e59c33970 100644 (file)
@@ -6,7 +6,7 @@
  *                                                                          *
  *                              C Header File                               *
  *                                                                          *
- *          Copyright (C) 1992-2013, Free Software Foundation, Inc.         *
+ *          Copyright (C) 1992-2014, 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- *
@@ -375,7 +375,7 @@ typedef Int Mechanism_Type;
 #define PE_Address_Of_Intrinsic            16
 #define PE_Aliased_Parameters              17
 #define PE_All_Guards_Closed               18
-#define PE_Bad_Attribute_For_Predicate     19
+#define PE_Bad_Predicated_Generic_Type     19
 #define PE_Current_Task_In_Entry_Body      20
 #define PE_Duplicated_Entry_Address        21
 #define PE_Explicit_Raise                  22