aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Dewar <dewar@adacore.com>2014-07-18 09:34:17 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2014-07-18 11:34:17 +0200
commitcf28c974d4868d94b6a5cee2c36c5dc617a7444d (patch)
treed7fb80a81af0997f5b112651970b927c9f5380b4
parentc3d01e19a33b26764c40d67e6f3f86efbd86b203 (diff)
downloadgcc-cf28c974d4868d94b6a5cee2c36c5dc617a7444d.zip
gcc-cf28c974d4868d94b6a5cee2c36c5dc617a7444d.tar.gz
gcc-cf28c974d4868d94b6a5cee2c36c5dc617a7444d.tar.bz2
sem_attr.adb, [...]: Minor reformatting.
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. From-SVN: r212789
-rw-r--r--gcc/ada/ChangeLog20
-rw-r--r--gcc/ada/freeze.adb4
-rw-r--r--gcc/ada/gnat_ugn.texi6
-rw-r--r--gcc/ada/prj-tree.adb9
-rw-r--r--gcc/ada/s-os_lib.ads6
-rw-r--r--gcc/ada/sem_attr.adb2
-rw-r--r--gcc/ada/sem_ch13.adb32
-rw-r--r--gcc/ada/sem_ch13.ads5
-rw-r--r--gcc/ada/types.h4
9 files changed, 67 insertions, 21 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 897853b..9085309 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -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
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index 26e2e0d..8491410 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -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)
diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi
index 83b0679..c8b8ca6 100644
--- a/gcc/ada/gnat_ugn.texi
+++ b/gcc/ada/gnat_ugn.texi
@@ -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
diff --git a/gcc/ada/prj-tree.adb b/gcc/ada/prj-tree.adb
index e4a2360..2ff5a9f 100644
--- a/gcc/ada/prj-tree.adb
+++ b/gcc/ada/prj-tree.adb
@@ -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;
diff --git a/gcc/ada/s-os_lib.ads b/gcc/ada/s-os_lib.ads
index 810d7d4..50574a9 100644
--- a/gcc/ada/s-os_lib.ads
+++ b/gcc/ada/s-os_lib.ads
@@ -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 --
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index e65fecd..d76f8ce 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -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;
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index a9cdc2c..aab0ea1 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -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 --
------------------
diff --git a/gcc/ada/sem_ch13.ads b/gcc/ada/sem_ch13.ads
index 0f31265..9bef91c 100644
--- a/gcc/ada/sem_ch13.ads
+++ b/gcc/ada/sem_ch13.ads
@@ -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
diff --git a/gcc/ada/types.h b/gcc/ada/types.h
index 1330730..dc3f82f 100644
--- a/gcc/ada/types.h
+++ b/gcc/ada/types.h
@@ -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