From patchwork Thu Aug 1 15:17:27 2024 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: 1967872 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=UDRhTSX3; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WZYDb6rMCz1ybV for ; Fri, 2 Aug 2024 01:44:31 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 39058386484B for ; Thu, 1 Aug 2024 15:44:30 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by sourceware.org (Postfix) with ESMTPS id EDDF13858C78 for ; Thu, 1 Aug 2024 15:18:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EDDF13858C78 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 EDDF13858C78 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::432 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722525524; cv=none; b=sZ4BRvsTmGUW+nPAVdzG/E7u2H4mGuxjhVRvgNHx01HBFjc0+pPDCEHB8io5V0RkZh5xPNyBOMdDstamJbah8vva+YVEKVpKzfGZI/gUSBNszKEcujusTla2x3NL1hM0DMblPJnHsSVOfbxXjzZX81I/d/LMg9DsXZSSMJ4/dw0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722525524; c=relaxed/simple; bh=MkKiY+UxEJ6ezF75cNFEZw7gYIwMUPcs5pClPBRG3rc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=MXEnAAVuGpEPCiaenA62zMaFmqd/0vwzPMjdHF02J3dHlTkOoNMn8HZ+ppWgQ0VPuzDlN/bEBTU6P+Rq6X1fuLXxixYle1R6VI45WIxISmrzCbtSywNY249EMFJTkFWNgPVTmabv0coZPfF0vpw0fVFvr/ca2pszKXy8hq1yce4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-3687f8fcab5so3505027f8f.3 for ; Thu, 01 Aug 2024 08:18:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1722525505; x=1723130305; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=N3ZkjFcL/z9sINf04e1bxbOn470tL9/TkSmz2JVHJlI=; b=UDRhTSX3/SHyqp0dItqCEdYJpxeCdjJ7r9m8kj75nXmnkzpL16XhIuWmi7HJ/kOdiF JNPO+f45N/JRb9QuFOMYDgvy+V4vI1lmx2gDT/LUCLdVHlIIYk1JVGFDgdjf0XM441fY kl5oUHV8pfFE9heUKCoNQEAu8cysBqSTdppDZZmaNx9i7TgZ088YBZi1wjpPzmUJT69j L+6sEtUQipL9vkT2UKmVJeA4G+O3z9axyR1sm7iiemgLJ3/jrd6RGTrugW14d1XnFSbh 7oLAgQphAGHVL53Qf3IQ1p9/FLG/dp4Wh4daU0gMCwv1UAj+JQMOjIPysZ8+YuowXqpK j7jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722525505; x=1723130305; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=N3ZkjFcL/z9sINf04e1bxbOn470tL9/TkSmz2JVHJlI=; b=sOhQFcP5fe8HVU3td6Tb9C8nySre+CJHcjoFCcEKXsYEcZo0c9jA1XB4y3cT/qXwN8 Y9djg3NZlXy0Pf3zxZ+wSoSuX7dNQ0tEGNf0iF83Jx/WkabEgoFysF1Nf73ZbAwlUh98 sw50pLgJVfB27tdBjrclKu+ZH0x4bCfMGqDuXz481VEkKVb81S6AOkJW7a6Z+LIHPuTZ 7N4kfeaOjjbIoxzr1U4q+QzaRq+RJ3JxIlMYuzKW6FWjpgghUDWYFhWnOndWPAMatNyU AFj216/Rl0ybHO83XEe60Kvlm4uGsdDV5wvg/vmF+It45h7IRBo7MmQ/oGhcZAuSNePE rj2g== X-Gm-Message-State: AOJu0Ywp2a6W/DJqV8FvpNl7S4qmybbYozV8iCdkQXiJPwBwPo18vHzt D1mcGwlrCDdO2/O201oXL21gWLu2Pqazrw/Cc9VJgkpwWOmJkVyQSXURNlxYeEIjxlRC+4bcLP/ BEw== X-Google-Smtp-Source: AGHT+IEDYV/5v9ywDsQeExZcuJPn5Odln+iyKmR528weCcKHh8FCLr9uuF0VX3eMeYeWOnIxcFJHWw== X-Received: by 2002:a5d:494f:0:b0:36b:8f94:e206 with SMTP id ffacd0b85a97d-36bbc0a84e6mr164808f8f.5.1722525505531; Thu, 01 Aug 2024 08:18:25 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:b6aa:4751:9ea1:da1e]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36b36857fdesm20065995f8f.75.2024.08.01.08.18.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 08:18:25 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 19/30] ada: Define No_Return flag only for subprograms Date: Thu, 1 Aug 2024 17:17:27 +0200 Message-ID: <20240801151738.400796-19-poulhies@adacore.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240801151738.400796-1-poulhies@adacore.com> References: <20240801151738.400796-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 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 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~incoming=patchwork.ozlabs.org@gcc.gnu.org From: Eric Botcazou ...instead of defining it for all entities. gcc/ada/ * einfo.ads (No_Return): Change description and adjust accordingly. * gen_il-gen-gen_entities.adb (Entity_Kind): Remove No_Return. (Subprogram_Kind): Add No_Return. (Generic_Subprogram_Kind): Likewise. * sem_ch6.adb (Analyze_Return_Statement): Adjust No_Return test. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/einfo.ads | 6 +++--- gcc/ada/gen_il-gen-gen_entities.adb | 3 ++- gcc/ada/sem_ch6.adb | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads index e51ab691860..95f524e6c21 100644 --- a/gcc/ada/einfo.ads +++ b/gcc/ada/einfo.ads @@ -3799,8 +3799,8 @@ package Einfo is -- pragma No_Component_Reordering applies. -- No_Return --- Defined in all entities. Set for subprograms and generic subprograms --- to which a valid aspect or pragma No_Return applies. +-- Defined in subprograms and generic subprograms. Set if a valid aspect +-- or pragma No_Return applies. -- No_Strict_Aliasing [base type only] -- Defined in access types. Set to direct the backend to avoid any @@ -4969,7 +4969,6 @@ package Einfo is -- Materialize_Entity -- Needs_Debug_Info -- Never_Set_In_Source - -- No_Return -- Overlays_Constant -- Referenced -- Referenced_As_LHS @@ -5579,6 +5578,7 @@ package Einfo is -- Is_Visible_Lib_Unit -- Is_Wrapper -- Needs_No_Actuals + -- No_Return -- Requires_Overriding (non-generic case only) -- Return_Present -- Returns_By_Ref diff --git a/gcc/ada/gen_il-gen-gen_entities.adb b/gcc/ada/gen_il-gen-gen_entities.adb index 80b5925ebb8..2e0d51f6592 100644 --- a/gcc/ada/gen_il-gen-gen_entities.adb +++ b/gcc/ada/gen_il-gen-gen_entities.adb @@ -215,7 +215,6 @@ begin -- Gen_IL.Gen.Gen_Entities Sm (Needs_Activation_Record, Flag), Sm (Needs_Debug_Info, Flag), Sm (Never_Set_In_Source, Flag), - Sm (No_Return, Flag), Sm (Overlays_Constant, Flag), Sm (Prev_Entity, Node_Id), Sm (Referenced, Flag), @@ -985,6 +984,7 @@ begin -- Gen_IL.Gen.Gen_Entities Sm (Linker_Section_Pragma, Node_Id), Sm (Overridden_Operation, Node_Id), Sm (Protected_Body_Subprogram, Node_Id), + Sm (No_Return, Flag), Sm (Scope_Depth_Value, Unat), Sm (Static_Call_Helper, Node_Id), Sm (SPARK_Pragma, Node_Id), @@ -1193,6 +1193,7 @@ begin -- Gen_IL.Gen.Gen_Entities (Sm (Has_Out_Or_In_Out_Parameter, Flag), Sm (Is_Primitive, Flag), Sm (Next_Inlined_Subprogram, Node_Id), + Sm (No_Return, Flag), Sm (Overridden_Operation, Node_Id))); Cc (E_Generic_Function, Generic_Subprogram_Kind, diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 852055a3586..0988fad97e8 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -1937,8 +1937,8 @@ package body Sem_Ch6 is -- Check that pragma No_Return is obeyed. Don't complain about the -- implicitly-generated return that is placed at the end. - if No_Return (Scope_Id) - and then Kind in E_Procedure | E_Generic_Procedure + if Kind in E_Procedure | E_Generic_Procedure + and then No_Return (Scope_Id) and then Comes_From_Source (N) then Error_Msg_N