From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by sourceware.org (Postfix) with ESMTPS id 67EB13839DD1 for ; Thu, 6 Oct 2022 09:31:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 67EB13839DD1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-wr1-x429.google.com with SMTP id b4so1797731wrs.1 for ; Thu, 06 Oct 2022 02:31:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=IBAFuQYMm85hPNKykJSHrGZsp1/9fnSFdFvzzRjJS98=; b=aCTEySXhWb0M/aXNYX30ggpJzPqJTGE2sGFkq10t7qfBr0SdADrrXoUJKd+neu0/rr w1HcaCtTL9cnYqcdRh6TRCfyU6Ybz8fqt/vfmtZZ0YQ/aJ181fgPmo3IrPjSfWmntRD9 ZxRisKGI1EIgvd0PxmZDu+eRO0XP3moV7XzlFZg1AzKl2e9oYCrqm4OfoXtZHtJPXAxa t5HhI9IDwuGwlMDd+/I91Fs2Fc/J3EnwEVvzCYplCq8xa/kI9WH1HShUV83aAlsBd/59 LvSY4FDKD/DvXfOoqyLqlTw+2X32ZzqSgaRtviZsCS/3xyk5zd5e5O8p8ZJyCWJiCMpZ uIPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IBAFuQYMm85hPNKykJSHrGZsp1/9fnSFdFvzzRjJS98=; b=HEWt9TTNiqDRyCTPgvvcgnuuGollir9mNjaUSUB4eglORJf/OJYV8h6zfGqFKT0Tu+ KmpGdWb+TIlw/hSgcbGefQ9BHhSeDJGxOBtfRPXaFnOw4eCsqAaurTYrTFcYhfNsCJaf yQqguZGbQ4b++NYe1jwkDjkys5QoumLNjAJdUnG1bMuR0Dn++My6R7549mUpjfeRs6nw lK84LdyEdNieW5aoQAuWBc8+TNG693UT6EnVMDV7MG4SKYppyd1C1av7HdFPTHsIEOkf g5g/CUyz/Baxx8QCjPieBrx1LBgAsMaBGMliDAA5YL/6uBftHD5WqzDK1bgwF3QHOqtL mI4w== X-Gm-Message-State: ACrzQf1Lo0JwhMGnf8Wu70g/pz8T4f/po0ZFonGZMrMD87Z7YHapU/3T Mi9DWz5U2u4iQKI/LzSZg22jxpwHritGMdn3 X-Google-Smtp-Source: AMsMyM77nP9LXj2pzV+/SyvCtqzDlbzA+j3Tc9mJeSkOklmxscHNNovN8c6t9Ov+1gUnNhzZXYW0BA== X-Received: by 2002:adf:efc5:0:b0:22e:4a6:2d5b with SMTP id i5-20020adfefc5000000b0022e04a62d5bmr2476356wrp.293.1665048677166; Thu, 06 Oct 2022 02:31:17 -0700 (PDT) Received: from poulhies-Precision-5550.lan (static-176-191-105-132.ftth.abo.bbox.fr. [176.191.105.132]) by smtp.gmail.com with ESMTPSA id bh9-20020a05600005c900b0022ccbc7efb5sm17856233wrb.73.2022.10.06.02.31.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 02:31:16 -0700 (PDT) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITED] ada: Cleanup related to lock-free protected subprograms Date: Thu, 6 Oct 2022 11:31:12 +0200 Message-Id: <20221006093112.261959-1-poulhies@adacore.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Piotr Trojanek Cleanup code and documentation; semantics is unaffected. gcc/ada/ * doc/gnat_rm/implementation_defined_pragmas.rst (Lock_Free): Remove inconsistent periods that end item descriptions. * sem_ch9.adb (Allows_Lock_Free_Implementation): Remove unnecessary guard against an empty list of parameters; replace low-level entity kind membership test with a high-level query; refill error message. * gnat_rm.texi: Regenerate. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst | 6 +++--- gcc/ada/gnat_rm.texi | 6 +++--- gcc/ada/sem_ch9.adb | 8 +++----- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst b/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst index 53836c9fbcf..6752d48d159 100644 --- a/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst +++ b/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst @@ -3744,10 +3744,10 @@ In addition, each protected subprogram body must satisfy: * May reference only one protected component * May not reference nonconstant entities outside the protected subprogram - scope. + scope * May not contain address representation items, allocators, or quantified - expressions. -* May not contain delay, goto, loop, or procedure-call statements. + expressions +* May not contain delay, goto, loop, or procedure-call statements * May not contain exported and imported entities * May not dereferenced access values * Function calls and attribute references must be static diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index e13dba037ff..e79cdeeacfe 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -5243,14 +5243,14 @@ May reference only one protected component @item May not reference nonconstant entities outside the protected subprogram -scope. +scope @item May not contain address representation items, allocators, or quantified -expressions. +expressions @item -May not contain delay, goto, loop, or procedure-call statements. +May not contain delay, goto, loop, or procedure-call statements @item May not contain exported and imported entities diff --git a/gcc/ada/sem_ch9.adb b/gcc/ada/sem_ch9.adb index cae0f233c52..6506358a02b 100644 --- a/gcc/ada/sem_ch9.adb +++ b/gcc/ada/sem_ch9.adb @@ -178,8 +178,6 @@ package body Sem_Ch9 is elsif Nkind (Decl) = N_Subprogram_Declaration and then Nkind (Specification (Decl)) = N_Procedure_Specification - and then - Present (Parameter_Specifications (Specification (Decl))) then declare Par_Specs : constant List_Id := @@ -477,7 +475,7 @@ package body Sem_Ch9 is -- Prohibit references to non-constant entities -- outside the protected subprogram scope. - if Ekind (Id) in Assignable_Kind + if Is_Assignable (Id) and then not Scope_Within_Or_Same (Scope (Id), Sub_Id) and then not @@ -487,8 +485,8 @@ package body Sem_Ch9 is then if Lock_Free_Given then Error_Msg_NE - ("reference to global variable& not " & - "allowed", N, Id); + ("reference to global variable& not allowed", + N, Id); return Skip; end if; -- 2.34.1