From patchwork Tue Nov 21 10:00:25 2023 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: 80438 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 86D8A3858299 for ; Tue, 21 Nov 2023 10:01:48 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id 88E7038582A3 for ; Tue, 21 Nov 2023 10:00:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 88E7038582A3 Authentication-Results: sourceware.org; dmarc=pass (p=none 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 88E7038582A3 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::436 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700560833; cv=none; b=IpYKV1AQ+dCvkG5Lh4izuJ0sshY6idpJo2F8X98rnkcXHUoVOZLdT9Y/UWgG975B6H87JxWqiTMinl7PLJkvP6786y0TMekzPiBgBXl1YRCyLLfWfOuxOWrbehLhvdi4DoeqQyi/nrBKCxW5UyoMmUQDa9wvYVshpZHSX9X/k30= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700560833; c=relaxed/simple; bh=Idtw+nJalVKd6zMVYX8Y0o5oaBzvcesYpxvp3y2nOFk=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=luMKc64UFSU4Ardh/rIGJNYMnM4Cz0XJOQBZhSQFXmkz+YJOFgHY+X18igU980LEhPQo8JSorTAdCgaS9hgDOzAPAnw+cVuLFYfUOphraZne8eDtVHQTwhmoWXNZFYICsfXgUQK5yAmpWqEIiV/BtroFSYC4GFN5QO2UnlPkk80= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-32fadd4ad09so3973901f8f.1 for ; Tue, 21 Nov 2023 02:00:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1700560827; x=1701165627; 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=GlmvFDZBjJdHLi2om8HoqxkBRZzxUOJr/HBRbMrfgr8=; b=WS2r5nNWSCTzoOmUk1j1ni7iokJwgbVBjeuDCx7pWSd/Je/KTfrb34M4YAmlkhjGnn 5Rc+Ki2uId00J40dBI6kCYTQmFr/+eByiyXoCi6/vGmrw0zTjED88wpfVpYH9G6UeZ05 QMQvdqbn4ovECxf9QHY3fZRCz9u1BLbEooTaL+VcsNoVHtbzbNoyRySqZ1d5USc9owcr VVg/iCtBi1MlaIhz4KNJOVkJtfCUnbtMygJSct78srmmmTQ9Lbxnu47yCTwgpqQ1qiyS wOgUUCqAiU4Bkez/joxeUfbYxs5QIptlloHBV+xMrwNwcgwAhOEwx/Y0aJZXJwN0AQga hQjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700560827; x=1701165627; 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=GlmvFDZBjJdHLi2om8HoqxkBRZzxUOJr/HBRbMrfgr8=; b=d09cN6j6UIl8bfJC3xZH3tOxyQN4vkcv8qo5xQ7YNLXMXgTW6ubRzF+bCTe++/hIz+ 5zT2+oicbRUE6suomKt0NKYkCSc/yOOszJL6qfpxWYEP147xERCxTC7+p+k5d9VZEq4N Cm0xMb2RwrEqAuoW1eibdVVny3gb8sllg3TnnzDZ1jDNWyExGjyFPpPxhM3HKEJqNHS/ FCRbWXRW9nZ8SIGzzuPBPkRVAZs76OUJz8bFtZz7uDL6UcIWm32ZYM/LCbox8nvsgQWi Re2jncXG0ikjRlD9M2DApjr9101QxihIFW35J3SvIW0LcQb8BEkNuzaYS3lpDR53obnI VLDg== X-Gm-Message-State: AOJu0Yy/pLGLQkEX8jX30NgOQkL+zQVGxfCjnO4znMLmXDLTo7z3KGJt GwEGI6riGA9Gv1p3o70yUAkUMC5sc1zObsRVEhXPnw== X-Google-Smtp-Source: AGHT+IHIb7rrI4N+8508wd9lPYdgd1uX5g8gx3PYLaRrXDjYLcW4yV0iz3aqh8HXsWwJaxrX7JRFHQ== X-Received: by 2002:a05:6000:186d:b0:32d:a54a:f57c with SMTP id d13-20020a056000186d00b0032da54af57cmr8441622wri.25.1700560827232; Tue, 21 Nov 2023 02:00:27 -0800 (PST) Received: from poulhies-Precision-5550.telnowedge.local (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id v9-20020a5d5909000000b0032f9688ea48sm13946785wrd.10.2023.11.21.02.00.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 02:00:26 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED] ada: Small cleanup in finalization machinery Date: Tue, 21 Nov 2023 11:00:25 +0100 Message-ID: <20231121100025.1964259-1-poulhies@adacore.com> X-Mailer: git-send-email 2.42.0 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, 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.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: Eric Botcazou This removes an obsolete flag and adjusts a couple of obsolete comments. gcc/ada/ * gen_il-fields.ads (Opt_Field_Enum): Remove Is_Finalization_Wrapper * gen_il-gen-gen_nodes.adb (N_Block_Statement): Likewise. * sinfo.ads (Is_Finalization_Wrapper): Delete. * exp_ch7.adb (Build_Finalizer.Process_Declarations): Adjust comment and remove obsolete code testing the Is_Finalization_Wrapper flag. * exp_util.adb (Requires_Cleanup_Actions): Likewise. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_ch7.adb | 20 ++------------------ gcc/ada/exp_util.adb | 24 ++++++------------------ gcc/ada/gen_il-fields.ads | 1 - gcc/ada/gen_il-gen-gen_nodes.adb | 1 - gcc/ada/sinfo.ads | 7 ------- 5 files changed, 8 insertions(+), 45 deletions(-) diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb index 369f0b07999..2e3da4cfaed 100644 --- a/gcc/ada/exp_ch7.adb +++ b/gcc/ada/exp_ch7.adb @@ -2248,8 +2248,8 @@ package body Exp_Ch7 is -- Finalization of transient objects are treated separately in -- order to handle sensitive cases. These include: - -- * Aggregate expansion - -- * If, case, and expression with actions expansion + -- * Conditional expressions + -- * Expressions with actions -- * Transient scopes -- If one of those contexts has marked the transient object as @@ -2508,22 +2508,6 @@ package body Exp_Ch7 is then Last_Top_Level_Ctrl_Construct := Decl; end if; - - -- Handle the case where the original context has been wrapped in - -- a block to avoid interference between exception handlers and - -- At_End handlers. Treat the block as transparent and process its - -- contents. - - elsif Nkind (Decl) = N_Block_Statement - and then Is_Finalization_Wrapper (Decl) - then - if Present (Handled_Statement_Sequence (Decl)) then - Process_Declarations - (Statements (Handled_Statement_Sequence (Decl)), - Preprocess); - end if; - - Process_Declarations (Declarations (Decl), Preprocess); end if; Prev_Non_Pragma (Decl); diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 730889cae3e..3b34e4659f1 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -13023,8 +13023,8 @@ package body Exp_Util is -- Finalization of transient objects are treated separately in -- order to handle sensitive cases. These include: - -- * Aggregate expansion - -- * If, case, and expression with actions expansion + -- * Conditional expressions + -- * Expressions with actions -- * Transient scopes -- If one of those contexts has marked the transient object as @@ -13234,23 +13234,11 @@ package body Exp_Util is return True; end if; - elsif Nkind (Decl) = N_Block_Statement - and then - - -- Handle a rare case caused by a controlled transient object - -- created as part of a record init proc. The variable is wrapped - -- in a block, but the block is not associated with a transient - -- scope. - - (Inside_Init_Proc + -- Handle a rare case caused by a controlled transient object created + -- as part of a record init proc. The variable is wrapped in a block, + -- but the block is not associated with a transient scope. - -- Handle the case where the original context has been wrapped in - -- a block to avoid interference between exception handlers and - -- At_End handlers. Treat the block as transparent and process its - -- contents. - - or else Is_Finalization_Wrapper (Decl)) - then + elsif Nkind (Decl) = N_Block_Statement and then Inside_Init_Proc then if Requires_Cleanup_Actions (Decl, Lib_Level) then return True; end if; diff --git a/gcc/ada/gen_il-fields.ads b/gcc/ada/gen_il-fields.ads index a0bfb398ebb..c565e19701d 100644 --- a/gcc/ada/gen_il-fields.ads +++ b/gcc/ada/gen_il-fields.ads @@ -255,7 +255,6 @@ package Gen_IL.Fields is Is_Entry_Barrier_Function, Is_Expanded_Build_In_Place_Call, Is_Expanded_Contract, - Is_Finalization_Wrapper, Is_Folded_In_Parser, Is_Generic_Contract_Pragma, Is_Homogeneous_Aggregate, diff --git a/gcc/ada/gen_il-gen-gen_nodes.adb b/gcc/ada/gen_il-gen-gen_nodes.adb index 996d8d78aea..087f78567f4 100644 --- a/gcc/ada/gen_il-gen-gen_nodes.adb +++ b/gcc/ada/gen_il-gen-gen_nodes.adb @@ -1029,7 +1029,6 @@ begin -- Gen_IL.Gen.Gen_Nodes Sm (Cleanup_Actions, List_Id), Sm (Exception_Junk, Flag), Sm (Is_Abort_Block, Flag), - Sm (Is_Finalization_Wrapper, Flag), Sm (Is_Initialization_Block, Flag), Sm (Is_Task_Master, Flag))); diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads index 8f962601985..1a6317054cf 100644 --- a/gcc/ada/sinfo.ads +++ b/gcc/ada/sinfo.ads @@ -1723,12 +1723,6 @@ package Sinfo is -- Present in N_Contract nodes. Set if the contract has already undergone -- expansion activities. - -- Is_Finalization_Wrapper - -- This flag is present in N_Block_Statement nodes. It is set when the - -- block acts as a wrapper of a handled construct which has controlled - -- objects. The wrapper prevents interference between exception handlers - -- and At_End handlers. - -- Is_Generic_Contract_Pragma -- This flag is present in N_Pragma nodes. It is set when the pragma is -- a source construct, applies to a generic unit or its body, and denotes @@ -5238,7 +5232,6 @@ package Sinfo is -- Is_Task_Allocation_Block -- Exception_Junk -- Is_Abort_Block - -- Is_Finalization_Wrapper -- Is_Initialization_Block -- Is_Task_Master -- At_End_Proc (set to Empty if no clean up procedure)