aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch10.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2013-10-10 14:56:07 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2013-10-10 14:56:07 +0200
commit39af2bac25b7a60c9ab868e794202dd45af94e14 (patch)
tree6c275556a6003daed0c6e63f15e5ba9a688875ef /gcc/ada/sem_ch10.adb
parent815839a3844ec00f5f8700eb377fde8842082e96 (diff)
downloadgcc-39af2bac25b7a60c9ab868e794202dd45af94e14.zip
gcc-39af2bac25b7a60c9ab868e794202dd45af94e14.tar.gz
gcc-39af2bac25b7a60c9ab868e794202dd45af94e14.tar.bz2
[multiple changes]
2013-10-10 Hristian Kirtchev <kirtchev@adacore.com> * aspects.adb: Add an entry in table Canonical_Aspect for Refined_State. * aspects.ads: Add entries in tables Aspect_Id, Aspect_Argument, Aspect_Names and Aspect_Delay for Refined_State. * einfo.adb: Add with and use clauses for Elists. Remove Refined_State from the list of node usage. Add Refined_State_Pragma to the list of node usage. (Has_Null_Abstract_State): New routine. (Refined_State): Removed. (Refined_State_Pragma): New routine. (Set_Refined_State): Removed. (Set_Refined_State_Pragma): New routine. (Write_Field8_Name): Add output for Refined_State_Pragma. (Write_Field9_Name): Remove the output for Refined_State. * einfo.ads: Add new synthesized attribute Has_Null_Abstract_State along with usage in nodes. Remove attribute Refined_State along with usage in nodes. Add new attribute Refined_State_Pragma along with usage in nodes. (Has_Null_Abstract_State): New routine. (Refined_State): Removed. (Refined_State_Pragma): New routine. (Set_Refined_State): Removed. (Set_Refined_State_Pragma): New routine. * elists.adb (Clone): New routine. * elists.ads (Clone): New routine. * par-prag.adb: Add Refined_State to the pragmas that do not require special processing by the parser. * sem_ch3.adb: Add with and use clause for Sem_Prag. (Analyze_Declarations): Add local variables Body_Id, Context and Spec_Id. Add processing for delayed aspect/pragma Refined_State. * sem_ch13.adb (Analyze_Aspect_Specifications): Update the handling of aspect Abstract_State. Add processing for aspect Refined_State. Remove the bizzare insertion policy for aspect Abstract_State. (Check_Aspect_At_Freeze_Point): Add an entry for Refined_State. * sem_prag.adb: Add an entry to table Sig_Flags for pragma Refined_State. (Add_Item): Update the comment on usage. The inserted items need not be unique. (Analyze_Contract_Cases_In_Decl_Part): Rename variable Restore to Restore_Scope and update all its occurrences. (Analyze_Pragma): Update the handling of pragma Abstract_State. Add processing for pragma Refined_State. (Analyze_Pre_Post_Condition_In_Decl_Part): Rename variable Restore to Restore_Scope and update all its occurrences. (Analyze_Refined_State_In_Decl_Part): New routine. * sem_prag.ads (Analyze_Refined_State_In_Decl_Part): New routine. * snames.ads-tmpl: Add new predefined name for Refined_State. Add new Pragma_Id for Refined_State. 2013-10-10 Ed Schonberg <schonberg@adacore.com> * sem_ch10.adb (Install_Limited_Withed_Unit): handle properly the case of a record declaration in a limited view, when the record contains a self-referential component of an anonymous access type. From-SVN: r203371
Diffstat (limited to 'gcc/ada/sem_ch10.adb')
-rw-r--r--gcc/ada/sem_ch10.adb93
1 files changed, 39 insertions, 54 deletions
diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb
index 8d64964..ee2ab63 100644
--- a/gcc/ada/sem_ch10.adb
+++ b/gcc/ada/sem_ch10.adb
@@ -330,9 +330,8 @@ package body Sem_Ch10 is
function Same_Unit (N : Node_Id; P : Entity_Id) return Boolean is
begin
return Entity (N) = P
- or else
- (Present (Renamed_Object (P))
- and then Entity (N) = Renamed_Object (P));
+ or else (Present (Renamed_Object (P))
+ and then Entity (N) = Renamed_Object (P));
end Same_Unit;
-- Start of processing for Process_Body_Clauses
@@ -404,14 +403,12 @@ package body Sem_Ch10 is
elsif Nkind (Cont_Item) = N_Pragma
and then
Nam_In (Pragma_Name (Cont_Item), Name_Elaborate,
- Name_Elaborate_All)
+ Name_Elaborate_All)
and then not Used_Type_Or_Elab
then
Prag_Unit :=
First (Pragma_Argument_Associations (Cont_Item));
- while Present (Prag_Unit)
- and then not Used_Type_Or_Elab
- loop
+ while Present (Prag_Unit) and then not Used_Type_Or_Elab loop
if Entity (Expression (Prag_Unit)) = Nam_Ent then
Used_Type_Or_Elab := True;
end if;
@@ -478,7 +475,7 @@ package body Sem_Ch10 is
-- with Pack;
-- with Pack;
-- pragma Elaborate (Pack);
- --
+
-- In this case, the second with clause is redundant since
-- the pragma applies only to the first "with Pack;".
@@ -558,10 +555,8 @@ package body Sem_Ch10 is
if (Withed_In_Spec
and then not Used_Type_Or_Elab)
and then
- ((not Used_In_Spec
- and then not Used_In_Body)
- or else
- Used_In_Spec)
+ ((not Used_In_Spec and then not Used_In_Body)
+ or else Used_In_Spec)
then
Error_Msg_N -- CODEFIX
("redundant with clause in body??", Clause);
@@ -1014,9 +1009,8 @@ package body Sem_Ch10 is
N_Package_Renaming_Declaration,
N_Subprogram_Declaration)
or else Nkind (Unit_Node) in N_Generic_Declaration
- or else
- (Nkind (Unit_Node) = N_Subprogram_Body
- and then Acts_As_Spec (Unit_Node))
+ or else (Nkind (Unit_Node) = N_Subprogram_Body
+ and then Acts_As_Spec (Unit_Node))
then
Remove_Unit_From_Visibility (Defining_Entity (Unit_Node));
@@ -1932,10 +1926,9 @@ package body Sem_Ch10 is
Nam := Full_View (Nam);
end if;
- if No (Nam)
- or else not Is_Protected_Type (Etype (Nam))
- then
+ if No (Nam) or else not Is_Protected_Type (Etype (Nam)) then
Error_Msg_N ("missing specification for Protected body", N);
+
else
Set_Scope (Defining_Entity (N), Current_Scope);
Set_Has_Completion (Etype (Nam));
@@ -1970,9 +1963,7 @@ package body Sem_Ch10 is
N_Subprogram_Body)
then
Decl := First (Declarations (Parent (N)));
- while Present (Decl)
- and then Decl /= N
- loop
+ while Present (Decl) and then Decl /= N loop
if Nkind (Decl) = N_Subprogram_Body_Stub
and then (Chars (Defining_Unit_Name (Specification (Decl))) =
Chars (Defining_Unit_Name (Specification (N))))
@@ -2184,9 +2175,7 @@ package body Sem_Ch10 is
E := First_Entity (Current_Scope);
while Present (E) loop
- if not Is_Child_Unit (E)
- or else Is_Visible_Lib_Unit (E)
- then
+ if not Is_Child_Unit (E) or else Is_Visible_Lib_Unit (E) then
Set_Is_Immediately_Visible (E);
end if;
@@ -2312,8 +2301,8 @@ package body Sem_Ch10 is
if Is_Package_Or_Generic_Package (Par_Unit) then
if not Is_Immediately_Visible (Par_Unit)
or else (Present (First_Entity (Par_Unit))
- and then not Is_Immediately_Visible
- (First_Entity (Par_Unit)))
+ and then not
+ Is_Immediately_Visible (First_Entity (Par_Unit)))
then
Set_Is_Immediately_Visible (Par_Unit);
Install_Visible_Declarations (Par_Unit);
@@ -2923,7 +2912,7 @@ package body Sem_Ch10 is
or else Private_Present (Item)
or else Nkind_In (Lib_Unit, N_Package_Body, N_Subunit)
or else (Nkind (Lib_Unit) = N_Subprogram_Body
- and then not Acts_As_Spec (Parent (Lib_Unit)))
+ and then not Acts_As_Spec (Parent (Lib_Unit)))
then
null;
@@ -3464,7 +3453,7 @@ package body Sem_Ch10 is
if Nkind (Lib_Unit) = N_Package_Body
or else (Nkind (Lib_Unit) = N_Subprogram_Body
- and then not Acts_As_Spec (N))
+ and then not Acts_As_Spec (N))
then
Install_Context (Library_Unit (N));
@@ -3636,9 +3625,7 @@ package body Sem_Ch10 is
-- Check all the enclosing scopes.
E2 := E;
- while E2 /= Standard_Standard
- and then E2 /= WEnt
- loop
+ while E2 /= Standard_Standard and then E2 /= WEnt loop
E2 := Scope (E2);
end loop;
@@ -3856,9 +3843,7 @@ package body Sem_Ch10 is
Check_Private_Limited_Withed_Unit (Item);
- if not Implicit_With (Item)
- and then Is_Child_Spec (Unit (N))
- then
+ if not Implicit_With (Item) and then Is_Child_Spec (Unit (N)) then
Check_Renamings (Parent_Spec (Unit (N)), Item);
end if;
@@ -3998,7 +3983,7 @@ package body Sem_Ch10 is
or else Nkind (Original_Node (Lib_Unit)) in N_Generic_Instantiation
or else
(Nkind (Lib_Unit) = N_Package_Declaration
- and then Present (Generic_Parent (Specification (Lib_Unit))))
+ and then Present (Generic_Parent (Specification (Lib_Unit))))
then
null;
else
@@ -4061,9 +4046,7 @@ package body Sem_Ch10 is
Set_Use (Generic_Formal_Declarations (Parent (P_Spec)));
end if;
- if Is_Private
- or else Private_Present (Parent (Lib_Unit))
- then
+ if Is_Private or else Private_Present (Parent (Lib_Unit)) then
Install_Private_Declarations (P_Name);
Install_Private_With_Clauses (P_Name);
Set_Use (Private_Declarations (P_Spec));
@@ -4992,7 +4975,18 @@ package body Sem_Ch10 is
-- Replace E in the homonyms list, so that the limited view
-- becomes available.
- if E = Non_Limited_View (Lim_Typ) then
+ -- If the non-limited view is a record with an anonymous
+ -- self-referential component, the analysis of the record
+ -- declaration creates an incomplete type with the same name
+ -- in order to define an internal access type. The visible
+ -- entity is now the incomplete type, and that is the one to
+ -- replace in the visibility structure.
+
+ if E = Non_Limited_View (Lim_Typ)
+ or else
+ (Ekind (E) = E_Incomplete_Type
+ and then Full_View (E) = Non_Limited_View (Lim_Typ))
+ then
Set_Homonym (Lim_Typ, Homonym (Prev));
Set_Current_Entity (Lim_Typ);
@@ -5004,9 +4998,7 @@ package body Sem_Ch10 is
-- limited_with_clause.
exit when No (E);
-
exit when E = Non_Limited_View (Lim_Typ);
-
Prev := Homonym (Prev);
end loop;
@@ -5128,7 +5120,7 @@ package body Sem_Ch10 is
if Sloc (Uname) /= No_Location
and then (not Is_Internal_File_Name (Unit_File_Name (Current_Sem_Unit))
- or else Current_Sem_Unit = Main_Unit)
+ or else Current_Sem_Unit = Main_Unit)
then
Check_Restricted_Unit
(Unit_Name (Get_Source_Unit (Uname)), With_Clause);
@@ -5224,9 +5216,7 @@ package body Sem_Ch10 is
begin
U2 := Homonym (Uname);
- while Present (U2)
- and then U2 /= Standard_Standard
- loop
+ while Present (U2) and then U2 /= Standard_Standard loop
P2 := Scope (U2);
Decl2 := Unit_Declaration_Node (P2);
@@ -5836,9 +5826,7 @@ package body Sem_Ch10 is
Ent : Entity_Id;
begin
- if Is_Subprogram (E)
- and then Has_Pragma_Inline (E)
- then
+ if Is_Subprogram (E) and then Has_Pragma_Inline (E) then
return True;
elsif Ekind_In (E, E_Generic_Function, E_Generic_Procedure) then
@@ -6225,9 +6213,8 @@ package body Sem_Ch10 is
begin
Item := First (Context_Items (Comp_Unit));
while Present (Item) loop
- if Nkind (Item) = N_With_Clause
- and then Private_Present (Item)
- then
+ if Nkind (Item) = N_With_Clause and then Private_Present (Item) then
+
-- If private_with_clause is redundant, remove it from context,
-- as a small optimization to subsequent handling of private_with
-- clauses in other nested packages.
@@ -6310,9 +6297,7 @@ package body Sem_Ch10 is
Set_Name_Entity_Id (Chars (E), Homonym (E));
else
- while Present (Prev)
- and then Homonym (Prev) /= E
- loop
+ while Present (Prev) and then Homonym (Prev) /= E loop
Prev := Homonym (Prev);
end loop;