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
This commit is contained in:
Robert Dewar 2014-07-18 09:34:17 +00:00 committed by Arnaud Charlet
parent c3d01e19a3
commit cf28c974d4
9 changed files with 67 additions and 21 deletions

View 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

View 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)

View 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

View 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;

View 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 --

View 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;

View 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 --
------------------

View 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

View 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