aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog17
-rw-r--r--gcc/ada/sem_ch3.adb4
-rw-r--r--gcc/ada/sem_res.adb52
3 files changed, 46 insertions, 27 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index c99021a..1232383 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,20 @@
+2025-11-04 Eric Botcazou <ebotcazou@adacore.com>
+
+ * sem_ch3.adb (Analyze_Subtype_Declaration) <Concurrent_Kind>:
+ Propagate the Uses_Lock_Free flag for protected types.
+
+2025-11-04 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR ada/18453
+ * sem_ch12.adb (Find_Actual_Type): Add Typ_Ref parameter and
+ perform a standard resolution on it in the fallback case.
+ Call Get_Instance_Of if the type is declared in a formal of
+ the child unit.
+ (Instantiate_Type.Validate_Access_Type_Instance): Adjust call
+ to Find_Actual_Type.
+ (Instantiate_Type.Validate_Array_Type_Instance): Likewise and
+ streamline the check for matching component subtypes.
+
2025-11-03 Eric Botcazou <ebotcazou@adacore.com>
PR ada/78175
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 233f823..ba0af27 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -6145,6 +6145,10 @@ package body Sem_Ch3 is
Set_Is_Tagged_Type (Id, Is_Tagged_Type (T));
Set_Last_Entity (Id, Last_Entity (T));
+ if Is_Protected_Type (T) then
+ Set_Uses_Lock_Free (Id, Uses_Lock_Free (T));
+ end if;
+
if Is_Tagged_Type (T) then
Set_No_Tagged_Streams_Pragma
(Id, No_Tagged_Streams_Pragma (T));
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index bf9d5e1..301894b 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -658,6 +658,24 @@ package body Sem_Res is
P : Node_Id;
D : Node_Id;
+ procedure Check_Legality_In_Constraint (Alone : Boolean);
+ -- RM 3.8(12/3): Check that the discriminant mentioned in a constraint
+ -- appears alone as a direct name.
+
+ ----------------------------------
+ -- Check_Legality_In_Constraint --
+ ----------------------------------
+
+ procedure Check_Legality_In_Constraint (Alone : Boolean) is
+ begin
+ if not Alone then
+ Error_Msg_N ("discriminant in constraint must appear alone", N);
+
+ elsif Nkind (N) = N_Expanded_Name and then Comes_From_Source (N) then
+ Error_Msg_N ("discriminant must appear alone as a direct name", N);
+ end if;
+ end Check_Legality_In_Constraint;
+
begin
-- Any use in a spec-expression is legal
@@ -694,19 +712,11 @@ package body Sem_Res is
-- processing for records). See Sem_Ch3.Build_Derived_Record_Type
-- for more info.
- if Ekind (Current_Scope) = E_Record_Type
- and then Scope (Disc) = Current_Scope
- and then not
- (Nkind (Parent (P)) = N_Subtype_Indication
- and then
- Nkind (Parent (Parent (P))) in N_Component_Definition
- | N_Subtype_Declaration
- and then Paren_Count (N) = 0)
- then
- Error_Msg_N
- ("discriminant must appear alone in component constraint", N);
- return;
- end if;
+ Check_Legality_In_Constraint
+ (Nkind (Parent (P)) = N_Subtype_Indication
+ and then Nkind (Parent (Parent (P))) in N_Component_Definition
+ | N_Subtype_Declaration
+ and then Paren_Count (N) = 0);
-- Detect a common error:
@@ -817,18 +827,7 @@ package body Sem_Res is
elsif Nkind (PN) in N_Index_Or_Discriminant_Constraint
| N_Discriminant_Association
then
- if Paren_Count (N) > 0 then
- Error_Msg_N
- ("discriminant in constraint must appear alone", N);
-
- elsif Nkind (N) = N_Expanded_Name
- and then Comes_From_Source (N)
- then
- Error_Msg_N
- ("discriminant must appear alone as a direct name", N);
- end if;
-
- return;
+ Check_Legality_In_Constraint (Paren_Count (N) = 0);
-- Otherwise, context is an expression. It should not be within (i.e. a
-- subexpression of) a constraint for a component.
@@ -863,8 +862,7 @@ package body Sem_Res is
or else Nkind (P) = N_Entry_Declaration
or else Nkind (D) = N_Defining_Identifier
then
- Error_Msg_N
- ("discriminant in constraint must appear alone", N);
+ Check_Legality_In_Constraint (False);
end if;
end if;
end Check_Discriminant_Use;