Commit 51e641f8 by Arnaud Charlet

[multiple changes]

2011-12-20  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch12.adb (Insert_Freeze_Node_For_Instance):  Further
	refinements on the placement of a freeze node for a package
	instantiation, when the generic appears within a previous
	instantiation in the same unit.If the current instance is within
	the one that contains the generic, the freeze node for the
	current one must appear in the current declarative part. Ditto
	if the current instance is within another package instance. In
	these cases the freeze node of the previous instance is is not
	relevant. New predicate Enclosing_Body simplifies the process.
	(Freeze_Subprogram_Body): Rename Enclosing_Body to
	Enclosing_Package_Body, to prevent confusion with subprogram of
	same name elsewhere.
	(Install_Body): Recognize enclosing subprogram bodies to determine
	whether freeze_node belongs in current declarative list.

2011-12-20  Robert Dewar  <dewar@adacore.com>

	* sem_ch13.adb (Analyze_Attribute_Definition_Clause): Allow
	attribute definition clause for renaming if generated internally
	and generate duplicate clause to apply to renamed object.
	(Rep_Item_Too_Late): Only diagnose source level entities
	* prj-nmsc.adb: Minor reformatting.
	* gcc-interface/Make-lang.in: Update dependencies.

From-SVN: r182542
parent b2009d46
2011-12-20 Ed Schonberg <schonberg@adacore.com>
* sem_ch12.adb (Insert_Freeze_Node_For_Instance): Further
refinements on the placement of a freeze node for a package
instantiation, when the generic appears within a previous
instantiation in the same unit.If the current instance is within
the one that contains the generic, the freeze node for the
current one must appear in the current declarative part. Ditto
if the current instance is within another package instance. In
these cases the freeze node of the previous instance is is not
relevant. New predicate Enclosing_Body simplifies the process.
(Freeze_Subprogram_Body): Rename Enclosing_Body to
Enclosing_Package_Body, to prevent confusion with subprogram of
same name elsewhere.
(Install_Body): Recognize enclosing subprogram bodies to determine
whether freeze_node belongs in current declarative list.
2011-12-20 Robert Dewar <dewar@adacore.com>
* sem_ch13.adb (Analyze_Attribute_Definition_Clause): Allow
attribute definition clause for renaming if generated internally
and generate duplicate clause to apply to renamed object.
(Rep_Item_Too_Late): Only diagnose source level entities
* prj-nmsc.adb: Minor reformatting.
* gcc-interface/Make-lang.in: Update dependencies.
2011-12-20 Bob Duff <duff@adacore.com>
* opt.ads (List_Inherited_Aspects): Default to False
......
......@@ -2855,8 +2855,8 @@ package body Prj.Nmsc is
Continuation := Continuation_String'Access;
end if;
elsif (not Unchecked_Shared_Lib_Imports)
and then Project.Library_Kind /= Static
elsif not Unchecked_Shared_Lib_Imports
and then Project.Library_Kind /= Static
then
Error_Msg
(Data.Flags,
......@@ -3145,7 +3145,6 @@ package body Prj.Nmsc is
when others =>
null;
end case;
end if;
......@@ -3405,7 +3404,6 @@ package body Prj.Nmsc is
Imported_Project_List := Imported_Project_List.Next;
end loop;
end if;
end if;
end if;
......
......@@ -2216,19 +2216,35 @@ package body Sem_Ch13 is
-- Must not be a source renaming (we do have some cases where the
-- expander generates a renaming, and those cases are OK, in such
-- cases any attribute applies to the renamed object as well.
-- cases any attribute applies to the renamed object as well).
elsif Is_Object (Ent)
and then Present (Renamed_Object (Ent))
and then Comes_From_Source (Renamed_Object (Ent))
then
Get_Name_String (Chars (N));
Error_Msg_Strlen := Name_Len;
Error_Msg_String (1 .. Name_Len) := Name_Buffer (1 .. Name_Len);
Error_Msg_N
("~ clause not allowed for a renaming declaration (RM 13.1(6))",
Nam);
return;
-- Case of renamed object from source, this is an error
if Comes_From_Source (Renamed_Object (Ent)) then
Get_Name_String (Chars (N));
Error_Msg_Strlen := Name_Len;
Error_Msg_String (1 .. Name_Len) := Name_Buffer (1 .. Name_Len);
Error_Msg_N
("~ clause not allowed for a renaming declaration "
& "(RM 13.1(6))", Nam);
return;
-- For the case of a compiler generated renaming, the attribute
-- definition clause applies to the renamed object created by the
-- expander. The easiest general way to handle this is to create a
-- copy of the attribute definition clause for this object.
else
Insert_Action (N,
Make_Attribute_Definition_Clause (Loc,
Name =>
New_Occurrence_Of (Entity (Renamed_Object (Ent)), Loc),
Chars => Chars (N),
Expression => Duplicate_Subexpr (Expression (N))));
end if;
-- If no underlying entity, use entity itself, applies to some
-- previously detected error cases ???
......@@ -7812,12 +7828,21 @@ package body Sem_Ch13 is
-- Start of processing for Rep_Item_Too_Late
begin
-- First make sure entity is not frozen (RM 13.1(9)). Exclude imported
-- types, which may be frozen if they appear in a representation clause
-- for a local type.
-- First make sure entity is not frozen (RM 13.1(9))
if Is_Frozen (T)
-- Exclude imported types, which may be frozen if they appear in a
-- representation clause for a local type.
and then not From_With_Type (T)
-- Exclude generated entitiesa (not coming from source). The common
-- case is when we generate a renaming which prematurely freezes the
-- renamed internal entity, but we still want to be able to set copies
-- of attribute values such as Size/Alignment.
and then Comes_From_Source (T)
then
Too_Late;
S := First_Subtype (T);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment