Commit 5b6f12c7 by Arnaud Charlet

[multiple changes]

2014-01-31  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch6.adb (Process_Formals): In Ada2012 mode, place
	subprogram with an incomplete untagged formals on the list of
	private dependents, to verify that the type is properly completed
	in the private part.
	* sem_attr.adb: Code clean up.

2014-01-31  Robert Dewar  <dewar@adacore.com>

	* exp_ch6.adb: Minor reformatting.

2014-01-31  Vincent Celier  <celier@adacore.com>

	* prj-attr.adb (First_Attribute_Of): Return Unknown_Attribute
	when Pkg is unknown.

From-SVN: r207354
parent d950f051
2014-01-31 Ed Schonberg <schonberg@adacore.com>
* sem_ch6.adb (Process_Formals): In Ada2012 mode, place
subprogram with an incomplete untagged formals on the list of
private dependents, to verify that the type is properly completed
in the private part.
* sem_attr.adb: Code clean up.
2014-01-31 Robert Dewar <dewar@adacore.com>
* exp_ch6.adb: Minor reformatting.
2014-01-31 Vincent Celier <celier@adacore.com>
* prj-attr.adb (First_Attribute_Of): Return Unknown_Attribute
when Pkg is unknown.
2014-01-31 Hristian Kirtchev <kirtchev@adacore.com> 2014-01-31 Hristian Kirtchev <kirtchev@adacore.com>
* sem_res.adb (Resolve_Entity_Name): Comment * sem_res.adb (Resolve_Entity_Name): Comment
......
...@@ -8764,8 +8764,8 @@ package body Exp_Ch6 is ...@@ -8764,8 +8764,8 @@ package body Exp_Ch6 is
-- is done because the input type may lack aspect/pragma -- is done because the input type may lack aspect/pragma
-- predicate and simply inherit those from its ancestor. -- predicate and simply inherit those from its ancestor.
-- Note that predicate pragmas include all three cases of -- Note that predicate pragmas correspond to all three cases
-- predicate aspects (Predicate, Dynamic_Predicate, -- of predicate aspects (Predicate, Dynamic_Predicate, and
-- Static_Predicate), so this routine checks for all three -- Static_Predicate), so this routine checks for all three
-- cases. -- cases.
...@@ -8880,7 +8880,7 @@ package body Exp_Ch6 is ...@@ -8880,7 +8880,7 @@ package body Exp_Ch6 is
then then
null; null;
-- Add the item -- Otherwise, add the item
else else
if No (List) then if No (List) then
...@@ -9552,9 +9552,9 @@ package body Exp_Ch6 is ...@@ -9552,9 +9552,9 @@ package body Exp_Ch6 is
end if; end if;
-- For now we test whether E denotes a function or access-to-function -- For now we test whether E denotes a function or access-to-function
-- type whose result subtype is inherently limited. Later this test may -- type whose result subtype is inherently limited. Later this test
-- be revised to allow composite nonlimited types. Functions with a -- may be revised to allow composite nonlimited types. Functions with
-- foreign convention or whose result type has a foreign convention -- a foreign convention or whose result type has a foreign convention
-- never qualify. -- never qualify.
if Ekind_In (E, E_Function, E_Generic_Function) if Ekind_In (E, E_Function, E_Generic_Function)
...@@ -9595,13 +9595,13 @@ package body Exp_Ch6 is ...@@ -9595,13 +9595,13 @@ package body Exp_Ch6 is
Function_Id : Entity_Id; Function_Id : Entity_Id;
begin begin
-- Return False when the expander is inactive, since awareness of -- Return False if the expander is currently inactive, since awareness
-- build-in-place treatment is only relevant during expansion. Note that -- of build-in-place treatment is only relevant during expansion. Note
-- Is_Build_In_Place_Function, which is called as part of this function, -- that Is_Build_In_Place_Function, which is called as part of this
-- is also conditioned this way, but we need to check here as well to -- function, is also conditioned this way, but we need to check here as
-- avoid blowing up on processing protected calls when expansion is -- well to avoid blowing up on processing protected calls when expansion
-- disabled (such as with -gnatc) since those would trip over the raise -- is disabled (such as with -gnatc) since those would trip over the
-- of Program_Error below. -- raise of Program_Error below.
-- In SPARK mode, build-in-place calls are not expanded, so that we -- In SPARK mode, build-in-place calls are not expanded, so that we
-- may end up with a call that is neither resolved to an entity, nor -- may end up with a call that is neither resolved to an entity, nor
...@@ -9778,8 +9778,7 @@ package body Exp_Ch6 is ...@@ -9778,8 +9778,7 @@ package body Exp_Ch6 is
-- Handle CPP primitives found in derivations of CPP_Class types. -- Handle CPP primitives found in derivations of CPP_Class types.
-- These primitives must have been inherited from some parent, and -- These primitives must have been inherited from some parent, and
-- there is no need to register them in the dispatch table because -- there is no need to register them in the dispatch table because
-- Build_Inherit_Prims takes care of the initialization of these -- Build_Inherit_Prims takes care of initializing these slots.
-- slots.
elsif Is_Imported (Subp) elsif Is_Imported (Subp)
and then (Convention (Subp) = Convention_CPP and then (Convention (Subp) = Convention_CPP
......
...@@ -1013,7 +1013,7 @@ package body Prj.Attr is ...@@ -1013,7 +1013,7 @@ package body Prj.Attr is
(Pkg : Package_Node_Id) return Attribute_Node_Id (Pkg : Package_Node_Id) return Attribute_Node_Id
is is
begin begin
if Pkg = Empty_Package then if Pkg = Empty_Package or else Pkg = Unknown_Package then
return Empty_Attribute; return Empty_Attribute;
else else
return return
......
...@@ -6149,7 +6149,11 @@ package body Sem_Attr is ...@@ -6149,7 +6149,11 @@ package body Sem_Attr is
end; end;
elsif Is_Record_Type (P_Type) then elsif Is_Record_Type (P_Type) then
Check_Component_Reference (Comp, P_Type); if Nkind (Comp) /= N_Identifier then
Error_Msg_N ("name should be identifier or OTHERS", Comp);
else
Check_Component_Reference (Comp, P_Type);
end if;
end if; end if;
Next (Comp); Next (Comp);
......
...@@ -1907,10 +1907,11 @@ package body Sem_Ch6 is ...@@ -1907,10 +1907,11 @@ package body Sem_Ch6 is
if Is_Tagged_Type (Typ) then if Is_Tagged_Type (Typ) then
null; null;
elsif Nkind_In (Parent (Parent (N)), elsif Nkind (Parent (N)) = N_Subprogram_Body
N_Accept_Statement, or else
N_Entry_Body, Nkind_In (Parent (Parent (N)),
N_Subprogram_Body) N_Accept_Statement,
N_Entry_Body)
then then
Error_Msg_NE Error_Msg_NE
("invalid use of untagged incomplete type&", ("invalid use of untagged incomplete type&",
...@@ -11010,9 +11011,15 @@ package body Sem_Ch6 is ...@@ -11010,9 +11011,15 @@ package body Sem_Ch6 is
-- Ada 2012: tagged incomplete types are allowed as generic -- Ada 2012: tagged incomplete types are allowed as generic
-- formal types. They do not introduce dependencies and the -- formal types. They do not introduce dependencies and the
-- corresponding generic subprogram does not have a delayed -- corresponding generic subprogram does not have a delayed
-- freeze, because it does not need a freeze node. -- freeze, because it does not need a freeze node. However,
-- it is still the case that untagged incomplete types cannot
if Is_Tagged_Type (Formal_Type) then -- be Taft-amendment types and must be completed in private
-- part, so the subprogram must appear in the list of private
-- dependents of the type.
if Is_Tagged_Type (Formal_Type)
or else Ada_Version >= Ada_2012
then
if Ekind (Scope (Current_Scope)) = E_Package if Ekind (Scope (Current_Scope)) = E_Package
and then not From_Limited_With (Formal_Type) and then not From_Limited_With (Formal_Type)
and then not Is_Generic_Type (Formal_Type) and then not Is_Generic_Type (Formal_Type)
......
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