summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch6.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/sem_ch6.adb')
-rw-r--r--gcc/ada/sem_ch6.adb62
1 files changed, 25 insertions, 37 deletions
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 4f719e9b81c..a6d70e5b597 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -1039,7 +1039,7 @@ package body Sem_Ch6 is
---------------------
Expr : Node_Id;
- Obj_Decl : Node_Id;
+ Obj_Decl : Node_Id := Empty;
-- Start of processing for Analyze_Function_Return
@@ -1190,13 +1190,16 @@ package body Sem_Ch6 is
-- Case of Expr present
- if Present (Expr)
+ if Present (Expr) then
- -- Defend against previous errors
+ -- Defend against previous errors
+
+ if Nkind (Expr) = N_Empty
+ or else No (Etype (Expr))
+ then
+ return;
+ end if;
- and then Nkind (Expr) /= N_Empty
- and then Present (Etype (Expr))
- then
-- Apply constraint check. Note that this is done before the implicit
-- conversion of the expression done for anonymous access types to
-- ensure correct generation of the null-excluding check associated
@@ -1510,6 +1513,7 @@ package body Sem_Ch6 is
Process_End_Label (Handled_Statement_Sequence (N), 't', Current_Scope);
Update_Use_Clause_Chain;
+ Validate_Categorization_Dependency (N, Gen_Id);
End_Scope;
Check_Subprogram_Order (N);
@@ -3456,7 +3460,7 @@ package body Sem_Ch6 is
-- Start of processing for Analyze_Subprogram_Body_Helper
begin
- -- A [generic] subprogram body "freezes" the contract of the nearest
+ -- A [generic] subprogram body freezes the contract of the nearest
-- enclosing package body and all other contracts encountered in the
-- same declarative part up to and excluding the subprogram body:
@@ -3469,17 +3473,17 @@ package body Sem_Ch6 is
-- with Refined_Depends => (Input => Constit) ...
-- This ensures that any annotations referenced by the contract of the
- -- [generic] subprogram body are available. This form of "freezing" is
+ -- [generic] subprogram body are available. This form of freezing is
-- decoupled from the usual Freeze_xxx mechanism because it must also
-- work in the context of generics where normal freezing is disabled.
- -- Only bodies coming from source should cause this type of "freezing".
+ -- Only bodies coming from source should cause this type of freezing.
-- Expression functions that act as bodies and complete an initial
-- declaration must be included in this category, hence the use of
-- Original_Node.
if Comes_From_Source (Original_Node (N)) then
- Analyze_Previous_Contracts (N);
+ Freeze_Previous_Contracts (N);
end if;
-- Generic subprograms are handled separately. They always have a
@@ -4354,7 +4358,7 @@ package body Sem_Ch6 is
end if;
end if;
- -- A subprogram body "freezes" its own contract. Analyze the contract
+ -- A subprogram body freezes its own contract. Analyze the contract
-- after the declarations of the body have been processed as pragmas
-- are now chained on the contract of the subprogram body.
@@ -10118,7 +10122,6 @@ package body Sem_Ch6 is
function Visible_Part_Type (T : Entity_Id) return Boolean is
P : constant Node_Id := Unit_Declaration_Node (Scope (T));
- N : Node_Id;
begin
-- If the entity is a private type, then it must be declared in a
@@ -10126,34 +10129,19 @@ package body Sem_Ch6 is
if Ekind (T) in Private_Kind then
return True;
- end if;
-
- -- Otherwise, we traverse the visible part looking for its
- -- corresponding declaration. We cannot use the declaration
- -- node directly because in the private part the entity of a
- -- private type is the one in the full view, which does not
- -- indicate that it is the completion of something visible.
-
- N := First (Visible_Declarations (Specification (P)));
- while Present (N) loop
- if Nkind (N) = N_Full_Type_Declaration
- and then Present (Defining_Identifier (N))
- and then T = Defining_Identifier (N)
- then
- return True;
- elsif Nkind_In (N, N_Private_Type_Declaration,
- N_Private_Extension_Declaration)
- and then Present (Defining_Identifier (N))
- and then T = Full_View (Defining_Identifier (N))
- then
- return True;
- end if;
+ elsif Is_Type (T) and then Has_Private_Declaration (T) then
+ return True;
- Next (N);
- end loop;
+ elsif Is_List_Member (Declaration_Node (T))
+ and then List_Containing (Declaration_Node (T)) =
+ Visible_Declarations (Specification (P))
+ then
+ return True;
- return False;
+ else
+ return False;
+ end if;
end Visible_Part_Type;
-- Start of processing for Check_For_Primitive_Subprogram