diff options
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 23 | ||||
-rw-r--r-- | gcc/ada/Makefile.rtl | 6 | ||||
-rw-r--r-- | gcc/ada/sem_ch4.adb | 3 | ||||
-rw-r--r-- | gcc/ada/sem_ch7.adb | 104 | ||||
-rw-r--r-- | gcc/ada/usage.adb | 2 |
5 files changed, 119 insertions, 19 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index db7a3d1..bd489fa 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,26 @@ +2025-10-05 Franck Behaghel <franckbehaghel_gcc@protonmail.com> + + PR ada/110314 + * sem_ch4.adb (Analyze_Allocator): Add call to New_Copy_Tree. + +2025-10-05 Eric Botcazou <ebotcazou@adacore.com> + + PR ada/112446 + * usage.adb (Usage): Add 'z' to the list of 'g' style. + +2025-10-05 Eric Botcazou <ebotcazou@adacore.com> + + PR ada/118343 + * Makefile.rtl (LLVM_BUILD): Delete. + +2025-10-04 Eric Botcazou <ebotcazou@adacore.com> + + PR ada/64869 + * sem_ch7.adb (Install_Private_Declarations): Also propagate the + Current_Use_Clause from partial to full view. + (Uninstall_Declarations): Extend implementation of RM 8.4(8.1/3) + subclause to all primitive subprograms. + 2025-09-30 Eric Botcazou <ebotcazou@adacore.com> PR ada/117517 diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl index 0fa2c51..2ccb3aa 100644 --- a/gcc/ada/Makefile.rtl +++ b/gcc/ada/Makefile.rtl @@ -26,12 +26,6 @@ ifndef ADAC ADAC=$(CC) endif -ifeq ($(LLVM_CONFIG),) -LLVM_BUILD := $(shell $(ADAC) -v | grep ^llvm-gcc) -else -LLVM_BUILD := llvm-gcc -endif - # Objects needed only for tasking GNATRTL_TASKING_OBJS= \ a-dispat$(objext) \ diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index 61a53f5..5704bf1 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -630,7 +630,8 @@ package body Sem_Ch4 is begin while Present (Discr) loop - Append (Discriminant_Default_Value (Discr), Constr); + Append_To (Constr, + New_Copy_Tree (Discriminant_Default_Value (Discr))); Next_Discriminant (Discr); end loop; diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb index 42abc89..1d838e2 100644 --- a/gcc/ada/sem_ch7.adb +++ b/gcc/ada/sem_ch7.adb @@ -2521,11 +2521,13 @@ package body Sem_Ch7 is and then Scope (Full_View (Id)) = Scope (Id) and then Ekind (Full_View (Id)) /= E_Incomplete_Type then + Full := Full_View (Id); + -- If there is a use-type clause on the private type, set the full -- view accordingly. - Set_In_Use (Full_View (Id), In_Use (Id)); - Full := Full_View (Id); + Set_In_Use (Full, In_Use (Id)); + Set_Current_Use_Clause (Full, Current_Use_Clause (Id)); if Is_Private_Base_Type (Full) and then Has_Private_Declaration (Full) @@ -2893,7 +2895,12 @@ package body Sem_Ch7 is -- When compiling a child unit this needs to be done recursively. function Type_In_Use (T : Entity_Id) return Boolean; - -- Check whether type or base type appear in an active use_type clause + -- Check whether type T is declared in P and appears in an active + -- use_type clause. + + function Type_Of_Primitive_In_Use_All (Id : Entity_Id) return Boolean; + -- Check whether the profile of primitive subprogram Id mentions a type + -- declared in P that appears in an active use-all-type clause. ------------------------------ -- Preserve_Full_Attributes -- @@ -3058,11 +3065,86 @@ package body Sem_Ch7 is ----------------- function Type_In_Use (T : Entity_Id) return Boolean is + BT : constant Entity_Id := Base_Type (T); begin - return Scope (Base_Type (T)) = P - and then (In_Use (T) or else In_Use (Base_Type (T))); + return Scope (BT) = P and then (In_Use (T) or else In_Use (BT)); end Type_In_Use; + ---------------------------------- + -- Type_Of_Primitive_In_Use_All -- + ---------------------------------- + + function Type_Of_Primitive_In_Use_All (Id : Entity_Id) return Boolean is + function Type_In_Use_All (T : Entity_Id) return Boolean; + -- Check whether type T is declared in P and appears in an active + -- use-all-type clause. + + --------------------- + -- Type_In_Use_All -- + --------------------- + + function Type_In_Use_All (T : Entity_Id) return Boolean is + begin + return Type_In_Use (T) + and then Nkind (Current_Use_Clause (T)) = N_Use_Type_Clause + and then All_Present (Current_Use_Clause (T)); + end Type_In_Use_All; + + -- Local variables + + F : Node_Id; + + -- Start of processing for Type_Of_Primitive_In_Use_All + + begin + -- The use-all-type clauses were introduced in Ada 2005 + + if Ada_Version <= Ada_95 then + return False; + end if; + + -- For enumeration literals, check type + + if Ekind (Id) = E_Enumeration_Literal then + return Type_In_Use_All (Etype (Id)); + end if; + + -- For functions, check return type + + if Ekind (Id) = E_Function then + declare + Typ : constant Entity_Id := + (if Ekind (Etype (Id)) = E_Anonymous_Access_Type + then Designated_Type (Etype (Id)) + else Etype (Id)); + begin + if Type_In_Use_All (Typ) then + return True; + end if; + end; + end if; + + -- For all subprograms, check formals + + F := First_Formal (Id); + while Present (F) loop + declare + Typ : constant Entity_Id := + (if Ekind (Etype (F)) = E_Anonymous_Access_Type + then Designated_Type (Etype (F)) + else Etype (F)); + begin + if Type_In_Use_All (Typ) then + return True; + end if; + end; + + Next_Formal (F); + end loop; + + return False; + end Type_Of_Primitive_In_Use_All; + -- Start of processing for Uninstall_Declarations begin @@ -3120,13 +3202,13 @@ package body Sem_Ch7 is elsif No (Etype (Id)) and then Serious_Errors_Detected /= 0 then null; - -- We need to avoid incorrectly marking enumeration literals as - -- non-visible when a visible use-all-type clause is in effect. + -- RM 8.4(8.1/3): Each primitive subprogram of T, including each + -- enumeration literal (if any), is potentially use-visible if T + -- is named in an active use-all-type clause. - elsif Type_In_Use (Etype (Id)) - and then Nkind (Current_Use_Clause (Etype (Id))) = - N_Use_Type_Clause - and then All_Present (Current_Use_Clause (Etype (Id))) + elsif (Ekind (Id) = E_Enumeration_Literal + or else (Is_Subprogram (Id) and then Is_Primitive (Id))) + and then Type_Of_Primitive_In_Use_All (Id) then null; diff --git a/gcc/ada/usage.adb b/gcc/ada/usage.adb index e59f324..bf8417a 100644 --- a/gcc/ada/usage.adb +++ b/gcc/ada/usage.adb @@ -674,7 +674,7 @@ begin Write_Line (" D check declared identifiers in mixed case"); Write_Line (" e check end/exit labels present"); Write_Line (" f check no form feeds/vertical tabs in source"); - Write_Line (" g check standard GNAT style rules, same as ydISux"); + Write_Line (" g check GNAT style rules, same as ydISuxz"); Write_Line (" h check no horizontal tabs in source"); Write_Line (" i check if-then layout"); Write_Line (" I check mode in"); |