https://gcc.gnu.org/g:9f297cb0f1c9b5648feb29f80cc4e76440f8435e

commit r17-1188-g9f297cb0f1c9b5648feb29f80cc4e76440f8435e
Author: Ronan Desplanques <[email protected]>
Date:   Mon Apr 13 17:59:04 2026 +0200

    ada: Tweak predicate name and documentation comment
    
    The old name was wrong because a type is not a subcomponent of itself.
    In other words, "is a subcomponent of" is not a reflexive relation. Also,
    the old comment implied that the Ekind of the return value was
    E_Component; it's actually a type.
    
    gcc/ada/ChangeLog:
    
            * sem_util.ads (Partially_Visible_Subcomponent): Rename into ...
            (Partially_Visible_Part): ...this. Improve documentation.
            * sem_util.adb: Likewise.
            * sem_ch3.adb (Analyze_Component_Declaration,
            Array_Type_Declaration): Adapt to renaming.
            * sem_ch7.adb (Install_Composite_Operations): Likewise.

Diff:
---
 gcc/ada/sem_ch3.adb  |  4 ++--
 gcc/ada/sem_ch7.adb  |  2 +-
 gcc/ada/sem_util.adb |  8 +++-----
 gcc/ada/sem_util.ads | 13 +++++++------
 4 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index bc02601fe0c0..1f8d86eb6315 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -2222,7 +2222,7 @@ package body Sem_Ch3 is
       --  If this component is private (or depends on a private type), flag the
       --  record type to indicate that some operations are not available.
 
-      P := Partially_Visible_Subcomponent (T);
+      P := Partially_Visible_Part (T);
 
       if Present (P) then
 
@@ -6814,7 +6814,7 @@ package body Sem_Ch3 is
          end if;
       end if;
 
-      Priv := Partially_Visible_Subcomponent (Element_Type);
+      Priv := Partially_Visible_Part (Element_Type);
 
       if Present (Priv) then
 
diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb
index 90de70d2568f..92b8f9a22b8a 100644
--- a/gcc/ada/sem_ch7.adb
+++ b/gcc/ada/sem_ch7.adb
@@ -697,7 +697,7 @@ package body Sem_Ch7 is
             if Is_Type (Id)
               and then (Is_Limited_Composite (Id)
                          or else Is_Private_Composite (Id))
-              and then No (Partially_Visible_Subcomponent (Id))
+              and then No (Partially_Visible_Part (Id))
             then
                Set_Is_Limited_Composite (Id, False);
                Set_Is_Private_Composite (Id, False);
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 2590e411f0c8..f53fe30da692 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -27004,10 +27004,8 @@ package body Sem_Util is
    -- Partially_Visible_Subcomponent --
    ------------------------------------
 
-   function Partially_Visible_Subcomponent
-     (Type_Id : Entity_Id) return Entity_Id
-   is
-      Ancestor  : constant Entity_Id := Base_Type (Type_Id);
+   function Partially_Visible_Part (Type_Id : Entity_Id) return Entity_Id is
+      Ancestor : constant Entity_Id := Base_Type (Type_Id);
 
       function Trace_Components
         (T     : Entity_Id;
@@ -27091,7 +27089,7 @@ package body Sem_Util is
 
    begin
       return Trace_Components (Type_Id, False);
-   end Partially_Visible_Subcomponent;
+   end Partially_Visible_Part;
 
    ----------------------
    -- Policy_In_Effect --
diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads
index df7296d527fc..6934bd42a707 100644
--- a/gcc/ada/sem_util.ads
+++ b/gcc/ada/sem_util.ads
@@ -3041,12 +3041,13 @@ package Sem_Util is
    --  of the corresponding formal entity, otherwise returns Empty. Also
    --  handles the case of references to renamings of formals.
 
-   function Partially_Visible_Subcomponent
-     (Type_Id : Entity_Id) return Entity_Id;
-   --  If there exist any subcomponents of Type_Id whose types are currently
-   --  only partially visible, returns one such subcomponent. Otherwise returns
-   --  Empty. Used to enforce the rules on visibility of operations on
-   --  composite types, that depend on the full view of the subcomponent types.
+   function Partially_Visible_Part (Type_Id : Entity_Id) return Entity_Id;
+   --  If Type_Id is currently only partially visible, return Type_Id.
+   --  Otherwise, if there exist any subcomponents of Type_Id whose types are
+   --  currently only partially visible, returns the type of one such
+   --  subcomponent. Otherwise returns Empty. Used to enforce the rules on
+   --  visibility of operations on composite types, that depend on the full
+   --  view of the subcomponent types.
    --
    --  We say that a type is "partially visible" when it has a partial view
    --  that is currently visible but no full view that is currently visible.

Reply via email to