From patchwork Tue Jun 2 08:44:49 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 136239 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E2AA24BA23D3 for ; Tue, 2 Jun 2026 08:51:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E2AA24BA23D3 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=Phi4VAQ0 X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by sourceware.org (Postfix) with ESMTPS id 7BFC14BA2E26 for ; Tue, 2 Jun 2026 08:45:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7BFC14BA2E26 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7BFC14BA2E26 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::331 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780389958; cv=none; b=GknLYQYsaDQ5TCPYPJNA4XBXJ6NPp4oXSGyrah9adAmBx17uYqL8z9WBZoj9YclxNxjqlWik7xPtAQ8ycJDsScpYonqN5qgYWZ8NXYlwcM5fkj1cSlhxSCwzcsoLUWlkM4borR6mpvOnGHjcBVcDKGi4MXgx5Feux4JEOosKI+4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780389958; c=relaxed/simple; bh=rSB8BvDlHXeUXnZGge3bow2RWFT5T47tm+ERwvDgjZg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=gsv0IyjyKSl3resV7BSV7IA5Gs+1XkGFEjMMKORQ4tmAU19NQYf2UV5f6O9xCmsAV05FeQ38YnAVDpl4Tc/o4twPOWZ68Sug0OeR6KC7PvFpvPeAo5OBOEPq3P8961Ak+3mBT8Id0HHRvImOcf2UpO9vlRneYadQuM2G881Ss/Y= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=Phi4VAQ0 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7BFC14BA2E26 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-490ace40f4bso18710425e9.3 for ; Tue, 02 Jun 2026 01:45:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1780389957; x=1780994757; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=GDFi7Qny/IQbJFIRhQWEodArcLXKTEK+VqllqaKMTGQ=; b=Phi4VAQ0udeFgFKMIjULeexqYauoiENKBD/TyNmSz7WzswIOQRnGlCa+GRWukS7Duk QIcatIpaymKgnACWEAiWnnXNZvO9vm5gkDgjkLolUepPbuG1rOr9M0e+/06WmIJ0diIS HKx9/0wPObUSSOl+7z1gCB4ebDETEb8mvCwzvx8VL9rqAXOPItReBOs07QOnHiDD85nq lB5hseBN9Wu9bLt99Ku3Q2qRJKY5ueNbx6TJ4JwHYFEcHp39HjlgUWk80PJggBiq/Lhl BlgZdzmyuhkV8NhhpsbuMuXBwR3rD4xanBK0mg+leAzjBsPRHizmW07biwgtfSlIMdHV UjuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780389957; x=1780994757; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=GDFi7Qny/IQbJFIRhQWEodArcLXKTEK+VqllqaKMTGQ=; b=ofm9TNZNvnUbGUKDhU2R3PMwziGNmow++NS7lIofWoBwmAS8AZJFK2fYNao1xg7KeG x0iGRBKqt5zZeDdKO6NELBXAHiRK25gCL3tN/u4/so7iOyiZFsRL6TiNe6g8MSyg98oY 4doeYJCtAxVJTg0i5d1j/QWx8zTKo6tB9cFa7K1J4Kbupbwkad+4tO+klgf8u6CV7RYu gCih+kWR+daw7puquVYf1zhqN0V7sHcK8q31x9YJNE+HizFEnznbGfBWSDSIHyA1lmHf 0lzoDQAsjSIjXUdrlVZxejXAggR/kIKp9W0oK5Sz0nbs+ClMBJdeBlyId15ZxNsHxLf3 K9Fw== X-Gm-Message-State: AOJu0YyU2j5ydXpXs47bIBu4IlwqsOe2Ayf8TOZ9wVb56XMzyU9GKVoP 6vK5q5q8cy2e/OUC7YzmLw8X+/yie506gI+G5P+q/fqWcMFwVPjQX1WnNEM0t5iygKDyI7pEjZc vy4U= X-Gm-Gg: Acq92OGHgUfbNboAtjeBPwUBI0oIc7mmHiQYXZGb3ka462D2w3D+BJepuYpCpDMn7XY oG9m4Mj01QzzxpOBxC3CqGzYUhSRhRRu4+0c4vRfZoUNY0cCe7RuVAxMrT7Jl01B3n3Dvn2BYcT 1lF7rouS0YuZ7zxbCsVhCmBn56D9EmfsRgV7NHPbplpAJpDwlv6NcHeqqdCA8ZiWjJFoKoCLyTP 9fHHdLR7HqA+9idM+Q7sckgF6pmg1HwN1FFWaQADTsMEg3mJvQUAE7rxrjGvcsEfv9XMvJ4f/PQ K0mEgQnaMgGyNMB9sYYv/zH/xBs118iBgD9qn8jbIuMJCV5q+z9E0+Y0cwO4dVQfgAjjSN4oOt7 Mn3WyRmObSBhht4sKFyqX0WUzT4tc91gsufhwBYlpfpx5NuEefTemtbSOd9r6Q5cNmX3lvo/TbJ Q+CEC62kkKCnrWl5IklqbVCnG0WIAMhsYKb1URvVIE8m8LnGVIIsOQMI19mLT03ERuy/pOHYUIG QvfOlTm5NUievLU23GAUBF1hJvZvuM= X-Received: by 2002:a05:600c:4703:b0:48f:d1b8:9ab1 with SMTP id 5b1f17b1804b1-490a2915af8mr285771625e9.9.1780389957351; Tue, 02 Jun 2026 01:45:57 -0700 (PDT) Received: from mecano.telnowedge.local (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490ab55d39csm33907625e9.35.2026.06.02.01.45.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jun 2026 01:45:56 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Ronan Desplanques Subject: [COMMITTED 01/51] ada: Rename Private_Component function Date: Tue, 2 Jun 2026 10:44:49 +0200 Message-ID: <20260602084541.3829876-1-poulhies@adacore.com> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_BLOCKED, RCVD_IN_PBL, SPF_HELO_NONE, SPF_PASS, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org From: Ronan Desplanques The expression "private component" is best reserved for components of protected objects' private sections. This renames a function from "Private_Component" to a more explicit name because that function is not about the protected object component case. gcc/ada/ChangeLog: * sem_util.ads, sem_util.adb (Private_Component): Rename into... (Partially_Visible_Subcomponent): ...this. * sem_ch3.adb (Analyze_Component_Declaration, Array_Type_Declaration): Adapt to above renaming. * sem_ch7.adb (Install_Composite_Operations): Likewise. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch3.adb | 4 ++-- gcc/ada/sem_ch7.adb | 2 +- gcc/ada/sem_util.adb | 12 +++++++----- gcc/ada/sem_util.ads | 15 +++++++++------ 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 612cf712fd5..7e28881aeb0 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 := Private_Component (T); + P := Partially_Visible_Subcomponent (T); if Present (P) then @@ -6814,7 +6814,7 @@ package body Sem_Ch3 is end if; end if; - Priv := Private_Component (Element_Type); + Priv := Partially_Visible_Subcomponent (Element_Type); if Present (Priv) then diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb index 1f2fe1622ef..90de70d2568 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 (Private_Component (Id)) + and then No (Partially_Visible_Subcomponent (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 863fd4d87b2..9348bf87d7f 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -27240,11 +27240,13 @@ package body Sem_Util is end if; end Predicate_Tests_On_Arguments; - ----------------------- - -- Private_Component -- - ----------------------- + ------------------------------------ + -- Partially_Visible_Subcomponent -- + ------------------------------------ - function Private_Component (Type_Id : Entity_Id) return Entity_Id is + function Partially_Visible_Subcomponent + (Type_Id : Entity_Id) return Entity_Id + is Ancestor : constant Entity_Id := Base_Type (Type_Id); function Trace_Components @@ -27329,7 +27331,7 @@ package body Sem_Util is begin return Trace_Components (Type_Id, False); - end Private_Component; + end Partially_Visible_Subcomponent; --------------------------- -- Primitive_Names_Match -- diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads index fc1845e0b49..9913e941036 100644 --- a/gcc/ada/sem_util.ads +++ b/gcc/ada/sem_util.ads @@ -3092,12 +3092,15 @@ package Sem_Util is -- with a special name to avoid being overridden (i.e. return true in case -- of entities with names "nameP" and "name" or vice versa). - function Private_Component (Type_Id : Entity_Id) return Entity_Id; - -- Returns some private component (if any) of the given Type_Id. - -- Used to enforce the rules on visibility of operations on composite - -- types, that depend on the full view of the component type. For a - -- record type there may be several such components, we just return - -- the first one. + 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. + -- + -- 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. procedure Process_End_Label (N : Node_Id;