From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by sourceware.org (Postfix) with ESMTPS id 8A5C6385AE65 for ; Tue, 12 Jul 2022 12:25:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8A5C6385AE65 Received: by mail-ej1-x633.google.com with SMTP id ez10so13963555ejc.13 for ; Tue, 12 Jul 2022 05:25:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=0gbpdaoJDwS9SrSB8qmZ8hNz69RcNuxmhVbRtspJOvg=; b=dVcm/gHdaCpnCR+U242uBXea1lPM1NiJe/6/zz4XhkmIHdjkfTfLgMag29qh/bP17Q aQ6e4v7bUhuVj0CEGSdrumffjQUA109glESjQ5/4P1UDLrB5D3+A8x9HV/Wqn76uIJz5 s3BlipcN/yYtBXikMNphvPiUJF6RczO/8UGX0eHhS7/DzQPBwdfT8xJtGm/HWfkWnWTS nbiqZPsisCpuSaipa/adjZStZ01/6d6n5deIbyjdGT9pLDDMk+I2C8Hf3ne9JA8OdV0W yom5uaSb6cD/MvnYqRNbEKBPjq9GA0yVwccl8oBJ/Pwwq1QcqnNUD3cdjR128NFBte5q x9+w== X-Gm-Message-State: AJIora/cHl606/3NTNiI0zWeAHlwInID50a6kbY+qA6h67fTEGJb1BoV D13D+VpFjjKvLsjqlFSljoQ9WU2dW8kLmg== X-Google-Smtp-Source: AGRyM1trgrDNbPkvOAIQMaiI8ZvSf1DfiboTvVT+SvkChivnWnHZmkcmeUtLcdoFFFeq2sfBFpVchA== X-Received: by 2002:a17:907:2ccc:b0:72b:6907:fce6 with SMTP id hg12-20020a1709072ccc00b0072b6907fce6mr6840167ejc.115.1657628717056; Tue, 12 Jul 2022 05:25:17 -0700 (PDT) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id fd9-20020a1709072a0900b006fed062c68esm3724064ejc.182.2022.07.12.05.25.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jul 2022 05:25:16 -0700 (PDT) Date: Tue, 12 Jul 2022 12:25:15 +0000 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [Ada] Accept aspect Yield on subprogram bodies acting as specs Message-ID: <20220712122515.GA3404669@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="VS++wcV0S1rZb1Fb" Content-Disposition: inline X-Spam-Status: No, score=-13.2 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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2022 12:25:18 -0000 --VS++wcV0S1rZb1Fb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline A small fix for the aspect Yield defined in AI12-0279 for Ada 2022, to accept aspect given for a subprogram body which acts as its own spec. For example: procedure Switch with Yield => True is begin ... end Switch; Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch13.adb (Analyze_Aspect_Yield): Look at the entity kind, not at the declaration kind. --VS++wcV0S1rZb1Fb Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="patch.diff" diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -2724,13 +2724,11 @@ package body Sem_Ch13 is Expr_Value : Boolean := False; begin - -- Check valid declarations for 'Yield + -- Check valid entity for 'Yield - if Nkind (N) in N_Abstract_Subprogram_Declaration - | N_Entry_Declaration - | N_Generic_Subprogram_Declaration - | N_Subprogram_Declaration - | N_Formal_Subprogram_Declaration + if (Is_Subprogram (E) + or else Is_Generic_Subprogram (E) + or else Is_Entry (E)) and then not Within_Protected_Type (E) then null; --VS++wcV0S1rZb1Fb--