From patchwork Tue Jan 7 12:53:19 2025 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: 104237 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 537AF385DDF2 for ; Tue, 7 Jan 2025 13:03:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 537AF385DDF2 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=EbF8bBqI X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by sourceware.org (Postfix) with ESMTPS id 8283B3857022 for ; Tue, 7 Jan 2025 12:54:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8283B3857022 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 8283B3857022 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::336 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254448; cv=none; b=HHYVqps0Vg0sAIPoCFAYC2egng4CqZsvkg4pBpslHsxGRbZYX5gfwteIu7ySAH30rhYkjJIEAO43jcs1cTadmIgu+P4FOW5QGCcEiLcYg2+Oenks0qAvPB13ZTMVm7lQwri0FHZ9VWffey9bJSJMHFgKuEcwzdK8tDhGZNDFzbw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254448; c=relaxed/simple; bh=5vvp+Sc2u645ItOYQYuofpsa6urGZG6Sr6DPd2YNiMY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=CKOtD2/KBVl59eWDkKLmHlQg+vejxe1KvJgkExdBor0Ox4kxNkNvm9LESuSW2NZawd9aNX84buD7pyzydRcI58mLmgZYJDGhbhfvlqMLKArjCx9752kzqwpsqzOHSVSITmQ693G/jlqBG5JSCEaKrVO4dZa1VaHjfa9Vy4T794w= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8283B3857022 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4361b0ec57aso154039505e9.0 for ; Tue, 07 Jan 2025 04:54:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1736254447; x=1736859247; 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=d0WMftl2Rf1MzgU3wGuu6onqGVZwEUzs5aV6mvGRZ6Y=; b=EbF8bBqIXrZNoDpk+TzTJD6ObjYap1uu1G35+EkVJxfFHAKYPAiBe2LJnIxKzEBAUk G47nubChHmG7kx3vy1DqYOwgM25b67tk2KJB47QqSeWxThMNnY3G79LhiwP1nvEefRdx RM/Zt87brZZTTxzbRb/QbpsPGBDl2767STHmgWr4fNEBWspQaJbxj6V/LYDFU7GQT/HV RPyx9m6JLISop7GyqH/LnkwA4pvutqj/AlCtc/GFPvPWguqW4DGrHAwlfj3aSjwiHLAg wd7dGv7K/YfbZQOOGnnJ6zlhXKfQImFSbQCAuXhzgWR6yq31DK6/Dq5/hm9okC2/uYns lkEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736254447; x=1736859247; 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=d0WMftl2Rf1MzgU3wGuu6onqGVZwEUzs5aV6mvGRZ6Y=; b=HgmKmxyNxVHVn6DNLVHFM/CIxBX6u10IKBcDhiBROgl4nLGoqs4Q32aYIl9/g5Djoz cA8hp2Ubfa5WWEmU4CdO8tpwcgs+MMiLaPlPaZuVMg3U0o1IE0IOtYLfbOw7If2Mby9H wC2wGO5+VUUoCsUvubEQe87Gi+4XNCb0+RgdaLBwOy7bBOvyX6l4vhqj4iWcNtlTU5HS /06frfzsxLs/odyuTUgXuHHI81mApVSsWFc1KzE5He/1Jjziw9IlkLimTBjifW8nSS20 KW4oE4SvmSYSscxsh1PN4D4rZO+skwqC+2kclQncwhl04bT5kCqjnO34Mokc0RP5umRH neDA== X-Gm-Message-State: AOJu0Yx2ioguRSKTRJ6+gcVo4ApZd79CO0ugmsNjjf4YUxEP1UyFZNIu 7g7VEHd0GuwYsUP5Ld+ywczr35xSYLHBxBD4rnliCv2Z/vZCld/5s0gTjDCbaCvqjV66c6dlJCE = X-Gm-Gg: ASbGncuel24h0LLLNqoqkXK7g5CVJwM/IMJbZyASAhV8TMazY7f23kofmkE0DVF88UJ PuOiznkYVWlURps3Wg4HNf72Pnk4zcdm+bvQXH/9zXOMMHeAg7ZiqzNZYqlExzff8sz8B5XmLn/ dnn/mS92clunFIPmwYPV8xWk+8QQvuRD/DOCiWnRDzp86ipvwTuVDJ658CY5umLpM2/OWv++kGo /fvRql+ztxGFawXhqmPhT4TecxwCeSWKAbACF9KtF7ExlF2xY0zt7PYlP/XMLI6x1bTfi176+AG zBD6YE5m2wfBUlYzmBR9PIoa5qyxzGG/qmKEgM+a4PWgaGEM1+Wjy0OWuz/rrRg74IW+4HNo X-Google-Smtp-Source: AGHT+IEOkqq1+P83bj/vxHHnQMTQKREfGBNHWPGKLRK+1vs9E3nLHsv9MTUp2UJhB8PrpasMlp+mlw== X-Received: by 2002:a05:600c:35d2:b0:435:d22:9c9e with SMTP id 5b1f17b1804b1-43668646335mr529085845e9.19.1736254447109; Tue, 07 Jan 2025 04:54:07 -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 5b1f17b1804b1-43656af6c42sm631014805e9.9.2025.01.07.04.54.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 04:54:06 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 01/31] ada: Restrict previous change made to expansion of allocators Date: Tue, 7 Jan 2025 13:53:19 +0100 Message-ID: <20250107125350.619654-1-poulhies@adacore.com> X-Mailer: git-send-email 2.43.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 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 There is no need to build a cleanup if exceptions cannot be propagated. gcc/ada/ChangeLog: * exp_ch4.adb (Expand_Allocator_Expression): Do not build a cleanup if restriction No_Exception_Propagation is active. * exp_ch6.adb (Make_Build_In_Place_Call_In_Allocator): Likewise. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_ch4.adb | 1 + gcc/ada/exp_ch6.adb | 1 + 2 files changed, 2 insertions(+) diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 75d79019f80..6e8c5c83da5 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -636,6 +636,7 @@ package body Exp_Ch4 is and then Nkind (Exp) = N_Function_Call and then not (Is_Entity_Name (Name (Exp)) and then No_Raise (Entity (Name (Exp)))) + and then not Restriction_Active (No_Exception_Propagation) and then RTE_Available (RE_Free) and then not Debug_Flag_QQ); -- Return True if a cleanup needs to be built to deallocate the memory diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index a339a223f09..37184fd28eb 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -8505,6 +8505,7 @@ package body Exp_Ch6 is and then not For_Special_Return_Object (Allocator) and then not (Is_Entity_Name (Name (Func_Call)) and then No_Raise (Entity (Name (Func_Call)))) + and then not Restriction_Active (No_Exception_Propagation) and then RTE_Available (RE_Free) and then not Debug_Flag_QQ then From patchwork Tue Jan 7 12:53:20 2025 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: 104234 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 805E4385DC0D for ; Tue, 7 Jan 2025 12:58:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 805E4385DC0D 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=K0fQurnl X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by sourceware.org (Postfix) with ESMTPS id 04D8F385609E for ; Tue, 7 Jan 2025 12:54:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 04D8F385609E 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 04D8F385609E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::330 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254450; cv=none; b=d2F8j/iH5ObTqRyYBsA0aMpIovWEMLpnQ5/x+Od6KsU8cfpjgqvDBPv8obTx/aJg2pICUfI1sBPGyM3U8Y8hu8kiGGi7Dxclf370x2I/+LPn7iZNYwDmtiA3Nw4szVAejeXQbd0VxDNlo7jO6MZPbFK5Rr6tTMV9/jPFAs9D+os= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254450; c=relaxed/simple; bh=zWaF2rkJprjO9b+mLrf4f54OdJW0Q2AOSzZrY+9t77Y=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=FHudBaRh/J0uYLRSQQBPLxUQWbe7LZm+zr4nVnWyqG9zvC0I5HsMC2E9ZNvHq1qzW1HmM86CfDrco9+TG+0NBeX8G4Z00lMR3gUfGzwSzB72gF3CTZ2rkfiw5i2XSosufiyGBw1jESreANlHkfiZmwAi7RZwPGWABXQFPqqBEeM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 04D8F385609E Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-43624b2d453so159551365e9.2 for ; Tue, 07 Jan 2025 04:54:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1736254448; x=1736859248; 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=Al5HCkn8XpBle0fXvdYBnhC8N3wCu5V9dEgL1w8n/NM=; b=K0fQurnl9bnlvc+XxK426xycVQc7djoUO1XvEguc/OuKWraNpLfwlUvPtb2ZAgIPMo r1EWm5cFq1R0TVFNk+hrEVFSTgioOiy+pb7WTx2NPFHrzq5WRMB6f0GV6RE2kPLmtk+9 bsJVGz4hgshAdWu3ZNIHrAc7kMz3RTweDdwqyQ35vYx/GVwm/eQZ0gaQ9JaxhPgk9ygk 3El9n0Lei056JArjZLVqNssrGOF8Y9gJyZmggGRotRovIMMGgwLmyDf4Dcs2AS6MN6Sg Q2ba6k+6q784+9mF+XuUCfpZFyLeV4Wi2tPEBQKOquswfa/MdUKLM9bXoI3e6BEZl+yx ArzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736254449; x=1736859249; 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=Al5HCkn8XpBle0fXvdYBnhC8N3wCu5V9dEgL1w8n/NM=; b=t4IsK/wIfh39TMaFoOnox1YsHu1jEeW1vNhuKvgK/sIkfYFRlbTHeY6HY8xbZElRt0 uyoYCYrPZAwgfjHB8GlkUMc3fRAV7nsVYDm6Ub/K3v+QXHLvEZobecjkiGS4+LJ84qs+ WvZHK0qSDfku20mp1lVPoOhrZt9QKxFdbs+pVNsFcC6X8FEmKY1hYmX83MO5ggp06wub BKkJ9+meFrwcrU/BVB6TzAH3GsZ8zk5CnrnvelzLNZsDXfWMaqVNlw69bIxIXbb4IkYW Y/doRvupRpRGiL2Fv6MyqJWxVm38gR5ftA+JK1As2L29wXIVL287YmaoaP3/mZRGCRMM SRJQ== X-Gm-Message-State: AOJu0Yyaq03NrSpQPF/0IROQ6djltHfiEOHx7yILwItDL0+ifOwBrhsA gaREzXTRHcFsQuYIOS77O9dt3lq49/u12RRojIVol/Augg2urZINn/tEGzbB7xvktOgGfZeTFmc = X-Gm-Gg: ASbGnctKJjBb/vbjly/JxfioYhqd5DsF0iSolMpsoobsK4DLBhrXa6cceXOrvNs3v47 hP6e5KO3YQAWycgu1ahRVdazyzlOO2FHzGI6tWuu98Ozh4ftxyll8z1XFHByyKTCBdZmBUcstWh e6RPaSNN39a1+gIfnlB8xTSIKJT3TaASoKi6H2EJiB4vH1cJ1NCiVWN/RrcE+s9y9kbQnX9UalR NmxpgO4w5q2hH0G2z3kLCvpTMOlreSlndZa+vHHiWtINNfy/6s3xBzKQhr7owEsD5JqLqc+6nRm /vUwO6m0zeXdy2CeukSzr1UqlL3pz0zHWxoqGOo74SfnMKeetHNOcCiuopKKxD1wjG1Hac3H X-Google-Smtp-Source: AGHT+IE4wk+TI/g2vCtICaKvZjcOCSSQDHYQIP7Q/Kn0liz8AQWu00vossGbra2cGP13f6aez9twKQ== X-Received: by 2002:a05:600c:474d:b0:436:18d0:aa6e with SMTP id 5b1f17b1804b1-4366835c14fmr528721655e9.5.1736254448648; Tue, 07 Jan 2025 04:54:08 -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 5b1f17b1804b1-43656af6c42sm631014805e9.9.2025.01.07.04.54.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 04:54:07 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Johannes Kanig Subject: [COMMITTED 02/31] ada: Preserve Warning_Doc_Switch in gnatprove invocation Date: Tue, 7 Jan 2025 13:53:20 +0100 Message-ID: <20250107125350.619654-2-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250107125350.619654-1-poulhies@adacore.com> References: <20250107125350.619654-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~patchwork=sourceware.org@gcc.gnu.org From: Johannes Kanig When invoked by gnat2why, the Warning_Doc_Switch was unintenionally reset. gcc/ada/ChangeLog: * gnat1drv.adb: (SPARK_Library_Warning): preserve Warning_Doc_Switch Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gnat1drv.adb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb index 120de4afb71..39aa89c43a3 100644 --- a/gcc/ada/gnat1drv.adb +++ b/gcc/ada/gnat1drv.adb @@ -523,6 +523,8 @@ procedure Gnat1drv is Restore_Warnings ((Warnings_Package.Elab_Warnings => True, Warnings_Package.Warn_On_Suspicious_Contract => True, + Warnings_Package.Warning_Doc_Switch => + Warnsw.Warning_Doc_Switch, others => False)); -- Suppress the generation of name tables for enumerations, which are From patchwork Tue Jan 7 12:53:21 2025 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: 104239 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 50FFB385EC41 for ; Tue, 7 Jan 2025 13:05:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 50FFB385EC41 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=Nz1dltqz X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by sourceware.org (Postfix) with ESMTPS id AE79838560A8 for ; Tue, 7 Jan 2025 12:54:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AE79838560A8 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 AE79838560A8 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254451; cv=none; b=atM7Lj9zK80YkKMR+WxYQcRNHSFk0bG200NrAoZUwUa7JQyMbgjSOGRkTCGIgcl4wj6xC+I+m+R+bo/joYxHmk7vRpakmdrVqz6I0Qo268Y79FpzNImlsO6DqaUGZUwuTZL5HbWVsZhZzhpor+zqNXxyvFNl/lpskf5I8rWk98w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254451; c=relaxed/simple; bh=NCQAv82jbzWfSp6OOM3mN3EtGLwXYFnS1FelfH6HADs=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=vCIWu1vpyhWtZRPwNgX/HK3Z8yy1iB53lx5p58hGzhUsDf1nruBFWQZg0pHQOkjWNnWjLEI4xkyObjlgiUMwHrj5BMyMFbp1ANqTjdb2Gk5/U3JvDmXuLM6TbrDgo5r4dsxpenA3hxE5frIcf82iO6/Y7YSL7p4bsK5ieAehc9g= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AE79838560A8 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-4361e89b6daso106781895e9.3 for ; Tue, 07 Jan 2025 04:54:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1736254449; x=1736859249; 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=wlEidZxC3KhEwQLBSXhcjWtuJF/xp0eGkL8QPbDBRLs=; b=Nz1dltqzqbAEYPMuwMBSI1EjUrB2inbvF8hb87cDFgsuVit2E9hO7VcN+rjQmVj8WG IOF09SY4eQ0PXnKrhTGXY0qyYxemL4rBsN6da17LWovY0fR9XH6kBlcwM2eefH2R9CUW qjyQAL975oDpYXCVG/JqOnJWHYRKPmnyihYL3zIF85/pmh72ra1AeKDvwRYdiFUfg2Yl As/wtVG5u56f1YVB3BmM9qB2U/gc9ia90cJx0BOApDiYLbjZv0EKRrxmIqksc28A2IT7 v5qryGErBdPfLs4mLzeC+6wvz+lmfxJYos78xtNdVweR4Bky8RPRlCORoB6eLI3PE85i AsYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736254449; x=1736859249; 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=wlEidZxC3KhEwQLBSXhcjWtuJF/xp0eGkL8QPbDBRLs=; b=vZ4c2W+LdgLo8+PIqwwAx125vta66uf4Pbo5nDorTfa2PXO/sQSkiRhC6zHfksm1jj 1HVHV4npCbFQNps46a+FomPCEQBmAKJuwNtLhjCtoUl4YRec9E+GnfKjfrVZ/j5H7dQ7 UEhxjfdp6Tacy8RfM1l7gdFi5gae9QFFzsyjCkoWhAL3xj4mpGhfd78oejfN4O9yRXhU jttkmNxKPOSQXS46jJwDcZz0Gtnc5nNRj6gj+sHr/yJCbhmCCcRy6XOm27bPswNn7VDe /x4fcZh0gQWits1TEq22gYJyr6JX4nuL6oGs5r0jiiMibO0Z/6XWHRzSlVAqTLtjmi3Z hSNw== X-Gm-Message-State: AOJu0YxU+NXZfU8gy3wsXOz4TNY8rA30TK+sayVm3OEsZsAbzW7iotWH 5EWW0W1X+jgkJRHoByfpuxHnYFg0WCQDzWfyjM0qh17ZB6L41ezwD6ysTpwSSAuyfH/tqpdMQw0 = X-Gm-Gg: ASbGnctaarD+bmAZONeNL42jxWD0FN9s7LW5wC8GEhIakSKUpA7WW5Juyp8jmgqfQip 4FqCW8ZfJVEa2frrly8ezPmxjAUvaJJaLKv9tcC7nL5/r+O/A7o9dAb+1Sz5IhwopBoMTrY6q3j o+4JeCIOoBsKUeNe3Uo0yQpuFYyjT4cQMEYMlGw00yhTnCusk97ogv2lD4twB7mfn7B1v9Hgbit Gev5O0iwLMm0g9EavGG4xvwXTkiTQkUaXrKB2oOT8ifwEAsW7p0ONtN2TbW8V+SYxbhUbIf1HEe GLLjrkkHGP0GF+WULGVsT2zWSaKtmlV8JbbnSP/cQonqfrrmbPIk6heLZg1d6y7QxbRxNY01 X-Google-Smtp-Source: AGHT+IHLf6RB9G4LTwN6D5P7+IseuqtKl+KEe/YuNEJ/9oj7DJ0fElVAoOmgzbmfgaAGBr+Hq9nmaA== X-Received: by 2002:a05:600c:4691:b0:434:9c1b:b36a with SMTP id 5b1f17b1804b1-436cf8e3b67mr107316915e9.13.1736254449334; Tue, 07 Jan 2025 04:54:09 -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 5b1f17b1804b1-43656af6c42sm631014805e9.9.2025.01.07.04.54.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 04:54:08 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 03/31] ada: Use the syntax of Ada 2012 if-expression in -gnatR3 output Date: Tue, 7 Jan 2025 13:53:21 +0100 Message-ID: <20250107125350.619654-3-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250107125350.619654-1-poulhies@adacore.com> References: <20250107125350.619654-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~patchwork=sourceware.org@gcc.gnu.org From: Eric Botcazou This uses the syntax of Ada 2012 if-expression in the output produced by the -gnatR3 switch for dynamic expressions. gcc/ada/ChangeLog: * repinfo.adb (List_GCC_Expression.Print_Expr) : Do not output the final "end". Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/repinfo.adb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/ada/repinfo.adb b/gcc/ada/repinfo.adb index c08a232a3ab..969aa63c698 100644 --- a/gcc/ada/repinfo.adb +++ b/gcc/ada/repinfo.adb @@ -683,7 +683,7 @@ package body Repinfo is Print_Expr (Node.Op2); Write_Str (" else "); Print_Expr (Node.Op3); - Write_Str (" end)"); + Write_Str (")"); end if; when Plus_Expr => From patchwork Tue Jan 7 12:53:22 2025 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: 104241 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 B6D753860745 for ; Tue, 7 Jan 2025 13:06:51 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by sourceware.org (Postfix) with ESMTPS id 7DDD338560AD for ; Tue, 7 Jan 2025 12:54:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7DDD338560AD 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 7DDD338560AD Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::434 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254451; cv=none; b=rq0UKi6EHuV1i8QY1T7g7GeIyV/zag3nqk3Tuv0Ze+kjAojQSR2nwG6rPN6oR5apteD2O3T/Ek3R7Ii/mowSPZn75GCJBQyHbP/tV9fvxmE46eXumP35O7lYm3Okok1SZKTyLbkguJyb3eiuOoai3rxqAZi04vS/FMYTYWMEHWg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254451; c=relaxed/simple; bh=0WswTVkBJySAw4sTk0KdyRAQgsurAA870zVSEUi1V9s=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=gqtU7yVYOKG0QR8gmMgahZqX0bQ7NUBE8o56iojnrZUuC4M3qn0IM7LxNo63j5qpxGspfTolphyf5rWjOqZe5sNF0ZV0lPMr+jCCI0vH+F13IS6MAhT3zWi14L3qip5cyw8it65EuOWYsRqaY4D7Vl4fDZkna43jxr8Df8CbrNU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7DDD338560AD 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=N1wyEL7J Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-385d7b4da2bso13159619f8f.1 for ; Tue, 07 Jan 2025 04:54:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1736254450; x=1736859250; 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=U4mPV99m3/bX2+tLV/y9S9wFY5F3X71rplayNzywuVs=; b=N1wyEL7JOXfAvyC8GrssMRCEXVafVxcsgMOBhRecNt+ELm8UtLuv+Lp4zViS+dbCRQ tzjbQQftSCD6y/W2mjZijWKU0VZL8yWcW59DSYbLVfaMHJ3cwvMZpkLZNVafKalLQu5y bArK0XcxwodFTzrc3vAt+eML+HuRASssZRSaBow6kEYCXYZTt88Dp7nirYhbjd9ZoinM plEa5AA2FZjsl63Au6VFQxejMM9WN5U6fxI2l7ShmV1REUmLUkqE4qExAV2mTd31zzba DTtLcWsWYr+B/k3omzyrP3H7vT5kee9LrijFBKN8GPqFjRenjk2WKdQA3eTqZUcjnDGI jOhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736254450; x=1736859250; 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=U4mPV99m3/bX2+tLV/y9S9wFY5F3X71rplayNzywuVs=; b=t072BBW1IxGDn5B/+3JrLHYCQe2gJFpjCf2wkffk0eC9A/cqFnee4p60tvYEE7vGCE yBW/DyZhpvccOKv7W8GKm/F0vQquKB9mnuNYWC96/gCS/AGvRfIxS3oFrT7EHfbLAfnR G9rtFD78y1VntXUJka0uDrHg2J0a8RsKnRRIAL0JAcebbH5Mf3RDmizY2zLniHLCdHm2 4iumdUbs1yhwQ8rt1CDO70Vpo9tUMv5rlKTuS6/PM5PiQVDBYUMxTWEJIGXr/NV8PwA/ 0flOz3yj8K2/ufGG2u2EkcCsTB8MLvMuQpTv6NLiao7nxPu29zluE3yXF3uzfYU54uqp 8y3w== X-Gm-Message-State: AOJu0YzeHqLY3OzadYwgogdltFOzSFsQL+5fClT4D4EZy1ZW47b01B9i BdmzcxIS/y0MZVCQ05pZAmIHB59/nq5rB6QkIeJiHYjV76yqY6qP/FVcQbDXraQ9N6LtwCpcd8Q = X-Gm-Gg: ASbGnctjN8CTzeoC3IMHO3EXfB2HVvBoG6VRhpSVy/mshCVILoHB8TQuVwv9FOWuRVb HAoIHrbG86qpwlq9HuL/dCZsXX0sOaYvIo76f+EEK5UYyutUxwwP9CHmju/kc+UrxfhdJvLFxzo J7jU8QbQydxfJVsCuLOjJg4x7R4vI54O2eiPdpRQuSYXy11yWxkZHTYoyuklgjOShS3SljpLoRO lg8mBTdLIcsWU+OiUg4yee6Xl3CSP5K8AeGeBPnqmH1sCaYkvWa2WDNQnTuRwENy8LKQQGwdMSR BKU752jpPNNs85ttgZFlqGtjx7bfNsGLu517g52zUjLMUNc94JkQzNrD4F9a9DBBuFDGJPes X-Google-Smtp-Source: AGHT+IGZohayd2meTGKd1suUZJN02idk3quXRIwF9X3nODb6WqBqSKaEV8vivzg3BJ7sxqP8O7Oo/A== X-Received: by 2002:a05:6000:2ad:b0:386:3a8e:64bd with SMTP id ffacd0b85a97d-38a221f2c6emr59197954f8f.22.1736254450031; Tue, 07 Jan 2025 04:54:10 -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 5b1f17b1804b1-43656af6c42sm631014805e9.9.2025.01.07.04.54.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 04:54:09 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Gary Dismukes Subject: [COMMITTED 04/31] ada: Error on instantiation with defaulted formal type referencing other formal type Date: Tue, 7 Jan 2025 13:53:22 +0100 Message-ID: <20250107125350.619654-4-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250107125350.619654-1-poulhies@adacore.com> References: <20250107125350.619654-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~patchwork=sourceware.org@gcc.gnu.org From: Gary Dismukes The compiler wasn't accounting for default subtypes on generic formal types that reference other formal types of the same generic, leading to errors about invalid subtypes. Several other problems that could lead to blowups or incorrect errors were noticed through testing related cases and fixed along the way. gcc/ada/ChangeLog: * sem_ch12.adb (Analyze_One_Association): In the case of a formal type that has a Default_Subtype_Mark that does not have its Entity field set, this means the default refers to another formal type of the same generic formal part, so locate the matching subtype in the Result_Renamings and set Match's Entity to that subtype prior to the call to Instantiate_Type. (Validate_Formal_TypeDefault.Reference_Formal): Add test of Entity being Present, to prevent blowups on End_Label ids (which don't have Entity set). (Validate_Formal_Type_Default.Validate_Derived_Type_Default): Apply Base_Type to Formal. (Validate_Formal_Type_Default): Guard interface-related semantic checks with a test of Is_Tagged_Type. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch12.adb | 78 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 64 insertions(+), 14 deletions(-) diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 625d291fc28..41ace8cc250 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -2512,6 +2512,52 @@ package body Sem_Ch12 is if Present (Default_Subtype_Mark (Assoc.Un_Formal)) then Match := New_Copy (Default_Subtype_Mark (Assoc.Un_Formal)); + + -- If the Entity of the default subtype denoted by the + -- unanalyzed formal has not been set, then it must refer + -- to another formal type of the enclosing generic. So we + -- locate the subtype "renaming" in Result_Renamings that + -- corresponds to the formal type (by comparing the simple + -- names), and set Match's Entity to the entity denoted by + -- that subtype's subtype_indication (which will denote the + -- actual subtype corresponding to the other formal type). + -- This must be done before calling Instantiate_Type, since + -- that function relies heavily on the entity being set. + -- (Note also that there's similar code inside procedure + -- Validate_Derived_Type_Instance that deals with retrieving + -- the ancestor type of formal derived types.) + + if No (Entity (Match)) then + declare + pragma Assert (Is_Non_Empty_List (Result_Renamings)); + + Decl : Node_Id := First (Result_Renamings); + + begin + -- Locate subtype referenced by the default subtype + -- in the list of renamings. + + while Present (Decl) loop + if Nkind (Decl) = N_Subtype_Declaration + and then + Chars (Match) = + Chars (Defining_Identifier (Decl)) + then + Set_Entity + (Match, + Entity (Subtype_Indication (Decl))); + + exit; + + else + Next (Decl); + end if; + end loop; + + pragma Assert (Present (Entity (Match))); + end; + end if; + Append_List (Instantiate_Type (Assoc.Un_Formal, Match, Assoc.An_Formal, @@ -18161,6 +18207,7 @@ package body Sem_Ch12 is function Reference_Formal (N : Node_Id) return Traverse_Result is begin if Is_Entity_Name (N) + and then Present (Entity (N)) and then Scope (Entity (N)) = Current_Scope then return Abandon; @@ -18356,7 +18403,7 @@ package body Sem_Ch12 is procedure Validate_Derived_Type_Default is begin - if not Is_Ancestor (Etype (Formal), Def_Sub) then + if not Is_Ancestor (Etype (Base_Type (Formal)), Def_Sub) then Error_Msg_NE ("default must be a descendent of&", Default, Etype (Formal)); end if; @@ -18529,20 +18576,23 @@ package body Sem_Ch12 is end if; when N_Record_Definition => -- Formal interface type - if not Is_Interface (Def_Sub) then - Error_Msg_NE - ("default for formal interface type must be an interface", - Default, Formal); + if Is_Tagged_Type (Def_Sub) then + if not Is_Interface (Def_Sub) then + Error_Msg_NE + ("default for formal interface type must be an interface", + Default, Formal); - elsif Is_Limited_Type (Def_Sub) /= Is_Limited_Type (Formal) - or else Is_Task_Interface (Formal) /= Is_Task_Interface (Def_Sub) - or else Is_Protected_Interface (Formal) /= - Is_Protected_Interface (Def_Sub) - or else Is_Synchronized_Interface (Formal) /= - Is_Synchronized_Interface (Def_Sub) - then - Error_Msg_NE - ("default for interface& does not match", Def_Sub, Formal); + elsif Is_Limited_Type (Def_Sub) /= Is_Limited_Type (Formal) + or else Is_Task_Interface (Formal) /= + Is_Task_Interface (Def_Sub) + or else Is_Protected_Interface (Formal) /= + Is_Protected_Interface (Def_Sub) + or else Is_Synchronized_Interface (Formal) /= + Is_Synchronized_Interface (Def_Sub) + then + Error_Msg_NE + ("default for interface& does not match", Def_Sub, Formal); + end if; end if; when N_Derived_Type_Definition => From patchwork Tue Jan 7 12:53:23 2025 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: 104235 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 E6DF83851161 for ; Tue, 7 Jan 2025 13:02:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E6DF83851161 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=P0EkSSAW X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by sourceware.org (Postfix) with ESMTPS id 2FF7B3856095 for ; Tue, 7 Jan 2025 12:54:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2FF7B3856095 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 2FF7B3856095 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::330 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254452; cv=none; b=TQe3DF/EmonbNcqldOokT8fs/biiWWIdk5reaLdTvHRvIUlQfFmUL0hgztPFlaX4X9ZZaSvdmPF1noXfDaE7YyMl37TAEL/utxJADdl1nyQgw9OBIYNJljLBPow0flWjktDPLou/25sNp09FPF9xt3vwRssUVX//CuUaHTq/JY4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254452; c=relaxed/simple; bh=biUP2I5ZNJ3lekpu+7H18rbSw862sDHCSbaSC11GcK4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=LwVNwNyYkVUL9MjY36cQik7PQrPqy2Ok3F5gNc25XXe1CBGK2p+6SASw7ckUJqdKORMFUG8aMa0TUSXsgQgp/o8WIVvcK50al6+UmJ4mpHjCnUjLPikh/uG9XRdKWx1h3LR23um6mNrpbdp/goSTnv/1lXwLKSnHsp3LasSp33M= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2FF7B3856095 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-4362bae4d7dso110927625e9.1 for ; Tue, 07 Jan 2025 04:54:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1736254451; x=1736859251; 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=DuyukXvl/Fq4pS6RypR09QcvOjZlSnEsVMJhX4C8P+4=; b=P0EkSSAWD0lYN2Us216S2tM/MsrWgScG9pUTdPenMZVA1Er0h/DBjsFjc0V1unC0Sz iMFU1O5bzoIEjla2bWKSetK2fumvGoyXD3zXzdarnsh5zLOwHbRIEznJRpL/twybgc6O tLhyxTZe81OIujRynaUGXYirAkAiy107znL3gFvtw69tRrNEsQUVsaUU8gYoNckivtTe HbAm6iYTkolsZ9CmPBaqSnlppE/3443IFuF17ZYCLGdzb9NzEds7Lwe2DHpY/qMwV/8b UqXiBCEMMFoS5p9gmMofTs1VPYinOptqSj/q5lYkt4zcFql0KziNRifKOPnmyL8uxpw7 bJGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736254451; x=1736859251; 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=DuyukXvl/Fq4pS6RypR09QcvOjZlSnEsVMJhX4C8P+4=; b=DUXlvvvz1S5lWgmssjMx4JRZUEE0uco0yO3W5LEkfx5e+xqLuY+436XRpriaCw5Fwy ssF/MLxcmhV+tBbdx7J2l91Hh2s/zYUK+rbbYG/9mWdAXYyXLnLp+aEUT+Jq7t/JQjZm BlbUuSc58H9vwxnOHZ+h7QzMVOyl0nV9O3uE9TT2U95v6Wfnw6yJXr7DnIT2PKViubMC iQrxKO4J0+PNwQ7etyPXwV9gd4VnUx6yzG4y7HLBZsXqWMxekDKC+NyUa5uzrDF/+PHC AU7kdyQXThz/W+2aUdqts9RE+kzcwRl8DddjOZFXETbV5y85Ql/3Ufa7NFBW6Fonn2iB u5Dg== X-Gm-Message-State: AOJu0YyNM3IyDtEFoXMbh15BNIoMi/6F5iX+9kSNgmGh5rrt61Tt7FIU EtA6XHSc4C52Qccmgp1xgZQi0h7pBCZOkxakCrb+x1dnkiGSPKRf0dswv8TAK59huHLdTL+db1M = X-Gm-Gg: ASbGncvK8HcqlNOHZnQTNHfS95TwTOsFaGtuiP/pV11jxM2yLtvOP7/GGOo1UizR+ic hDn2gzJ2owKMdRrtg8o1EYLHYfjJzOlcCRMIT4GsXX5qnBpV5Q2FjXDrB5r0ltcoK9g5JG8pAN4 iU8k7/rwx0yDz+/8rRNH/adXLS8yFyJKAnN+PPUoO094B/VW8Gf+XaIudkqaKIgPIpD1YSB8eCK TXMiBAH2zaUpBVYakylldqBZrK84UKtpAyydNXE6ym/1FJF/pvYqqZR2P7DLnbfJ5LPUbuQNNQ+ j13qt//CVKPOhIfYe8ktgnF8+5gWYxX4hZcs4Ssrl+DncYYZz3QEBx43sh5lSbzLhhpolUk0 X-Google-Smtp-Source: AGHT+IHoozFyDHaQ52JIyF57arZJm2vEdVKsJbia8y8GZnuEwin4h4Ccil3C0lH+rDEAVP8gI9R06g== X-Received: by 2002:a05:600c:3150:b0:434:9fac:b158 with SMTP id 5b1f17b1804b1-4366854718emr408068365e9.1.1736254450800; Tue, 07 Jan 2025 04:54:10 -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 5b1f17b1804b1-43656af6c42sm631014805e9.9.2025.01.07.04.54.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 04:54:10 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Steve Baird Subject: [COMMITTED 05/31] ada: Put_Image spec incorrectly ignored for Fixed_Point_Type'Base'Image call. Date: Tue, 7 Jan 2025 13:53:23 +0100 Message-ID: <20250107125350.619654-5-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250107125350.619654-1-poulhies@adacore.com> References: <20250107125350.619654-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~patchwork=sourceware.org@gcc.gnu.org From: Steve Baird If a Put_Image aspect specification (introduced in Ada 2022) is given for a fixed point type Fx, then in some cases a call to Fx'Base'Image would incorrectly ignore the aspect specification and would instead return the pre-Ada2022 version of the image. However, a call to Fx'Image would do the right thing. gcc/ada/ChangeLog: * exp_put_image.adb (Image_Should_Call_Put_Image): Cope with the case where the attribute prefix for an Image attribute reference denotes an Itype constructed for a fixed point type. Calling Has_Aspect with such an Itype misses applicable aspect specifications; we need to look on the right list. This comes up if the prefix of the attribute reference is Some_Fixed_Point_Type'Base. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_put_image.adb | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/gcc/ada/exp_put_image.adb b/gcc/ada/exp_put_image.adb index dff9bba55a8..ef4494b7f11 100644 --- a/gcc/ada/exp_put_image.adb +++ b/gcc/ada/exp_put_image.adb @@ -1176,11 +1176,28 @@ package body Exp_Put_Image is declare U_Type : constant Entity_Id := Underlying_Type (Entity (Prefix (N))); begin - if Has_Aspect (U_Type, Aspect_Put_Image) then + if Has_Aspect (U_Type, Aspect_Put_Image) + or else not Is_Scalar_Type (U_Type) + then + return True; + end if; + + -- Deal with Itypes. One case where this is needed is for a + -- fixed-point type with a Put_Image aspect specification. + + -- ??? Should we be checking for Itype case here, or in Has_Aspect? + -- In other words, do we want to do what we are doing here for all + -- aspects, not just for Put_Image? + + if Is_Itype (U_Type) + and then Has_Aspect (Defining_Identifier + (Associated_Node_For_Itype (U_Type)), + Aspect_Put_Image) + then return True; end if; - return not Is_Scalar_Type (U_Type); + return False; end; end Image_Should_Call_Put_Image; From patchwork Tue Jan 7 12:53:24 2025 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: 104243 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 15A5A3861005 for ; Tue, 7 Jan 2025 13:07:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 15A5A3861005 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=GHVtUB0a X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by sourceware.org (Postfix) with ESMTPS id ECB7F38560AB for ; Tue, 7 Jan 2025 12:54:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ECB7F38560AB 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 ECB7F38560AB Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254453; cv=none; b=SKNNHVNBHIO7XefRCsvP30Hw2jhQzcOSDfzqA5bII6LS42fIrPq0LTI1ywnreryDY2e7orvKJGO4WUQZk3MP2I4kZu88NtySTFmmOoQfrIWwqN1Kr/IUeVcGLvj8Toyj1HSh24eClHGN83sNOenASXy870t2Wlw46uUcSG/w9aQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254453; c=relaxed/simple; bh=ePRO2Wm5h6FV1aHu2O5DQtMs4VdgrVjm11TuzzzZ0gQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=CcbdsaTgu3lEw/5Nf9zUEjixS32Sg4spCW3UG6t/hDfVjKba6KRFVOzv7qvQhekwSPpBNpvcpV7DuKcSBljAwfXFvv+6Bo/luM0D/rniSMe6yDxfAm1tzkbBdoHRYdMKg09gYyHF/sp4lHwxVOCHsrxWfjofEfNZKVFaNMZZpow= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ECB7F38560AB Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-4361f65ca01so153939735e9.1 for ; Tue, 07 Jan 2025 04:54:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1736254451; x=1736859251; 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=igXmTN7m/UamB+AHbX6wIM8h0SOVV36WycAG1JvY614=; b=GHVtUB0aUzgoA02KAmlUTNXZxrJbjbJns2w5Ma20Yn24o/weAzHoPEPlmwZmyNsSry s9RDaWGZWSY8/6hhBpIZhf5HjsjlI3XHGjdHGrHSMRdR/KYuM1D7DVpRMynFGOYDWhY+ UwrELmf+STRBUOlmqpugD8U7gn2rA2rwFKDvUthcFlRAKWSuyCTb19Ap0pRKD22n9i/w crY4vD6IQAO7y7REiBhRb2OMRauZlh7UNJFK+mYTIIyCPnTy8yhK5bXjtaTNttLU7r6v RRijTXG+OKKs9KEaLQGI1UpxQOC32ORvGexu2VEVt1Arw0YUN/5Qbzp4H3fd6lSZUNaN NFaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736254451; x=1736859251; 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=igXmTN7m/UamB+AHbX6wIM8h0SOVV36WycAG1JvY614=; b=JkTgbME7B64gV1+Ofn1NT2cfJfvG3x5bAJLKPKVmeLncPBQqC2CLI4CX1OSIgcUdfd chlDhMFBncBfDLAOyyWu79+qULZh1hgtk6li2QES4DHT6OYpskLQ29fMxafxlMQ4nFqK TNFtKD1E0fWiWYfb+cEPoBTkatwaDGMhD3gr+5prRaJdg4KKYo78SyhTBcnjoYHaWqOs qHPO6n3e2zooc9tmD0Pg3KJup2k6TX2Np8FIX4QDjPTDMMF6pNFaiENWprTXP21brACq Pl5cS7+L844fgFVTbS7z8T1IjYy16cKofjJl+uhZU4jzw6eVevwNOTc2AVD3OFZ37Ym5 BzQA== X-Gm-Message-State: AOJu0YyfDiXmxKXusaEGOPD7eOu/D8F2JN44VcBWjOyYc91pkKIh5IDx X1A5Mqba9y0pmdyJYVrXRTFLYidfptSsh5/pEyhX1aZ8cJzYqCPgJysApqDitZb8urju/o8nnMM = X-Gm-Gg: ASbGncujkw7DPH4nJlaT9j0vOlGkXnYQIMwtXnyRzHLvg51QXezOzEuGBxtRweBJbKA DEnJchllUvPrQpMWFXb2uR6GV8J6M29tA0Qf7kunutvflUlv0A9R2GqYNl8wqbqADOou/5BIwA5 rMGlwshIN3gLTDR89W7NCz8UUWgfzUF8Lq3BR+xec0aIO2EIwxR8j/guKd1jumRGx37IndrT5G+ W4ep7qP5n2Gvllq/OHegVy8gPesvp0AX8KUsRD3O7Yx/WbfF7fk2bsr34RPhzhct7jbNv6TM0Vh xUxi8g6cbFX4SsHOMhFlj5Phkinet1wy+OhitiRzwxLhoPOGUfFdMbCz2oZbupEK0pmP5MeI X-Google-Smtp-Source: AGHT+IHfIxMfmyUaxkvY4H12uz0sR3sxTppxuDKXe6yOkRjrNJ4GR9FpRY0BaC9qv2VPkKGdLyA0eQ== X-Received: by 2002:a05:600c:3b20:b0:434:9df4:5485 with SMTP id 5b1f17b1804b1-43668b76ae9mr460922155e9.32.1736254451563; Tue, 07 Jan 2025 04:54:11 -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 5b1f17b1804b1-43656af6c42sm631014805e9.9.2025.01.07.04.54.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 04:54:11 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED 06/31] ada: Fix comments about Subprogram_Variant and Exceptional_Cases Date: Tue, 7 Jan 2025 13:53:24 +0100 Message-ID: <20250107125350.619654-6-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250107125350.619654-1-poulhies@adacore.com> References: <20250107125350.619654-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~patchwork=sourceware.org@gcc.gnu.org From: Piotr Trojanek The comment about Subprogram_Variant was outdated after more types have been allowed by the corresponding SPARK RM rule; the comment about Exceptional_Cases was incorrect, after being copy-pasted. gcc/ada/ChangeLog: * sem_prag.adb (Analyze_Exceptional_Contract, Analyze_Variant): Fix comments. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_prag.adb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 5b5ff320e80..04202873974 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -2320,8 +2320,7 @@ package body Sem_Prag is Errors := Serious_Errors_Detected; - -- Preanalyze_Assert_Expression, but without enforcing any of the two - -- acceptable types. + -- Preanalyze_Assert_Expression enforcing the expression type Preanalyze_Assert_Expression (Consequence, Any_Boolean); @@ -31380,7 +31379,7 @@ package body Sem_Prag is Errors := Serious_Errors_Detected; - -- Preanalyze_Assert_Expression, but without enforcing any of the two + -- Preanalyze_Assert_Expression, but without enforcing any of the -- acceptable types. Preanalyze_Assert_Expression (Expr); From patchwork Tue Jan 7 12:53:25 2025 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: 104248 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 B4BBF3861029 for ; Tue, 7 Jan 2025 13:11:39 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by sourceware.org (Postfix) with ESMTPS id 91C1B385626B for ; Tue, 7 Jan 2025 12:54:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 91C1B385626B 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 91C1B385626B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::334 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254454; cv=none; b=lonOKZi8Ng7XQdXlDz72Ey2rLDGLPZnls4ABcJYy7+G+ddK5qB36Wo0bn49rQ9YYtaD6ZUNVLThR0OaDNKRSLJ+Fs3KNhMRJ4++2KYyuRbDH2l/scoHy9utnEqshOzuAymCiMgK+Om5Strjvt05M8OByuGOTul3XRWK8ftKy8V4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254454; c=relaxed/simple; bh=aJ4Zwj3yMf4iSnHP+NSRtZNgHSSl7aR8kxkH4CT5ogU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ZrxfxhXd/Ju9JyUlkMkwP1sm6MQlqyyK22hVsjk6oWgWlr00q/mr+9xueJMxatbN1F8JiMwH3j/Z04IbxNeFg9z7nC5X4qxspQwTA6ttNfvyQXMAZVa6KBTFbFWBp6YQAcsc+hPtjYYWsBtejyNHHA8v7/2RoWOuWLkBhfPF6Zc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 91C1B385626B 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=SjvP0UBQ Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4362f61757fso153861305e9.2 for ; Tue, 07 Jan 2025 04:54:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1736254453; x=1736859253; 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=uirUWXiFGx9XTJuwWh/f2C8Z+OOmdBPmO2kl/jVa+XE=; b=SjvP0UBQ+wH/IWS5K7xg9U0Je79c/R2HjZnnchipoNitjE8dBUc0f076fuvaw2gJia f2wNTl8D3wiT2LT8712Kyn/BF5Ss80ph2LyyUQYnwPBnD2Dz0khuGlAOSAmqskR8daDF fWUxsaVxlBj0NHgg46oCGva3njCW8YmX+Kajf1WcZKY00di0TeuKppCM5+aXeQXhong3 6/nRvEGTz4LTWhU3coO/JqL3RhIxpVKwgWaKEbL4aHBRDNUO0CURLUaFTjxQLY/BwF47 LcM0D0ZCp0r4EjFQKrCESSwrqkDPVNwgGeaECCObNyL2/2cNZsaufCVrDGL/NGpEsfYM p2Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736254453; x=1736859253; 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=uirUWXiFGx9XTJuwWh/f2C8Z+OOmdBPmO2kl/jVa+XE=; b=bx+EXjfhpvGdXZzUvzsKDaz8pZzu8aeymqMYpgNseqNKjQ669qDAV8+1ISrlQ/YiXV 0qOVaj2a5mtDIaTGs711Jq08kmy7/iAEV2prz9PcLCmozeXhBVj5XNM9OJST5p2UnXE3 JDxXwup9A76DRKDu5IZL5HvuMkKp84snZ9DnDi2Uy9QsBG7EeSsIRPEIuF39tjt8eSm6 5L+fAA5CHrvhrx/6aZYUEiSgnIQh5L5Dfoz83a3Zt6SUtl6J6tmQSzmgYcNWSdF0XexD 1m+Osvw9hYJWFIkIuwBB79MkjIsd3rsApYXHeMms/urC5HNhlIAYWtnqe9O+/308NSOw oFgQ== X-Gm-Message-State: AOJu0YwrUX6OJ8x8j1bPxNk6+EFgGBjuB6qlRxYccazw7l3VFXCOpcpj 05vGu2tC5BpCLJmFUrisZlJyElTig1mqEEa7Tgl7ipURpo8PWjGfe43XkunfP8mheI3LgAd1nW4 = X-Gm-Gg: ASbGncu8yFRN1m4gvc3hOMJqdmjSX8OA5zj4lZzLYaZLE+yEivv+ymK3+fmTEyhvHYK lo6UTUI2KJUAOYZWifWmSwxTAt1VKDU96tQtEzj19LnM99talBAObfPpjej79xIFlvVJbB8i2tb /xsx888mGpZfi0ar2A1VS/44AnbodVnS0Ss6IIGZwN+MwekydZypiFFBulmCarPuOHRqYxCHcTJ 843XT0WeKq+P6z25c1nOMcFAYqa71j2/tpMAdKkkyb1FbEUN3X9O9RptrLsibryPqY08n77FDux wKRIFNwIZwhSDrXfJFLU3WsRCqZpzlgVRADwGcUBsSUNQ4QA2bxPJitMuRn/fdvnHCpzC2l+ X-Google-Smtp-Source: AGHT+IE+9FiiyubLSJgbYKXWY0ScytE9kAgTl2AFV5M181ns1Lh7Lewpzq09wp3uY/8HKpPwWSjoLw== X-Received: by 2002:a05:600c:1d2a:b0:435:330d:de86 with SMTP id 5b1f17b1804b1-4366790d3c0mr583556295e9.0.1736254453150; Tue, 07 Jan 2025 04:54:13 -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 5b1f17b1804b1-43656af6c42sm631014805e9.9.2025.01.07.04.54.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 04:54:11 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED 07/31] ada: Move checks for consequences of Exceptional_Cases to GNAT Date: Tue, 7 Jan 2025 13:53:25 +0100 Message-ID: <20250107125350.619654-7-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250107125350.619654-1-poulhies@adacore.com> References: <20250107125350.619654-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~patchwork=sourceware.org@gcc.gnu.org From: Piotr Trojanek Previously checks for consequence expressions of Exceptional_Cases aspects were done in GNATprove backend. However, we can do them in the frontend, where they will apply to all subprograms, regardless of the SPARK_Mode aspect. gcc/ada/ChangeLog: * sem_prag.adb (Analyze_Exceptional_Cases_In_Decl_Part): Move check from GNATprove backend to GNAT frontend. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_prag.adb | 68 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 04202873974..b7de1cd8afa 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -2211,6 +2211,72 @@ package body Sem_Prag is procedure Check_Duplication (Id : Node_Id; Contracts : List_Id); -- Iterate through the identifiers in each contract to find duplicates + function Check_Param (N : Node_Id) return Traverse_Result; + -- Parameters of modes OUT or IN OUT of the subprogram shall not occur + -- in the consequences of an exceptional contract unless they are either + -- passed by reference or occur in the prefix of a reference to the 'Old + -- attribute or as direct prefixes of attributes that do not actually + -- read data from the object (SPARK RM 6.1.9(1)). + + ----------------- + -- Check_Param -- + ----------------- + + function Check_Param (N : Node_Id) return Traverse_Result is + begin + case Nkind (N) is + when N_Identifier | N_Expanded_Name => + declare + Id : constant Entity_Id := Entity (N); + begin + if Present (Id) + and then Ekind (Id) in E_Out_Parameter + | E_In_Out_Parameter + and then Scope (Id) = Spec_Id + and then not Is_By_Reference_Type (Etype (Id)) + and then not Is_Aliased (Id) + then + declare + Mode : constant String := + (if Ekind (Id) = E_Out_Parameter then "out" + else "in out"); + begin + Error_Msg_N + ("formal parameter of mode """ & Mode + & """ in consequence of Exceptional_Cases", N); + Error_Msg_N + ("\only parameters passed by reference are allowed", + N); + end; + end if; + end; + + when N_Attribute_Reference => + case Attribute_Name (N) is + when Name_Old => + return Skip; + when Name_Constrained + | Name_First + | Name_Last + | Name_Length + | Name_Range + => + if Nkind (Prefix (N)) in N_Identifier + | N_Expanded_Name + then + return Skip; + end if; + when others => null; + end case; + + when others => null; + end case; + + return OK; + end Check_Param; + + procedure Check_Params is new Traverse_More_Proc (Check_Param); + ---------------------------------- -- Analyze_Exceptional_Contract -- ---------------------------------- @@ -2324,6 +2390,8 @@ package body Sem_Prag is Preanalyze_Assert_Expression (Consequence, Any_Boolean); + Check_Params (Consequence); + -- Emit a clarification message when the consequence contains at -- least one undefined reference, possibly due to contract freezing. From patchwork Tue Jan 7 12:53:26 2025 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: 104253 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 5D80838515DF for ; Tue, 7 Jan 2025 13:16:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5D80838515DF 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=HbEl+Z83 X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id 4DB65385625B for ; Tue, 7 Jan 2025 12:54:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4DB65385625B 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 4DB65385625B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::335 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254455; cv=none; b=ow0lfmve6fJmCasOGWMPDeyc4KN+NeDJvu6ol3u7UWmk4mxirDH0bld+4oCBaxDlMt3NPUFoQCt6A1Wgs4KkKJSp1Ox/lqD30+fVVoWtYP0H1E7BLpzSii2BdrLgwK5OXwmw+6omEXMVluFAhkxWc6PBXZjg2bd8WiGjk2msiQ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254455; c=relaxed/simple; bh=MsdK9Fi7HjcvAD/Vu2EJBU5QIha3VACkPSeoSzTFnTc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=sA/KJtTcany4OXIobBrYFyihpgmBCeEDil5kKqIkmyj6LiyNUlUF7UiTpa5cL5EFO/E0IGKokLn3QHFanB0dxlGBotfmImqnKe4t5923W3v/LKh2vAZ2FomOsYt2ABL9/+ZULy+URBZawspsn+WXmGXs+Mo5kSxd1QiCuF32cMs= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4DB65385625B Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-436637e8c8dso157172475e9.1 for ; Tue, 07 Jan 2025 04:54:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1736254454; x=1736859254; 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=iNaZOy/xwdceC2A/AA60wy/qI+2dXBbDUOS6YAi5oqM=; b=HbEl+Z83wMkLTiFgiB1VDW9fJOGa4YRwdu7A9qcpzxjvApCPUNTR0szoTSfv0xU86c +pO0J2Qsxg1IRIqFwRDvbMs6YRfVJDn7ERX5RM7RHx02O9/vyHpBgbW1Lut3Zi5EpeYk TOIVq38RNiQjwnAPa1ArAWzPW1XS3kxldg1M1moFPQcKnkdDrkWIxej/xhN7fbbdBZMc KrXznYy4sof/RChKpxWeLahL18asaLDMCEnbMWZHC58o9iFZP5if8RetHoqkTQfn2K3T upZgqaYVoRoT6AcbxH8QH2KN1eBn6chEsS6Ahm/8kUha0ij2DF4903rqvh+s95skVeoq qEVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736254454; x=1736859254; 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=iNaZOy/xwdceC2A/AA60wy/qI+2dXBbDUOS6YAi5oqM=; b=MSmQFg5jHnO54gTb3sOw9U1B8fRul0aNGyVvbkz43cDXy82UyzJa66LWxT3j3NLuxO dRrMq5oG+lphpPxoMQUe8xJMP1tnpB8wy8o/lrCOQS7s5vyx3VgC8xWptc8EOKL9CeAj FHEoeijwkiL6RhC2GwCCYd3qPgaKhcNTaFhPaIbYzAb2a6nvYRCpbHVD+kU9T2Vi/H9Z OZzw0iFiDd3ZUp3Sd5+z8rcxwDp+W/orERG7voPrVxQw6E4Ncho03nrvWEAD+4dT0gpI cVbIDIaknd8UGbQ8orFmOEFZBz8qZG6J+ChmN5oX4YPkpLG3GEwA/4xJzZjRCT4uBBq4 VQkw== X-Gm-Message-State: AOJu0Yxg2tl/DuqDg4EbWsu/gnME7vW3GBAUaBq3T/A0o3nIVRkx6N6P 3CZDgMfa/T82wzfBsyQ0yMItk6mCSkl57Oo2XkCKOQAIWVrJkmfEa5lAa9+p6prH16xme2v4Kzc = X-Gm-Gg: ASbGnctSd/xK+Ko5ziaum6X4CFwicGThH9CAvXIUDiYLDBRN33Zc1ipfhfm9Z7mfsvI p0fifgM49imPefFETIAJpCwQ+khdPdEofbfLwrY5sxQIBypJYHw+JhyvVY7dCXeFT/fhruzvkZA 3CD8EIC803DTR07wFw+j7J1uTs0gYracd0YcuFveZj4C+WkylYGlw+dE66fJZrdU6X5bVHuGJwp Q8uQwG1T5ir8qGxjaoddTvQUmWHceZCiTr2UbCMmkyMW5hUBYmlzBqfk1Ek3dV3KQPKxhtZl10E iUVmh3A8STfEhpIEx7hCuTIvCxAShDq8Og/g5R6j+R2Jch+eIm/Uw5rkyg30WoOA3rntr32V X-Google-Smtp-Source: AGHT+IGy53rbCJX/W71kpT/QtfuTBqPGgpnFlOGo42F6PWlU6xOPCdxk+GwpKjYxmwdMmOWMGLeHqA== X-Received: by 2002:a05:600c:1c12:b0:431:58cd:b259 with SMTP id 5b1f17b1804b1-4366d356dfcmr561708795e9.31.1736254453934; Tue, 07 Jan 2025 04:54:13 -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 5b1f17b1804b1-43656af6c42sm631014805e9.9.2025.01.07.04.54.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 04:54:13 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED 08/31] ada: Reject references to attribute Result in Exceptional_Cases Date: Tue, 7 Jan 2025 13:53:26 +0100 Message-ID: <20250107125350.619654-8-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250107125350.619654-1-poulhies@adacore.com> References: <20250107125350.619654-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~patchwork=sourceware.org@gcc.gnu.org From: Piotr Trojanek Functions with aspect Side_Effects should not reference attribute Result in consequences of their aspect Exceptional_Cases. gcc/ada/ChangeLog: * sem_prag.adb (Analyze_Exceptional_Cases_In_Decl_Part): Reject references to attribute Result. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_prag.adb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index b7de1cd8afa..64b5b01869d 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -2216,7 +2216,8 @@ package body Sem_Prag is -- in the consequences of an exceptional contract unless they are either -- passed by reference or occur in the prefix of a reference to the 'Old -- attribute or as direct prefixes of attributes that do not actually - -- read data from the object (SPARK RM 6.1.9(1)). + -- read data from the object (SPARK RM 6.1.9(1)). References to + -- attribute Result should not occur either. ----------------- -- Check_Param -- @@ -2266,6 +2267,10 @@ package body Sem_Prag is then return Skip; end if; + when Name_Result => + Error_Msg_N + ("attribute Result in consequence of Exceptional_Cases", + N); when others => null; end case; From patchwork Tue Jan 7 12:53:27 2025 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: 104242 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 9DD6F385481C for ; Tue, 7 Jan 2025 13:07:28 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by sourceware.org (Postfix) with ESMTPS id F2C4B3856253 for ; Tue, 7 Jan 2025 12:54:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F2C4B3856253 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 F2C4B3856253 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::332 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254456; cv=none; b=lpmMqsRGtt8PhVJfAsKNVJe6Ukh0v5WsWhNTdlhqC7KpNiyX/1OQALzJN6MRBLeALErkqvExPkK2smh1rG+SPmxrGCr9KZY5HxqzMw4gWzEDy6wBknKrUhiVj9epb3qiGZOi8Xuk5rAW7ZvlbP8Zec9n2vjUoAn3z7EBMu6ANHo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254456; c=relaxed/simple; bh=sg5yzW68mJG060S49wuNavvQYjsg0Zs4yJPKtt2r/tg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=NOvVjI9fQixA3VWpPETQ587ZxydpcUoJX4TMfbK065gfvaPqguHDvYcjpfUgamkCZvEruQbLcAZYv4n4vfHw27YizhSKDGonoTEduWJjUFuKgZcZ+m/F/ry3DSDViFnzhSEO+/3ssEU/wZJcO4fmEJv0ZWQ27/tjFgBrkoc26pc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F2C4B3856253 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=CIbENnbR Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4361dc6322fso103277845e9.3 for ; Tue, 07 Jan 2025 04:54:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1736254454; x=1736859254; 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=NJ+CVr7iFnRrgmTSw0G/Dp7yfbG3r0OF7Y5PyXdmXeY=; b=CIbENnbRx+LPdWpPcWl9xeqaURw8V0jK4Y0D9eJ+p0MBpKDgjExSDlFJvu1GnDd1FG CDVQ/dxrMZxYzgcpvQdQeHs7jChCZFJVTkVXdMpYgIWsI5BcFx5+sjhzAovBeCd3ME0Y u9Rp038rOkO57SeIvJa16+a3Wqvx2oadiJb8drW4cpLDULHtxDHpBJZOLDP4LQbfwzie X+piuy+sZrHu08KNo43acQu+yRmTDacLIKIOukrcJ6//Ut41MkzLjIx5+2BiZ9Xse5TD 5lxKMXNJT9oypH0vZz7BD8cY3dpyR6UC6XTHJRf5fMnUdNIlnuZHj4hH9+WnMo9F9+ZP dELg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736254454; x=1736859254; 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=NJ+CVr7iFnRrgmTSw0G/Dp7yfbG3r0OF7Y5PyXdmXeY=; b=vvPn40jnz4XKb+TmXNqSfMJ38SwgE35ER14fcZIAhLm1/U8fAUMc+zWjLNIheWjVkU 6ROKSW/+yFxq6guSTgup69N/k/6x6DoQvzLm/o27cz6DN0wh8j3VXkp9tXgxuVR2UbNp ekMfQ5N+yAA+yg9DxMo8JQ/mi7hRfWzpfXtbfjRPVogJGYcc6K7J4tKe9PIDx4cFTDAu jGoEliLsSzW0/NxTyJIbdWaC7BSFKKKKVh03gaJ8EOBOqdbax2qNtwD2G53i3PgF7eUw G8RekKv724owFz07e09rOw9t1Wb+anC5uJFRjFmuzaQKMftB3OSbs5+HuENNo8ZROZDl yIvQ== X-Gm-Message-State: AOJu0YxGwnd1vZOKfkh+d7Ze6bQTocL1rMgtbhJ7pmVb05N4SwXnWyVy M3LqO11fLp7ro0UefpAJ2NSDun+T3avC7M2bynzwL3MGWVbNDvjWZ0BT8CiftGyOXOA5H8Coo6w = X-Gm-Gg: ASbGncue6J1qcWPF1U9wr3u0L8ovo1R81GZOEGz1CW6uuLq/dE7S8aQ7EQvtZT7kcUL wIXxNpExdFixc/XDE2naVMy8NMgwFmgrhSw9I1qIO0YpmXDCQxXCiNmyVpoMrbMWQ+vFqRYS+8d KGvX4ClxjaPtwTBx4Js3hndhUioqSv6SkSfUTW37TfPnkf5o16HK4FwYQeocPhFVWATz4GuKxR1 fM3kz4qvJVUFT/ieOPDRSdwkvW0EtY7hygn3iDZmaIio7oqWMgxFo57xTra6mrrkEN9rLKkTjXy qJOrh2znz20f5h83Eg0OjyKm4iHC/Xf7quLAwIOkeiMeTVIOC5ybziv0aYYTxZAFhNUlwPC7 X-Google-Smtp-Source: AGHT+IE3ON9ltJYsvXsw8Vz5zAf6X6vLs4oyOWJ79Vwi+uBH/zU+zJFpzu3kLoDyLJ6dLe/g+89dzQ== X-Received: by 2002:a05:600c:350b:b0:434:ffd7:6fca with SMTP id 5b1f17b1804b1-436685488b2mr480301455e9.2.1736254454630; Tue, 07 Jan 2025 04:54:14 -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 5b1f17b1804b1-43656af6c42sm631014805e9.9.2025.01.07.04.54.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 04:54:14 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 09/31] ada: Elide the copy for bit-packed aggregates in (safe) assignments Date: Tue, 7 Jan 2025 13:53:27 +0100 Message-ID: <20250107125350.619654-9-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250107125350.619654-1-poulhies@adacore.com> References: <20250107125350.619654-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~patchwork=sourceware.org@gcc.gnu.org From: Eric Botcazou The in-place expansion has been historically disabled for them, but there does not seem to be any good reason left for this. gcc/ada/ChangeLog: * exp_aggr.adb (Expand_Array_Aggregate): Do not exclude aggregates of bit-packed array types in assignments from in-place expansion. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_aggr.adb | 1 - 1 file changed, 1 deletion(-) diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index f771660d23a..a51e02bc308 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -6129,7 +6129,6 @@ package body Exp_Aggr is Nkind (Parent_Node) = N_Assignment_Statement and then (Is_Limited_Type (Typ) or else (not Has_Default_Init_Comps (N) - and then not Is_Bit_Packed_Array (Typ) and then In_Place_Assign_OK (N, Get_Base_Object (Name (Parent_Node))))); From patchwork Tue Jan 7 12:53:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 104254 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 EEAA4385E441 for ; Tue, 7 Jan 2025 13:19:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EEAA4385E441 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=Nl1loazi X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by sourceware.org (Postfix) with ESMTPS id CDB2A3857001 for ; Tue, 7 Jan 2025 12:54:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CDB2A3857001 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 CDB2A3857001 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254458; cv=none; b=WYl1ql1j8+VYZu4yM9jw2K6CLmfI9Cyk/JkwmAURMr+66j0xssIkql/CHf5F4d8e6wD4lzhtSf0VuJuJVqxSSI2fZ3LO8/1MvV+ZlxUwefFzozaBrAHwoTcndlV8HysIQz/VxEvVtjkUdeZJA5zdwoekAtY5z+jEaoReaMCu1d0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254458; c=relaxed/simple; bh=Qu9NY7HtB4uUaL/TKPhTxNaWnjgvEcKELWpC7nutHiw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=AvL3PIRMF9r2jxwaIOMxFuBKR4V6JgoWmNczLwOR1XURm/mwFJ0GXjDhY7tzcLjFZhkJ9T07DERT8f7RSLCcOwsU9gX9pLmF9OD5rGSPmQnKf5bR2fd7UF1aLRIB+3H11286/Cecknj/1Le9d5MUc+q52d/wQq3ICUrZOYtZw2I= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CDB2A3857001 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4362f61757fso153861855e9.2 for ; Tue, 07 Jan 2025 04:54:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1736254456; x=1736859256; 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=oHr+zyTIgae8mvpKRkmaaNOSvF7P0O9n4tZwOEp9IX4=; b=Nl1loazisFddNh9WsA169h0vyJRGiaBacjqftEfXa2NEMMrfyTUmMDGd0KnrwBcQQA 1RHWw6j5cIlWpgUhJ7AtJ4GJP5yUPvnPfNuf7CJld1dSjtQl19m2Yp0MeAc4wfFU9DCx lITrhDqrAPAIFx9fcLetJOr3zYu9fonOksdOB+nq6L2bqiGLOaxUKPveWDhGbZbm4do+ TocWh/eCXmvYBG/s16DwU2DOAHwWn3uQg57nu0N/zLfwjHnYpLtbv6ex8kqOQYScutct OCNAIP4OT1+J5QAcg8KKU2sadblltXld2Itcpr+cWoA49n/BJxP78ccY5bubArtVq60I yXgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736254456; x=1736859256; 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=oHr+zyTIgae8mvpKRkmaaNOSvF7P0O9n4tZwOEp9IX4=; b=NaVzrFvCyhhfhC1vVUoDG/QyNBqMaxMeEZLTaZLlSJEZjACczu91RXL4Uaq5RignTu h4jPsShi1y/8y8NP/eI5mR09GTLKivDYb+E/qfZy4rjKmf+0UPVB40g7IKf2N+ke7FF0 y21wHlAvh8q2txZDqD6lHPhLGuO+r4sSBn1KzldNSe65uobgn7iXfXFcsiMpQ/MxKCsl lFXN2Vqzz1pbIZArYi/Nn9TDa8TRnyPKBDAptNSD9F0yNkIh8/PGmJUtblUgwrqtyKlK DjBXiNAeEx7lOsc+anwX7C9TnQp8h79SnHfFZYkgC+txAT4EtBjntm8jOwMnOg5Zac/X 4aBA== X-Gm-Message-State: AOJu0Yzt8Z6z3n7sWPa/WoDsTQSs8Dd6wZwpzRb1e6bh49AP0CJwZTVc YsxHP5qx7Y+r7RxALEEWQ1fMlJGH6ATx4eFG3rTTnS6Our2fKacQn2tb5thuTu99pLgmRgy3JfE = X-Gm-Gg: ASbGnct0+JjhQL5Q5X/7gKKFUe1cS81gAa2bfED32M42qTQN444z+G3kdyibBJSvdRg Qc/Ir9sDpreATBbEwZ3BSVBEojXX+mgb7S/JDYQkzd/WSllQSVTztLNAJFt942mwMQCYQNeR2jD gyfTV496gT8ecYOCqhnuyTmRnX4rW+uad6p8rxpbs9BvdzQEZmxu0UlQBcvKINh9pq/mvPpbJfM So0pnMGZh3IttIpWnuwRu05PZDsmIgK/FH1oDXGahVypes7/APn6RxYaJHe103ig0l6JrfQNmPp ZnpsnVgWFhxmxh6bbb7yEdw3r634IgiCvSFwONqej17XcgkGOC9P9ufLvGfrsbLPfvXkgquX X-Google-Smtp-Source: AGHT+IE8aJHElXyJNp/0G/NyAsc1A3t7F/WOLBLFAlk/pjAgnOmcbWKdy0DJRzGNKUProoECfrZAFA== X-Received: by 2002:a05:600c:3ca1:b0:434:ff25:199f with SMTP id 5b1f17b1804b1-43668b480dbmr483367695e9.26.1736254455491; Tue, 07 Jan 2025 04:54:15 -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 5b1f17b1804b1-43656af6c42sm631014805e9.9.2025.01.07.04.54.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 04:54:14 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Ronan Desplanques Subject: [COMMITTED 10/31] ada: Add "finally" GNAT extension Date: Tue, 7 Jan 2025 13:53:28 +0100 Message-ID: <20250107125350.619654-10-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250107125350.619654-1-poulhies@adacore.com> References: <20250107125350.619654-1-poulhies@adacore.com> MIME-Version: 1.0 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, KAM_ASCII_DIVIDERS, 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~patchwork=sourceware.org@gcc.gnu.org From: Ronan Desplanques This patch adds a new reserved word, "finally", and accompanying new syntax that's similar to the Java equivalent. gcc/ada/ChangeLog: * atree.adb (Parent_Or_List_Containing): New function. * atree.ads (Parent_Or_List_Containing): Likewise. * gen_il-fields.ads: Add new field. * gen_il-gen-gen_nodes.adb (Gen_Nodes): Extend handled sequence of statements node. * par-ch11.adb (P_Handled_Sequence_Of_Statements, P_Exception_Handler): Add new syntactic construct. * par-ch5.adb (P_Sequence_Of_Statements): Likewise. * par.adb: Likewise. * par-util.adb (Check_Future_Keyword): Warn that "finally" becomes a reserved word with extensions. * scans.adb (Initialize_Ada_Keywords): Add new reserved word. * snames.adb-tmpl: Likewise. * snames.ads-tmpl: Likewise. * scans.ads: Likewise. * sem_ch11.adb (Analyze_Handled_Statements): Adapt to new node field. * sem_ch5.adb (Analyze_Exit_Statement): Add legality check. (Analyze_Goto_Statement): Likewise. * sem_ch6.adb (Analyze_Return_Statement): Likewise. * sinfo-utils.adb (Lowest_Common_Ancestor, Destroy_Element): New subprograms. * sinfo-utils.ads (Lowest_Common_Ancestor): New function. * sinfo.ads: Add documentation for new field. * xsnamest.adb: Fix typo in comment. * doc/gnat_rm/gnat_language_extensions.rst: Document new extension. * warnsw.adb: Add new option. * warnsw.ads: Likewise. * exp_ch11.adb (Expand_N_Handled_Sequence_Of_Statements): Add abort deferral to finally part. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate. * gcc-interface/trans.cc (Handled_Sequence_Of_Statements_to_gnu): Handle finally statements. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/atree.adb | 15 ++ gcc/ada/atree.ads | 5 + .../doc/gnat_rm/gnat_language_extensions.rst | 43 ++++++ gcc/ada/exp_ch11.adb | 12 ++ gcc/ada/gcc-interface/trans.cc | 23 ++++ gcc/ada/gen_il-fields.ads | 1 + gcc/ada/gen_il-gen-gen_nodes.adb | 1 + gcc/ada/gnat_rm.texi | 129 +++++++++++++----- gcc/ada/gnat_ugn.texi | 2 +- gcc/ada/par-ch11.adb | 11 +- gcc/ada/par-ch5.adb | 19 +++ gcc/ada/par-util.adb | 8 ++ gcc/ada/par.adb | 20 +-- gcc/ada/scans.adb | 3 + gcc/ada/scans.ads | 1 + gcc/ada/sem_ch11.adb | 4 + gcc/ada/sem_ch5.adb | 56 +++++++- gcc/ada/sem_ch6.adb | 17 +++ gcc/ada/sinfo-utils.adb | 68 +++++++++ gcc/ada/sinfo-utils.ads | 4 + gcc/ada/sinfo.ads | 4 + gcc/ada/snames.adb-tmpl | 4 +- gcc/ada/snames.ads-tmpl | 10 ++ gcc/ada/warnsw.adb | 1 + gcc/ada/warnsw.ads | 6 + gcc/ada/xsnamest.adb | 2 +- 26 files changed, 421 insertions(+), 48 deletions(-) diff --git a/gcc/ada/atree.adb b/gcc/ada/atree.adb index 8cc22394b0c..c2e026bcc6d 100644 --- a/gcc/ada/atree.adb +++ b/gcc/ada/atree.adb @@ -2076,6 +2076,21 @@ package body Atree is end if; end Node_Parent; + ------------------------------- + -- Parent_Or_List_Containing -- + ------------------------------- + + function Parent_Or_List_Containing (X : Union_Id) return Union_Id is + begin + if X in Node_Range then + return Link (Node_Id (X)); + elsif X in List_Range then + return Union_Id (List_Parent (List_Id (X))); + else + raise Program_Error; + end if; + end Parent_Or_List_Containing; + ------------- -- Present -- ------------- diff --git a/gcc/ada/atree.ads b/gcc/ada/atree.ads index 834cc3150f5..3adfb824a17 100644 --- a/gcc/ada/atree.ads +++ b/gcc/ada/atree.ads @@ -456,6 +456,11 @@ package Atree is -- Parent has the same name as the one in Nlists; Node_Parent can be used -- more easily in the debugger. + function Parent_Or_List_Containing (X : Union_Id) return Union_Id; + -- X must be in Node_Range or in List_Range. If X is in Node_Range and is + -- contained in a list, returns that list, otherwise return the parent of + -- the list or node represented by X. + function Paren_Count (N : Node_Id) return Nat; pragma Inline (Paren_Count); -- Number of parentheses that surround an expression diff --git a/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst b/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst index 4e7f9fae602..ee2df668eb1 100644 --- a/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst +++ b/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst @@ -1723,3 +1723,46 @@ Example: If ``Path`` is a relative path, it is interpreted relatively to the directory of the file that contains the aspect specification. .. attention:: The maximum size of loaded files is limited to 2\ :sup:`31` bytes. + + +Finally construct +----------------- + +The ``finally`` keyword makes it possible to have a sequence of statements be executed when +another sequence of statements is completed, whether normally or abnormally. + +This feature is similar to the one with the same name in other languages such as Java. + +Syntax +^^^^^^ + +.. code-block:: text + + handled_sequence_of_statements ::= + sequence_of_statements + [exception + exception_handler + {exception_handler}] + [finally + sequence_of_statements] + +Legality Rules +^^^^^^^^^^^^^^ + +Return statements in the ``sequence_of_statements`` attached to the finally that would cause control +to be transferred outside the finally part are forbidden. + +Goto & exit where the target is outside of the finally's ``sequence_of_statements`` are forbidden + +Dynamic Semantics +^^^^^^^^^^^^^^^^^ + +Statements in the optional ``sequence_of_statements`` contained in the ``finally`` branch will be +executed unconditionally, after the main ``sequence_of_statements`` is executed, and after any +potential ``exception_handler`` is executed. + +If an exception is raised in the finally part, it cannot be caught by the ``exception_handler``. + +Abort/ATC (asynchronous transfer of control) cannot interrupt a finally block, nor prevent its +execution, that is the finally block must be executed in full even if the containing task is +aborted, or if the control is transferred out of the block. diff --git a/gcc/ada/exp_ch11.adb b/gcc/ada/exp_ch11.adb index eda9f17fa7d..66f38671008 100644 --- a/gcc/ada/exp_ch11.adb +++ b/gcc/ada/exp_ch11.adb @@ -1301,6 +1301,18 @@ package body Exp_Ch11 is pragma Assert (not Is_Thunk (Current_Scope)); Expand_Cleanup_Actions (Parent (N)); end if; + + if Present (Finally_Statements (N)) then + Prepend_To + (Finally_Statements (N), + Build_Runtime_Call (Sloc (N), RE_Abort_Defer)); + + Append_To + (Finally_Statements (N), + Build_Runtime_Call (Sloc (N), RE_Abort_Undefer)); + + Analyze_List (Finally_Statements (N)); + end if; end Expand_N_Handled_Sequence_Of_Statements; ------------------------------------- diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interface/trans.cc index 3aa41253d74..cda73d509e8 100644 --- a/gcc/ada/gcc-interface/trans.cc +++ b/gcc/ada/gcc-interface/trans.cc @@ -5674,6 +5674,29 @@ Handled_Sequence_Of_Statements_to_gnu (Node_Id gnat_node) set_expr_location_from_node (gnu_result, gnat_node, true); } + if (Present (Finally_Statements (gnat_node))) + { + tree finally_stmts; + location_t locus; + + start_stmt_group (); + for (gnat_temp = First_Non_Pragma (Finally_Statements (gnat_node)); + Present (gnat_temp); + gnat_temp = Next_Non_Pragma (gnat_temp)) + add_stmt (gnat_to_gnu (gnat_temp)); + finally_stmts = end_stmt_group (); + + gnu_result + = build2 (TRY_FINALLY_EXPR, void_type_node, gnu_result, finally_stmts); + + /* Do as above for the TRY_CATCH_EXPR case. */ + if (Present (End_Label (gnat_node)) + && Sloc_to_locus (Sloc (End_Label (gnat_node)), &locus)) + SET_EXPR_LOCATION (gnu_result, locus); + else + set_expr_location_from_node (gnu_result, gnat_node, true); + } + /* Process the At_End_Proc, if any. */ if (at_end) { diff --git a/gcc/ada/gen_il-fields.ads b/gcc/ada/gen_il-fields.ads index 52c6997e6c9..70ece337e63 100644 --- a/gcc/ada/gen_il-fields.ads +++ b/gcc/ada/gen_il-fields.ads @@ -184,6 +184,7 @@ package Gen_IL.Fields is Expression_Copy, Expressions, File_Index, + Finally_Statements, First_Bit, First_Inlined_Subprogram, First_Name, diff --git a/gcc/ada/gen_il-gen-gen_nodes.adb b/gcc/ada/gen_il-gen-gen_nodes.adb index 9b8801b4b84..af5049bf33e 100644 --- a/gcc/ada/gen_il-gen-gen_nodes.adb +++ b/gcc/ada/gen_il-gen-gen_nodes.adb @@ -1349,6 +1349,7 @@ begin -- Gen_IL.Gen.Gen_Nodes (Sy (Statements, List_Id, Default_Empty_List), Sy (End_Label, Node_Id, Default_Empty), Sy (Exception_Handlers, List_Id, Default_No_List), + Sy (Finally_Statements, List_Id, Default_No_List), Sy (At_End_Proc, Node_Id, Default_Empty))); Cc (N_Index_Or_Discriminant_Constraint, Node_Kind, diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index d872c111a1b..97469d73952 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -925,6 +925,7 @@ Experimental Language Extensions * No_Raise aspect:: * Inference of Dependent Types in Generic Instantiations:: * External_Initialization Aspect:: +* Finally construct:: Storage Model @@ -945,6 +946,12 @@ No_Raise aspect * Composite types:: * Interoperability with controlled types:: +Finally construct + +* Syntax: Syntax<2>. +* Legality Rules: Legality Rules<2>. +* Dynamic Semantics: Dynamic Semantics<2>. + Security Hardening Features * Register Scrubbing:: @@ -29898,6 +29905,7 @@ Features activated via @code{-gnatX0} or * No_Raise aspect:: * Inference of Dependent Types in Generic Instantiations:: * External_Initialization Aspect:: +* Finally construct:: @end menu @@ -31149,7 +31157,7 @@ package Int_Array_Operations is new Array_Operations Array_Type => Int_Array); @end example -@node External_Initialization Aspect,,Inference of Dependent Types in Generic Instantiations,Experimental Language Extensions +@node External_Initialization Aspect,Finally construct,Inference of Dependent Types in Generic Instantiations,Experimental Language Extensions @anchor{gnat_rm/gnat_language_extensions external-initialization-aspect}@anchor{469} @subsection External_Initialization Aspect @@ -31190,8 +31198,65 @@ The maximum size of loaded files is limited to 2@w{^31} bytes. @end quotation @end cartouche +@node Finally construct,,External_Initialization Aspect,Experimental Language Extensions +@anchor{gnat_rm/gnat_language_extensions finally-construct}@anchor{46a} +@subsection Finally construct + + +The @code{finally} keyword makes it possible to have a sequence of statements be executed when +another sequence of statements is completed, whether normally or abnormally. + +This feature is similar to the one with the same name in other languages such as Java. + +@menu +* Syntax: Syntax<2>. +* Legality Rules: Legality Rules<2>. +* Dynamic Semantics: Dynamic Semantics<2>. + +@end menu + +@node Syntax<2>,Legality Rules<2>,,Finally construct +@anchor{gnat_rm/gnat_language_extensions id4}@anchor{46b} +@subsubsection Syntax + + +@example +handled_sequence_of_statements ::= + sequence_of_statements + [exception + exception_handler + @{exception_handler@}] + [finally + sequence_of_statements] +@end example + +@node Legality Rules<2>,Dynamic Semantics<2>,Syntax<2>,Finally construct +@anchor{gnat_rm/gnat_language_extensions id5}@anchor{46c} +@subsubsection Legality Rules + + +Return statements in the @code{sequence_of_statements} attached to the finally that would cause control +to be transferred outside the finally part are forbidden. + +Goto & exit where the target is outside of the finally’s @code{sequence_of_statements} are forbidden + +@node Dynamic Semantics<2>,,Legality Rules<2>,Finally construct +@anchor{gnat_rm/gnat_language_extensions id6}@anchor{46d} +@subsubsection Dynamic Semantics + + +Statements in the optional @code{sequence_of_statements} contained in the @code{finally} branch will be +executed unconditionally, after the main @code{sequence_of_statements} is executed, and after any +potential @code{exception_handler} is executed. + +If an exception is raised in the finally part, it cannot be caught by the @code{exception_handler}. + +Abort/ATC (asynchronous transfer of control) cannot interrupt a finally block, nor prevent its +execution, that is the finally block must be executed in full even if the containing task is +aborted, or if the control is transferred out of the block. + @node Security Hardening Features,Obsolescent Features,GNAT language extensions,Top -@anchor{gnat_rm/security_hardening_features doc}@anchor{46a}@anchor{gnat_rm/security_hardening_features id1}@anchor{46b}@anchor{gnat_rm/security_hardening_features security-hardening-features}@anchor{15} +@anchor{gnat_rm/security_hardening_features doc}@anchor{46e}@anchor{gnat_rm/security_hardening_features id1}@anchor{46f}@anchor{gnat_rm/security_hardening_features security-hardening-features}@anchor{15} @chapter Security Hardening Features @@ -31213,7 +31278,7 @@ change. @end menu @node Register Scrubbing,Stack Scrubbing,,Security Hardening Features -@anchor{gnat_rm/security_hardening_features register-scrubbing}@anchor{46c} +@anchor{gnat_rm/security_hardening_features register-scrubbing}@anchor{470} @section Register Scrubbing @@ -31249,7 +31314,7 @@ programming languages, see @cite{Using the GNU Compiler Collection (GCC)}. @c Stack Scrubbing: @node Stack Scrubbing,Hardened Conditionals,Register Scrubbing,Security Hardening Features -@anchor{gnat_rm/security_hardening_features stack-scrubbing}@anchor{46d} +@anchor{gnat_rm/security_hardening_features stack-scrubbing}@anchor{471} @section Stack Scrubbing @@ -31393,7 +31458,7 @@ Bar_Callable_Ptr. @c Hardened Conditionals: @node Hardened Conditionals,Hardened Booleans,Stack Scrubbing,Security Hardening Features -@anchor{gnat_rm/security_hardening_features hardened-conditionals}@anchor{46e} +@anchor{gnat_rm/security_hardening_features hardened-conditionals}@anchor{472} @section Hardened Conditionals @@ -31483,7 +31548,7 @@ be used with other programming languages supported by GCC. @c Hardened Booleans: @node Hardened Booleans,Control Flow Redundancy,Hardened Conditionals,Security Hardening Features -@anchor{gnat_rm/security_hardening_features hardened-booleans}@anchor{46f} +@anchor{gnat_rm/security_hardening_features hardened-booleans}@anchor{473} @section Hardened Booleans @@ -31544,7 +31609,7 @@ and more details on that attribute, see @cite{Using the GNU Compiler Collection @c Control Flow Redundancy: @node Control Flow Redundancy,,Hardened Booleans,Security Hardening Features -@anchor{gnat_rm/security_hardening_features control-flow-redundancy}@anchor{470} +@anchor{gnat_rm/security_hardening_features control-flow-redundancy}@anchor{474} @section Control Flow Redundancy @@ -31712,7 +31777,7 @@ see @cite{Using the GNU Compiler Collection (GCC)}. These options can be used with other programming languages supported by GCC. @node Obsolescent Features,Compatibility and Porting Guide,Security Hardening Features,Top -@anchor{gnat_rm/obsolescent_features doc}@anchor{471}@anchor{gnat_rm/obsolescent_features id1}@anchor{472}@anchor{gnat_rm/obsolescent_features obsolescent-features}@anchor{16} +@anchor{gnat_rm/obsolescent_features doc}@anchor{475}@anchor{gnat_rm/obsolescent_features id1}@anchor{476}@anchor{gnat_rm/obsolescent_features obsolescent-features}@anchor{16} @chapter Obsolescent Features @@ -31731,7 +31796,7 @@ compatibility purposes. @end menu @node pragma No_Run_Time,pragma Ravenscar,,Obsolescent Features -@anchor{gnat_rm/obsolescent_features id2}@anchor{473}@anchor{gnat_rm/obsolescent_features pragma-no-run-time}@anchor{474} +@anchor{gnat_rm/obsolescent_features id2}@anchor{477}@anchor{gnat_rm/obsolescent_features pragma-no-run-time}@anchor{478} @section pragma No_Run_Time @@ -31744,7 +31809,7 @@ preferred usage is to use an appropriately configured run-time that includes just those features that are to be made accessible. @node pragma Ravenscar,pragma Restricted_Run_Time,pragma No_Run_Time,Obsolescent Features -@anchor{gnat_rm/obsolescent_features id3}@anchor{475}@anchor{gnat_rm/obsolescent_features pragma-ravenscar}@anchor{476} +@anchor{gnat_rm/obsolescent_features id3}@anchor{479}@anchor{gnat_rm/obsolescent_features pragma-ravenscar}@anchor{47a} @section pragma Ravenscar @@ -31753,7 +31818,7 @@ The pragma @code{Ravenscar} has exactly the same effect as pragma is part of the new Ada 2005 standard. @node pragma Restricted_Run_Time,pragma Task_Info,pragma Ravenscar,Obsolescent Features -@anchor{gnat_rm/obsolescent_features id4}@anchor{477}@anchor{gnat_rm/obsolescent_features pragma-restricted-run-time}@anchor{478} +@anchor{gnat_rm/obsolescent_features id4}@anchor{47b}@anchor{gnat_rm/obsolescent_features pragma-restricted-run-time}@anchor{47c} @section pragma Restricted_Run_Time @@ -31763,7 +31828,7 @@ preferred since the Ada 2005 pragma @code{Profile} is intended for this kind of implementation dependent addition. @node pragma Task_Info,package System Task_Info s-tasinf ads,pragma Restricted_Run_Time,Obsolescent Features -@anchor{gnat_rm/obsolescent_features id5}@anchor{479}@anchor{gnat_rm/obsolescent_features pragma-task-info}@anchor{47a} +@anchor{gnat_rm/obsolescent_features id5}@anchor{47d}@anchor{gnat_rm/obsolescent_features pragma-task-info}@anchor{47e} @section pragma Task_Info @@ -31789,7 +31854,7 @@ in the spec of package System.Task_Info in the runtime library. @node package System Task_Info s-tasinf ads,,pragma Task_Info,Obsolescent Features -@anchor{gnat_rm/obsolescent_features package-system-task-info}@anchor{47b}@anchor{gnat_rm/obsolescent_features package-system-task-info-s-tasinf-ads}@anchor{47c} +@anchor{gnat_rm/obsolescent_features package-system-task-info}@anchor{47f}@anchor{gnat_rm/obsolescent_features package-system-task-info-s-tasinf-ads}@anchor{480} @section package System.Task_Info (@code{s-tasinf.ads}) @@ -31799,7 +31864,7 @@ to support the @code{Task_Info} pragma. The predefined Ada package standard replacement for GNAT’s @code{Task_Info} functionality. @node Compatibility and Porting Guide,GNU Free Documentation License,Obsolescent Features,Top -@anchor{gnat_rm/compatibility_and_porting_guide doc}@anchor{47d}@anchor{gnat_rm/compatibility_and_porting_guide compatibility-and-porting-guide}@anchor{17}@anchor{gnat_rm/compatibility_and_porting_guide id1}@anchor{47e} +@anchor{gnat_rm/compatibility_and_porting_guide doc}@anchor{481}@anchor{gnat_rm/compatibility_and_porting_guide compatibility-and-porting-guide}@anchor{17}@anchor{gnat_rm/compatibility_and_porting_guide id1}@anchor{482} @chapter Compatibility and Porting Guide @@ -31821,7 +31886,7 @@ applications developed in other Ada environments. @end menu @node Writing Portable Fixed-Point Declarations,Compatibility with Ada 83,,Compatibility and Porting Guide -@anchor{gnat_rm/compatibility_and_porting_guide id2}@anchor{47f}@anchor{gnat_rm/compatibility_and_porting_guide writing-portable-fixed-point-declarations}@anchor{480} +@anchor{gnat_rm/compatibility_and_porting_guide id2}@anchor{483}@anchor{gnat_rm/compatibility_and_porting_guide writing-portable-fixed-point-declarations}@anchor{484} @section Writing Portable Fixed-Point Declarations @@ -31943,7 +32008,7 @@ If you follow this scheme you will be guaranteed that your fixed-point types will be portable. @node Compatibility with Ada 83,Compatibility between Ada 95 and Ada 2005,Writing Portable Fixed-Point Declarations,Compatibility and Porting Guide -@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-ada-83}@anchor{481}@anchor{gnat_rm/compatibility_and_porting_guide id3}@anchor{482} +@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-ada-83}@anchor{485}@anchor{gnat_rm/compatibility_and_porting_guide id3}@anchor{486} @section Compatibility with Ada 83 @@ -31971,7 +32036,7 @@ following subsections treat the most likely issues to be encountered. @end menu @node Legal Ada 83 programs that are illegal in Ada 95,More deterministic semantics,,Compatibility with Ada 83 -@anchor{gnat_rm/compatibility_and_porting_guide id4}@anchor{483}@anchor{gnat_rm/compatibility_and_porting_guide legal-ada-83-programs-that-are-illegal-in-ada-95}@anchor{484} +@anchor{gnat_rm/compatibility_and_porting_guide id4}@anchor{487}@anchor{gnat_rm/compatibility_and_porting_guide legal-ada-83-programs-that-are-illegal-in-ada-95}@anchor{488} @subsection Legal Ada 83 programs that are illegal in Ada 95 @@ -32071,7 +32136,7 @@ the fix is usually simply to add the @code{(<>)} to the generic declaration. @end itemize @node More deterministic semantics,Changed semantics,Legal Ada 83 programs that are illegal in Ada 95,Compatibility with Ada 83 -@anchor{gnat_rm/compatibility_and_porting_guide id5}@anchor{485}@anchor{gnat_rm/compatibility_and_porting_guide more-deterministic-semantics}@anchor{486} +@anchor{gnat_rm/compatibility_and_porting_guide id5}@anchor{489}@anchor{gnat_rm/compatibility_and_porting_guide more-deterministic-semantics}@anchor{48a} @subsection More deterministic semantics @@ -32099,7 +32164,7 @@ which open select branches are executed. @end itemize @node Changed semantics,Other language compatibility issues,More deterministic semantics,Compatibility with Ada 83 -@anchor{gnat_rm/compatibility_and_porting_guide changed-semantics}@anchor{487}@anchor{gnat_rm/compatibility_and_porting_guide id6}@anchor{488} +@anchor{gnat_rm/compatibility_and_porting_guide changed-semantics}@anchor{48b}@anchor{gnat_rm/compatibility_and_porting_guide id6}@anchor{48c} @subsection Changed semantics @@ -32141,7 +32206,7 @@ covers only the restricted range. @end itemize @node Other language compatibility issues,,Changed semantics,Compatibility with Ada 83 -@anchor{gnat_rm/compatibility_and_porting_guide id7}@anchor{489}@anchor{gnat_rm/compatibility_and_porting_guide other-language-compatibility-issues}@anchor{48a} +@anchor{gnat_rm/compatibility_and_porting_guide id7}@anchor{48d}@anchor{gnat_rm/compatibility_and_porting_guide other-language-compatibility-issues}@anchor{48e} @subsection Other language compatibility issues @@ -32174,7 +32239,7 @@ include @code{pragma Interface} and the floating point type attributes @end itemize @node Compatibility between Ada 95 and Ada 2005,Implementation-dependent characteristics,Compatibility with Ada 83,Compatibility and Porting Guide -@anchor{gnat_rm/compatibility_and_porting_guide compatibility-between-ada-95-and-ada-2005}@anchor{48b}@anchor{gnat_rm/compatibility_and_porting_guide id8}@anchor{48c} +@anchor{gnat_rm/compatibility_and_porting_guide compatibility-between-ada-95-and-ada-2005}@anchor{48f}@anchor{gnat_rm/compatibility_and_porting_guide id8}@anchor{490} @section Compatibility between Ada 95 and Ada 2005 @@ -32246,7 +32311,7 @@ can declare a function returning a value from an anonymous access type. @end itemize @node Implementation-dependent characteristics,Compatibility with Other Ada Systems,Compatibility between Ada 95 and Ada 2005,Compatibility and Porting Guide -@anchor{gnat_rm/compatibility_and_porting_guide id9}@anchor{48d}@anchor{gnat_rm/compatibility_and_porting_guide implementation-dependent-characteristics}@anchor{48e} +@anchor{gnat_rm/compatibility_and_porting_guide id9}@anchor{491}@anchor{gnat_rm/compatibility_and_porting_guide implementation-dependent-characteristics}@anchor{492} @section Implementation-dependent characteristics @@ -32269,7 +32334,7 @@ transition from certain Ada 83 compilers. @end menu @node Implementation-defined pragmas,Implementation-defined attributes,,Implementation-dependent characteristics -@anchor{gnat_rm/compatibility_and_porting_guide id10}@anchor{48f}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-pragmas}@anchor{490} +@anchor{gnat_rm/compatibility_and_porting_guide id10}@anchor{493}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-pragmas}@anchor{494} @subsection Implementation-defined pragmas @@ -32291,7 +32356,7 @@ avoiding compiler rejection of units that contain such pragmas; they are not relevant in a GNAT context and hence are not otherwise implemented. @node Implementation-defined attributes,Libraries,Implementation-defined pragmas,Implementation-dependent characteristics -@anchor{gnat_rm/compatibility_and_porting_guide id11}@anchor{491}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-attributes}@anchor{492} +@anchor{gnat_rm/compatibility_and_porting_guide id11}@anchor{495}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-attributes}@anchor{496} @subsection Implementation-defined attributes @@ -32305,7 +32370,7 @@ Ada 83, GNAT supplies the attributes @code{Bit}, @code{Machine_Size} and @code{Type_Class}. @node Libraries,Elaboration order,Implementation-defined attributes,Implementation-dependent characteristics -@anchor{gnat_rm/compatibility_and_porting_guide id12}@anchor{493}@anchor{gnat_rm/compatibility_and_porting_guide libraries}@anchor{494} +@anchor{gnat_rm/compatibility_and_porting_guide id12}@anchor{497}@anchor{gnat_rm/compatibility_and_porting_guide libraries}@anchor{498} @subsection Libraries @@ -32334,7 +32399,7 @@ be preferable to retrofit the application using modular types. @end itemize @node Elaboration order,Target-specific aspects,Libraries,Implementation-dependent characteristics -@anchor{gnat_rm/compatibility_and_porting_guide elaboration-order}@anchor{495}@anchor{gnat_rm/compatibility_and_porting_guide id13}@anchor{496} +@anchor{gnat_rm/compatibility_and_porting_guide elaboration-order}@anchor{499}@anchor{gnat_rm/compatibility_and_porting_guide id13}@anchor{49a} @subsection Elaboration order @@ -32370,7 +32435,7 @@ pragmas either globally (as an effect of the `-gnatE' switch) or locally @end itemize @node Target-specific aspects,,Elaboration order,Implementation-dependent characteristics -@anchor{gnat_rm/compatibility_and_porting_guide id14}@anchor{497}@anchor{gnat_rm/compatibility_and_porting_guide target-specific-aspects}@anchor{498} +@anchor{gnat_rm/compatibility_and_porting_guide id14}@anchor{49b}@anchor{gnat_rm/compatibility_and_porting_guide target-specific-aspects}@anchor{49c} @subsection Target-specific aspects @@ -32383,10 +32448,10 @@ on the robustness of the original design. Moreover, Ada 95 (and thus Ada 2005 and Ada 2012) are sometimes incompatible with typical Ada 83 compiler practices regarding implicit packing, the meaning of the Size attribute, and the size of access values. -GNAT’s approach to these issues is described in @ref{499,,Representation Clauses}. +GNAT’s approach to these issues is described in @ref{49d,,Representation Clauses}. @node Compatibility with Other Ada Systems,Representation Clauses,Implementation-dependent characteristics,Compatibility and Porting Guide -@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-other-ada-systems}@anchor{49a}@anchor{gnat_rm/compatibility_and_porting_guide id15}@anchor{49b} +@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-other-ada-systems}@anchor{49e}@anchor{gnat_rm/compatibility_and_porting_guide id15}@anchor{49f} @section Compatibility with Other Ada Systems @@ -32429,7 +32494,7 @@ far beyond this minimal set, as described in the next section. @end itemize @node Representation Clauses,Compatibility with HP Ada 83,Compatibility with Other Ada Systems,Compatibility and Porting Guide -@anchor{gnat_rm/compatibility_and_porting_guide id16}@anchor{49c}@anchor{gnat_rm/compatibility_and_porting_guide representation-clauses}@anchor{499} +@anchor{gnat_rm/compatibility_and_porting_guide id16}@anchor{4a0}@anchor{gnat_rm/compatibility_and_porting_guide representation-clauses}@anchor{49d} @section Representation Clauses @@ -32522,7 +32587,7 @@ with thin pointers. @end itemize @node Compatibility with HP Ada 83,,Representation Clauses,Compatibility and Porting Guide -@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-hp-ada-83}@anchor{49d}@anchor{gnat_rm/compatibility_and_porting_guide id17}@anchor{49e} +@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-hp-ada-83}@anchor{4a1}@anchor{gnat_rm/compatibility_and_porting_guide id17}@anchor{4a2} @section Compatibility with HP Ada 83 @@ -32552,7 +32617,7 @@ extension of package System. @end itemize @node GNU Free Documentation License,Index,Compatibility and Porting Guide,Top -@anchor{share/gnu_free_documentation_license doc}@anchor{49f}@anchor{share/gnu_free_documentation_license gnu-fdl}@anchor{1}@anchor{share/gnu_free_documentation_license gnu-free-documentation-license}@anchor{4a0} +@anchor{share/gnu_free_documentation_license doc}@anchor{4a3}@anchor{share/gnu_free_documentation_license gnu-fdl}@anchor{1}@anchor{share/gnu_free_documentation_license gnu-free-documentation-license}@anchor{4a4} @chapter GNU Free Documentation License diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index 252b32f74ae..0b62540a2fd 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -29839,8 +29839,8 @@ to permit their use in free software. @printindex ge -@anchor{d2}@w{ } @anchor{gnat_ugn/gnat_utility_programs switches-related-to-project-files}@w{ } +@anchor{d2}@w{ } @c %**end of body @bye diff --git a/gcc/ada/par-ch11.adb b/gcc/ada/par-ch11.adb index d935b58807e..c988aa7099f 100644 --- a/gcc/ada/par-ch11.adb +++ b/gcc/ada/par-ch11.adb @@ -61,7 +61,7 @@ package body Ch11 is Handled_Stmt_Seq_Node := New_Node (N_Handled_Sequence_Of_Statements, Token_Ptr); Set_Statements - (Handled_Stmt_Seq_Node, P_Sequence_Of_Statements (SS_Extm_Sreq)); + (Handled_Stmt_Seq_Node, P_Sequence_Of_Statements (SS_Extm_Fitm_Sreq)); if Token = Tok_Exception then Scan; -- past EXCEPTION @@ -69,6 +69,12 @@ package body Ch11 is (Handled_Stmt_Seq_Node, Parse_Exception_Handlers); end if; + if Token = Tok_Finally then + Scan; -- past FINALLY + Set_Finally_Statements + (Handled_Stmt_Seq_Node, P_Sequence_Of_Statements (SS_Sreq)); + end if; + return Handled_Stmt_Seq_Node; end P_Handled_Sequence_Of_Statements; @@ -141,7 +147,8 @@ package body Ch11 is end loop; TF_Arrow; - Set_Statements (Handler_Node, P_Sequence_Of_Statements (SS_Sreq_Whtm)); + Set_Statements + (Handler_Node, P_Sequence_Of_Statements (SS_Sreq_Fitm_Whtm)); return Handler_Node; end P_Exception_Handler; diff --git a/gcc/ada/par-ch5.adb b/gcc/ada/par-ch5.adb index 6e6690395f1..f49c7eb3c14 100644 --- a/gcc/ada/par-ch5.adb +++ b/gcc/ada/par-ch5.adb @@ -408,6 +408,25 @@ package body Ch5 is exit; + -- Case of finally + + when Tok_Finally => + Test_Statement_Required; + + -- See the analogous comment in the Tok_Exception branch. + + if not SS_Flags.Fitm + and then Start_Column >= Scopes (Scope.Last).Ecol + then + Error_Msg_SC ("finally construct not permitted here"); + Scan; -- past FINALLY + Discard_Junk_List (P_Sequence_Of_Statements (SS_Sreq)); + end if; + + -- We exit like in the exception branch, should we really??? + + exit; + -- Case of OR when Tok_Or => diff --git a/gcc/ada/par-util.adb b/gcc/ada/par-util.adb index f254026431f..d93425aec76 100644 --- a/gcc/ada/par-util.adb +++ b/gcc/ada/par-util.adb @@ -199,6 +199,14 @@ package body Util is end if; end if; + if Ada_Version < Ada_With_All_Extensions then + if Token_Name = Name_Finally then + Error_Msg_N + ("& is a reserved word with all extensions enabled?", + Token_Node); + end if; + end if; + -- Note: we deliberately do not emit these warnings when operating in -- Ada 83 mode because in that case we assume the user is building -- legacy code anyway and is not interested in updating Ada versions. diff --git a/gcc/ada/par.adb b/gcc/ada/par.adb index 0df0c67daeb..c518fd43d62 100644 --- a/gcc/ada/par.adb +++ b/gcc/ada/par.adb @@ -400,6 +400,7 @@ function Par (Configuration_Pragmas : Boolean) return List_Id is Eftm : Boolean; -- ELSIF can terminate sequence Eltm : Boolean; -- ELSE can terminate sequence Extm : Boolean; -- EXCEPTION can terminate sequence + Fitm : Boolean; -- FINALLY can terminate sequence Ortm : Boolean; -- OR can terminate sequence Sreq : Boolean; -- at least one statement required Tatm : Boolean; -- THEN ABORT can terminate sequence @@ -408,15 +409,16 @@ function Par (Configuration_Pragmas : Boolean) return List_Id is end record; pragma Pack (SS_Rec); - SS_Eftm_Eltm_Sreq : constant SS_Rec := (T, T, F, F, T, F, F, F); - SS_Eltm_Ortm_Tatm : constant SS_Rec := (F, T, F, T, F, T, F, F); - SS_Extm_Sreq : constant SS_Rec := (F, F, T, F, T, F, F, F); - SS_None : constant SS_Rec := (F, F, F, F, F, F, F, F); - SS_Ortm_Sreq : constant SS_Rec := (F, F, F, T, T, F, F, F); - SS_Sreq : constant SS_Rec := (F, F, F, F, T, F, F, F); - SS_Sreq_Whtm : constant SS_Rec := (F, F, F, F, T, F, T, F); - SS_Whtm : constant SS_Rec := (F, F, F, F, F, F, T, F); - SS_Unco : constant SS_Rec := (F, F, F, F, F, F, F, T); + SS_Eftm_Eltm_Sreq : constant SS_Rec := (T, T, F, F, F, T, F, F, F); + SS_Eltm_Ortm_Tatm : constant SS_Rec := (F, T, F, F, T, F, T, F, F); + SS_Extm_Fitm_Sreq : constant SS_Rec := (F, F, T, T, F, T, F, F, F); + SS_None : constant SS_Rec := (F, F, F, F, F, F, F, F, F); + SS_Ortm_Sreq : constant SS_Rec := (F, F, F, F, T, T, F, F, F); + SS_Sreq : constant SS_Rec := (F, F, F, F, F, T, F, F, F); + SS_Sreq_Whtm : constant SS_Rec := (F, F, F, F, F, T, F, T, F); + SS_Sreq_Fitm_Whtm : constant SS_Rec := (F, F, F, T, F, T, F, T, F); + SS_Whtm : constant SS_Rec := (F, F, F, F, F, F, F, T, F); + SS_Unco : constant SS_Rec := (F, F, F, F, F, F, F, F, T); Goto_List : Elist_Id; -- List of goto nodes appearing in the current compilation. Used to diff --git a/gcc/ada/scans.adb b/gcc/ada/scans.adb index 580f90ee727..23aee522165 100644 --- a/gcc/ada/scans.adb +++ b/gcc/ada/scans.adb @@ -134,6 +134,9 @@ package body Scans is -- Ada 2012 reserved words Set_Reserved (Name_Some, Tok_Some); + + -- GNAT extensions reserved words + Set_Reserved (Name_Finally, Tok_Finally); end Initialize_Ada_Keywords; ------------------ diff --git a/gcc/ada/scans.ads b/gcc/ada/scans.ads index c445635262a..0fce5cc3162 100644 --- a/gcc/ada/scans.ads +++ b/gcc/ada/scans.ads @@ -159,6 +159,7 @@ package Scans is Tok_End, -- END Eterm, Sterm, After_SM Tok_Exception, -- EXCEPTION Eterm, Sterm, After_SM Tok_Exit, -- EXIT Eterm, Sterm, After_SM + Tok_Finally, -- FINALLY Eterm, Sterm, After_SM Tok_Goto, -- GOTO Eterm, Sterm, After_SM Tok_If, -- IF Eterm, Sterm, After_SM Tok_Pragma, -- PRAGMA Eterm, Sterm, After_SM diff --git a/gcc/ada/sem_ch11.adb b/gcc/ada/sem_ch11.adb index e1b68359059..0a4611552b1 100644 --- a/gcc/ada/sem_ch11.adb +++ b/gcc/ada/sem_ch11.adb @@ -443,6 +443,10 @@ package body Sem_Ch11 is elsif Present (At_End_Proc (N)) then Analyze (At_End_Proc (N)); end if; + + if Present (Finally_Statements (N)) then + Analyze_Statements (Finally_Statements (N)); + end if; end Analyze_Handled_Statements; ------------------------------ diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb index 944259a532a..5fc6001b254 100644 --- a/gcc/ada/sem_ch5.adb +++ b/gcc/ada/sem_ch5.adb @@ -1249,9 +1249,12 @@ package body Sem_Ch5 is begin -- Initialize unblocked exit count for statements of begin block - -- plus one for each exception handler that is present. + -- plus one for each exception handler that is present, plus one for + -- the finally part if it present. - Unblocked_Exit_Count := 1 + List_Length (EH); + Unblocked_Exit_Count := + 1 + List_Length (EH) + + (if Present (Finally_Statements (HSS)) then 1 else 0); -- If a label is present analyze it and mark it as referenced @@ -1706,6 +1709,33 @@ package body Sem_Ch5 is end if; end loop; + Finally_Legality_Check : declare + -- The following value can actually be a block statement due to + -- expansion, but we call it Target_Loop_Statement because it was + -- originally a loop statement. + Target_Loop_Statement : constant Node_Id := + (if Present (U_Name) then Label_Construct ((Parent (U_Name))) + else Empty); + + X : Node_Id := N; + begin + while Present (X) loop + if Nkind (X) = N_Loop_Statement + and then (No (Target_Loop_Statement) + or else X = Target_Loop_Statement) + then + exit; + elsif Nkind (Parent (X)) = N_Handled_Sequence_Of_Statements + and then Is_List_Member (X) + and then List_Containing (X) = Finally_Statements (Parent (X)) + then + Error_Msg_N ("cannot exit out of finally part", N); + exit; + end if; + X := Parent (X); + end loop; + end Finally_Legality_Check; + -- Verify that if present the condition is a Boolean expression if Present (Cond) then @@ -1767,6 +1797,28 @@ package body Sem_Ch5 is return; end if; + Finally_Legality_Check : declare + LCA : constant Union_Id := + Lowest_Common_Ancestor (N, Label_Construct (Parent (Label_Ent))); + + N1 : Union_Id := Union_Id (N); + N2 : Union_Id; + begin + while N1 /= LCA loop + N2 := Parent_Or_List_Containing (N1); + + if N2 in Node_Range + and then Nkind (Node_Id (N2)) = N_Handled_Sequence_Of_Statements + and then Union_Id (Finally_Statements (Node_Id (N2))) = N1 + then + Error_Msg_N ("cannot goto out of finally part", N); + exit; + end if; + + N1 := N2; + end loop; + end Finally_Legality_Check; + -- Here if goto passes initial validity checks Label_Scope := Enclosing_Scope (Label_Ent); diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 1e91bf810ef..d81bdc50ee0 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -2028,6 +2028,23 @@ package body Sem_Ch6 is End_Scope; end if; + Finally_Legality_Check : declare + X : Node_Id := N; + begin + while Present (X) loop + if Nkind (X) in N_Proper_Body then + exit; + elsif Nkind (Parent (X)) = N_Handled_Sequence_Of_Statements + and then Is_List_Member (X) + and then List_Containing (X) = Finally_Statements (Parent (X)) + then + Error_Msg_N ("cannot return out of finally part", N); + exit; + end if; + X := Parent (X); + end loop; + end Finally_Legality_Check; + Kill_Current_Values (Last_Assignment_Only => True); Check_Unreachable_Code (N); diff --git a/gcc/ada/sinfo-utils.adb b/gcc/ada/sinfo-utils.adb index 666024284ba..d3436b20ccb 100644 --- a/gcc/ada/sinfo-utils.adb +++ b/gcc/ada/sinfo-utils.adb @@ -25,6 +25,7 @@ with Atree; use Atree; with Debug; use Debug; +with GNAT.Lists; with Output; use Output; with Seinfo; with Sinput; use Sinput; @@ -346,6 +347,73 @@ package body Sinfo.Utils is end if; end Get_Pragma_Arg; + procedure Destroy_Element (Elem : in out Union_Id); + -- Does not do anything but is used to instantiate + -- GNAT.Lists.Doubly_Linked_Lists. + + --------------------- + -- Destroy_Element -- + --------------------- + + procedure Destroy_Element (Elem : in out Union_Id) is + begin + null; + end Destroy_Element; + + package Lists is + new GNAT.Lists.Doubly_Linked_Lists + (Element_Type => Union_Id, "=" => "=", + Destroy_Element => Destroy_Element, Check_Tampering => False); + + ---------------------------- + -- Lowest_Common_Ancestor -- + ---------------------------- + + function Lowest_Common_Ancestor (N1, N2 : Node_Id) return Union_Id is + function Path_From_Root (N : Node_Id) return Lists.Doubly_Linked_List; + + -------------------- + -- Path_From_Root -- + -------------------- + + function Path_From_Root (N : Node_Id) return Lists.Doubly_Linked_List is + L : constant Lists.Doubly_Linked_List := Lists.Create; + + X : Union_Id := Union_Id (N); + begin + while X /= Union_Id (Empty) loop + Lists.Prepend (L, X); + X := Parent_Or_List_Containing (X); + end loop; + + return L; + end Path_From_Root; + + L1 : Lists.Doubly_Linked_List := Path_From_Root (N1); + L2 : Lists.Doubly_Linked_List := Path_From_Root (N2); + + X1, X2 : Union_Id; + + Common_Ancestor : Union_Id := Union_Id (Empty); + begin + while not Lists.Is_Empty (L1) and then not Lists.Is_Empty (L2) loop + X1 := Lists.First (L1); + Lists.Delete_First (L1); + + X2 := Lists.First (L2); + Lists.Delete_First (L2); + + exit when X1 /= X2; + + Common_Ancestor := X1; + end loop; + + Lists.Destroy (L1); + Lists.Destroy (L2); + + return Common_Ancestor; + end Lowest_Common_Ancestor; + ---------------------- -- Set_End_Location -- ---------------------- diff --git a/gcc/ada/sinfo-utils.ads b/gcc/ada/sinfo-utils.ads index ebb96992802..632ebf95c54 100644 --- a/gcc/ada/sinfo-utils.ads +++ b/gcc/ada/sinfo-utils.ads @@ -137,6 +137,10 @@ package Sinfo.Utils is -- for the argument. This is Arg itself, or, in the case where Arg is a -- pragma argument association node, the expression from this node. + function Lowest_Common_Ancestor (N1, N2 : Node_Id) return Union_Id; + -- Returns the list or node that is the lowest common ancestor of N1 and + -- N2 in the syntax tree. + ----------------------- -- Utility Functions -- ----------------------- diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads index 06a976c935c..6abda7474bb 100644 --- a/gcc/ada/sinfo.ads +++ b/gcc/ada/sinfo.ads @@ -1300,6 +1300,10 @@ package Sinfo is -- Present in N_External_Initializer nodes. Contains a Source_File_Index -- that references the file the external initializer points to. + -- Finally_Statements + -- Present in N_Handled_Statement_Sequences nodes. Points to a list + -- containing statements. + -- First_Inlined_Subprogram -- Present in the N_Compilation_Unit node for the main program. Points -- to a chain of entities for subprograms that are to be inlined. The diff --git a/gcc/ada/snames.adb-tmpl b/gcc/ada/snames.adb-tmpl index 7f270b41f0e..d49fdf4d74a 100644 --- a/gcc/ada/snames.adb-tmpl +++ b/gcc/ada/snames.adb-tmpl @@ -431,7 +431,9 @@ package body Snames is -- for compatibility with Ada 95 compilers implementing -- only this Ada 2005 extension. and then (Ada_Version >= Ada_2012 - or else N not in Ada_2012_Reserved_Words); + or else N not in Ada_2012_Reserved_Words) + and then (Ada_Version >= Ada_With_All_Extensions + or else N not in GNAT_Extensions_Reserved_Words); end Is_Keyword_Name; -------------------------------- diff --git a/gcc/ada/snames.ads-tmpl b/gcc/ada/snames.ads-tmpl index 539b77d8411..59637940bee 100644 --- a/gcc/ada/snames.ads-tmpl +++ b/gcc/ada/snames.ads-tmpl @@ -1432,6 +1432,16 @@ package Snames is subtype Ada_2012_Reserved_Words is Name_Id range First_2012_Reserved_Word .. Last_2012_Reserved_Word; + -- GNAT extensions reserved words + + First_GNAT_Extensions_Reserved_Word : constant Name_Id := N + $; + Name_Finally : constant Name_Id := N + $; + Last_GNAT_Extensions_Reserved_Word : constant Name_Id := N + $; + + subtype GNAT_Extensions_Reserved_Words is Name_Id + range First_GNAT_Extensions_Reserved_Word .. + Last_GNAT_Extensions_Reserved_Word; + -- Mark last defined name for consistency check in Snames body Last_Predefined_Name : constant Name_Id := N + $; diff --git a/gcc/ada/warnsw.adb b/gcc/ada/warnsw.adb index 2bfb56ec513..a104dca97ea 100644 --- a/gcc/ada/warnsw.adb +++ b/gcc/ada/warnsw.adb @@ -110,6 +110,7 @@ package body Warnsw is X.Warning_Doc_Switch | X.Warn_On_Ada_2022_Compatibility | X.Warn_On_Elab_Access | + X.Warn_On_GNAT_Extension_Compatibility | X.No_Warn_On_Non_Local_Exception => False, others => True); -- Warning_Doc_Switch is not really a warning to be enabled, but controls diff --git a/gcc/ada/warnsw.ads b/gcc/ada/warnsw.ads index 0ca0f68e1ec..04ba566eef1 100644 --- a/gcc/ada/warnsw.ads +++ b/gcc/ada/warnsw.ads @@ -69,6 +69,7 @@ package Warnsw is Warn_On_Dereference, Warn_On_Elab_Access, Warn_On_Export_Import, + Warn_On_GNAT_Extension_Compatibility, Warn_On_Hiding, Warn_On_Ignored_Equality, Warn_On_Ineffective_Predicate_Test, @@ -128,6 +129,7 @@ package Warnsw is Warn_On_Assumed_Low_Bound | Warn_On_Biased_Representation | Warn_On_Export_Import | + Warn_On_GNAT_Extension_Compatibility | Warn_On_No_Value_Assigned | Warn_On_Questionable_Missing_Parens | Warn_On_Reverse_Bit_Order | @@ -328,6 +330,10 @@ package Warnsw is -- Set to True to generate warnings for suspicious use of export or -- import pragmas. Modified by use of -gnatwx/X. + Warn_On_GNAT_Extension_Compatibility : Boolean renames F (X.Warn_On_GNAT_Extension_Compatibility); + -- Set to True to generate all warnings on GNAT extension compatibility + -- issues. There is no switch controlling this option. + Warn_On_Hiding : Boolean renames F (X.Warn_On_Hiding); -- Set to True to generate warnings if a declared entity hides another -- entity. The default is that this warning is suppressed. Modified by diff --git a/gcc/ada/xsnamest.adb b/gcc/ada/xsnamest.adb index 3ee31d71847..c937124e55c 100644 --- a/gcc/ada/xsnamest.adb +++ b/gcc/ada/xsnamest.adb @@ -28,7 +28,7 @@ -- which the numbers are all written as $, and generates a new version of the -- spec file snames.ads (written to snames.ns). It also reads snames.adb-tmpl -- and generates an updated body (written to snames.nb), and snames.h-tmpl and --- generates an updated C header file (written to snames.nh). +-- generates an updated C header file (written to snames.h). with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Strings.Unbounded.Text_IO; use Ada.Strings.Unbounded.Text_IO; From patchwork Tue Jan 7 12:53:29 2025 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: 104249 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 47DF5385ED4C for ; Tue, 7 Jan 2025 13:13:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 47DF5385ED4C 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=Lm9kMkmb X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by sourceware.org (Postfix) with ESMTPS id A52D03857356 for ; Tue, 7 Jan 2025 12:54:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A52D03857356 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 A52D03857356 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::329 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254457; cv=none; b=C7t6foohfPELAnFkY40B3mzveRjnDlN5ZI8hLDbOoJd9i32q7fZuDCzu114zn/xSkDdrlNNhrPffihY1/C/Pc4jKzY3P/ZQgLZUxLoY7qHCMxiJBewIILn/oYmUMu8i5SAI5vqcA0imew0WzcSApc1SQG7+cyQIuAQMaJVl/LtQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254457; c=relaxed/simple; bh=DovkrZBT49k9zN7ETC+SK91dlercwBuk3sXKgEkdnrw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Xww9HGn9dT2NY+mkekxJYA3pVF7EgSDEUQi3X7KFivA9vJwHknw5OjqRdmJoO8DgH3ZqvnHZ8WtlVsXWXZQxiYyrX7iIqLfWUoDM5rgmK7RjpskSH5oOEgdUF07CEQNk0OUd5gsQOO75vX+V+zQ85lgPK7a+stm0/YNmB6ssGSM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A52D03857356 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-43634b570c1so110999495e9.0 for ; Tue, 07 Jan 2025 04:54:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1736254456; x=1736859256; 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=ZpEuK3LgJmoCQ2X4F4hiPkOtUuPM7yQhyzAM/CnXMaA=; b=Lm9kMkmbMZ2xpswjW/0rlSIJM9ahPwiXnHdUfyu0B0RFKBoZa5yLTQr/ItKwsbF3wT SGzOQOzMa78yP2MxWqRZMqjC8lLDqJ7ZW/9vZcaf218TGouVrXao/oTycQSC9o1tsKUA dneFlukH+b4yYekay5HEO18SEqmNJHeh+/yjievQ+AuLFZclwtGeVC6Nv7jSBMukUMa2 IhjKY9U71l2uSlM3xQkrOVXi7mvfxoXHy/83TgtuPdkcZMcLhR+6VrOUD8Hda4lWzks3 ba7enymfH500bLzBQ6DzFS/UKKDLo8sr9WzZd60491c6ShCJncQQivGILrdMsu5fOjju mEWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736254456; x=1736859256; 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=ZpEuK3LgJmoCQ2X4F4hiPkOtUuPM7yQhyzAM/CnXMaA=; b=EXrT96jg6mE0ucJ6bz9HAhake7C506xEtSt50pu7c2SLVtfKI7njSaRKNCQASRPRuu FKv6Q9QkaElB13V59D90J+g1ilJyR+CnwMbHzM10RJqBAxAKFjpKhZSrYEWKojC7PuNI yJ5v7OfNz77aVKYks3AHX+DVU6HDJO/8dOmPjPl1xieCSN+KCYkRdfZ0O9IWKN+h/KSJ HcNcxwzNVdpTYZvrm5qxQzMDkIc62v4EfGj6Dy2w8e2Sce7bhObP/NjzgJcMGGRvE0oD FvPptdCGhOaazYt5hZHLBTkso7JOhCA2mfPk1elcDXnX49EtCR0HSzbMMNuVR8fxg0mG 3iDA== X-Gm-Message-State: AOJu0YxFtH8LepYtP17UYI/owzTiC2hKKXRe3iNhwdkLvD/2msehPTuh 8w3zvm3ykqv6EGWUrCcOaEOLOjBn1iR7UgsOX6ymfzt4VHi4jnZOUEqmtbp/UrzFMRnZiesDsRg = X-Gm-Gg: ASbGncsyr2bSsmKwbFiNc4fvDHgZna4pQmdacY7soWxs4F5rZP1fiN83lsD0nNiN86W q3Mqr5lZz9Cw675HRymY2Zi60v3J1c9Jue3muv8W881tqO8G7hNascdbd6GqnDJxxfdRysn7k67 BK7+qAp1j5Al1iASB94FlVo3PoPiUtMwdP8lLqZNbAnIvJJUI6xUV4cTLFvJkTp7UOWanFiCpjs tJQYB9Jh3uaQHxaforJyqpzWNGUW3pUmUZ1GF0mosDUAAcn8cHl85pcXYs1tg6iiP00rG2yFWMk L3DzPi3jWSB7PgSLeH85DgodmJ2gzM7ZQ3dQNJUrG2vEMfVYsUKQd1SlfT1DpmOeqKTNM3O2 X-Google-Smtp-Source: AGHT+IGyNNjMXabY0j1jn5twAkRqTVAOmTYeStXgBs5c4mE+t8XFPTPlS+ayMJL5vujKqGTb9GRrCg== X-Received: by 2002:a05:6000:4021:b0:385:fa26:f0d8 with SMTP id ffacd0b85a97d-38a221e2f95mr55440610f8f.8.1736254456307; Tue, 07 Jan 2025 04:54:16 -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 5b1f17b1804b1-43656af6c42sm631014805e9.9.2025.01.07.04.54.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 04:54:15 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Alexandre Oliva Subject: [COMMITTED 11/31] ada: Drop vxworks-smp-ppc-link.spec Date: Tue, 7 Jan 2025 13:53:29 +0100 Message-ID: <20250107125350.619654-11-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250107125350.619654-1-poulhies@adacore.com> References: <20250107125350.619654-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~patchwork=sourceware.org@gcc.gnu.org From: Alexandre Oliva Adding -msmp to linker options in system-vxworks-ppc-rtp-smp.ads obviated vxworks-smp-ppc-link.spec. Drop it. gcc/ada/ChangeLog: * libgnat/system-vxworks-ppc-rtp-smp.ads: Drop --specs=vxworks-ppc-link.spec from Linker_Options. * vxworks-smp-ppc-link.spec: Delete. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/libgnat/system-vxworks-ppc-rtp-smp.ads | 1 - gcc/ada/vxworks-smp-ppc-link.spec | 4 ---- 2 files changed, 5 deletions(-) delete mode 100644 gcc/ada/vxworks-smp-ppc-link.spec diff --git a/gcc/ada/libgnat/system-vxworks-ppc-rtp-smp.ads b/gcc/ada/libgnat/system-vxworks-ppc-rtp-smp.ads index d4bcefd1a44..1896bfaec22 100644 --- a/gcc/ada/libgnat/system-vxworks-ppc-rtp-smp.ads +++ b/gcc/ada/libgnat/system-vxworks-ppc-rtp-smp.ads @@ -121,7 +121,6 @@ package System is private pragma Linker_Options ("-msmp"); - pragma Linker_Options ("--specs=vxworks-smp-ppc-link.spec"); pragma Linker_Options ("--specs=vxworks-ppc-link.spec"); -- Setup proper set of -L's for this configuration diff --git a/gcc/ada/vxworks-smp-ppc-link.spec b/gcc/ada/vxworks-smp-ppc-link.spec deleted file mode 100644 index b68cac22c14..00000000000 --- a/gcc/ada/vxworks-smp-ppc-link.spec +++ /dev/null @@ -1,4 +0,0 @@ -*lib: -+ %{mrtp:%{!shared: \ - -L%:getenv(WIND_BASE /target/lib_smp/usr/lib/ppc/PPC32/common) \ - }} From patchwork Tue Jan 7 12:53:30 2025 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: 104246 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 BA64538515CB for ; Tue, 7 Jan 2025 13:11:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BA64538515CB 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=fYS2vXS9 X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by sourceware.org (Postfix) with ESMTPS id 5D8053856268 for ; Tue, 7 Jan 2025 12:54:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5D8053856268 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 5D8053856268 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254458; cv=none; b=PTV7w8juh/qSTLyEM/6mdfTjG+/Pc41n3/MmLkMu9aAkVHGk6mOMP+Cs1vL6u8VRsQJN6bQsOJLI3Vl1b/ukU5gc6/vq72ZIfJdp9R8Oyc9SXjwvlcw/gbW18IqvJhSCCabJHZotypd8UobQKnm1nSZARgM8bSIViOinMp8xPH4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254458; c=relaxed/simple; bh=N9Z+0pCKl1/sgzHiQtPwJuXYEgE1z9xYyNYoGqGz9Dg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Tdgz3dm4+ZEJttm+jheN0w8w7DYokUvcBA7xFq39WKeZbkFTuFIKxBsJfPOilKtCALdkfuQ52K2dr1dV6hk+1QBXN7gPNVo+SPQSq+mQaKwwn2YUsi6de/AJ0SO+o2/hO9RKnTTU6Ls257cNjHEvJzuAvDO6i+ZRfo9Tiz1vrK8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5D8053856268 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-43634b570c1so110999595e9.0 for ; Tue, 07 Jan 2025 04:54:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1736254457; x=1736859257; 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=zyu/xEo7fzCLR0/j2GAwra0aNRW9b0eE6PeyfcCSjRE=; b=fYS2vXS90dOtNKra+5u0/48WhsLI2aQl8EM1PpTr6HRKkjSBoSD9Yw7/HOIWml6sOf rtSHbJmL3rs46lNGdDxbYcJxDRl14FytrRIAIEC4UakRsi71bQxU0Yex31PG3QZzUFMw bpMKyBpmMZ9u1gNU3M8VksvjNk41E4MUCrZNetMSO+0h9pNkuy3xhNx7GeLm+b3FsPsf Z9gWQTElU/81rAacXqfk55dtLWTlNkByMDLqG2I2eDa/i5AnHltwGRQnFXUGwXhxYSSA uzHstD1ZeOuWA+PoKc4Gmvbq3q9ajMDDGaTmbBziBJ0H9fUl+GAzEROz/Zp+TudGI140 +uEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736254457; x=1736859257; 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=zyu/xEo7fzCLR0/j2GAwra0aNRW9b0eE6PeyfcCSjRE=; b=LUmaq/u63SntP40d43pc1rYRUqxS+3G4fKxdAzym3Ty8awTk3DCPEYy8Sl1Ekb/Q5b 0axtU6rSNSI1dOmjkub5tJTH3NeX3yre901AoF1rzpg2XB7gVXcslhGoFXdiy0hXACPx 0B0NDAr+RIw/9eimkr/Q8jeC9mQGY2mQe7+BkPG6KnTC01BwKf7gZhCszMM6jyL1OC34 HyQ/Kh4lmLlC+MEQe6lTQzCCzi17UWTCN6Plb9uIYZP4/QaWe4bA2a24SbTekScqQjko HXyZ1RdJbkcpZ9VqKbwGe+/sBUD+Da5BFUpetOyYf8URniK4L9YJ1NvoXHkdMXsuPWei /emg== X-Gm-Message-State: AOJu0YwMF8gXp7+UMUjKpfL+i1t+7rXooLCRNC5AwlWaiDG4Erk8JyHU 8GfKNmeAY0l/YuBEjdLPRI7CydZkyWsF0f1Qot7WhWjUH04UFnwo45p/qNOEEY0qJEwj21cgNBc = X-Gm-Gg: ASbGncvUC82V8rg13v2/iw5pTOALy6iT8y3iQUGg+3y/PY1kwCFcdmQuFxoMM3NgtsN 2FYRdwpT4FWpzg3Nq7CLhBRdNl/VzDyk2y9P31vGbXPZDQop3cDl4wAXJPcc2/EAOSSCkII6scm jQgxU/FzlGKWbhfdK9CXnP92kiktrhFo3kD572FrXkY6JJsOD//rVQ3CGiCpqrT08qMAJa3LRsf xBNre5IQOijihR4pQ+UDheJ5TwlMntzu0fdRr3/eJvYig9bkI6JJhWL7LtJiXJZTSPugLoKMaoB pUJ675cK8+y5xx27JZ2BwtTPS/dmI+ypivhr/4ClW7TMbc4uQH4KdXhZtEASXQHphIjDDZg9 X-Google-Smtp-Source: AGHT+IGQhAEKKWtsEK1ay2S22DYKrt/yKj+0sH3/wA3ganwa7EZNRgdUYhlkRJVXIoq98Rx1F7uTlg== X-Received: by 2002:a05:600c:1549:b0:436:1c0c:bfb6 with SMTP id 5b1f17b1804b1-43668b78cd4mr489341505e9.27.1736254456997; Tue, 07 Jan 2025 04:54:16 -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 5b1f17b1804b1-43656af6c42sm631014805e9.9.2025.01.07.04.54.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 04:54:16 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 12/31] ada: Add guard to System.Val_Real.Large_Powfive against pathological input Date: Tue, 7 Jan 2025 13:53:30 +0100 Message-ID: <20250107125350.619654-12-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250107125350.619654-1-poulhies@adacore.com> References: <20250107125350.619654-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~patchwork=sourceware.org@gcc.gnu.org From: Eric Botcazou There is no need to keep multiplying the result once it saturates to +Inf. gcc/ada/ChangeLog: * libgnat/s-powflt.ads (Maxpow_Exact): Minor comment fix. * libgnat/s-powlfl.ads (Maxpow_Exact): Likewise. * libgnat/s-powllf.ads (Maxpow_Exact): Likewise. * libgnat/s-valrea.adb (Large_Powfive) [1 parameter]: Exit the loop as soon as the result saturates to +Inf. (Large_Powfive) [2 parameters]: Likewise. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/libgnat/s-powflt.ads | 2 +- gcc/ada/libgnat/s-powlfl.ads | 2 +- gcc/ada/libgnat/s-powllf.ads | 4 ++-- gcc/ada/libgnat/s-valrea.adb | 16 ++++++++++++++++ 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/gcc/ada/libgnat/s-powflt.ads b/gcc/ada/libgnat/s-powflt.ads index eadea7f914d..ae904f05617 100644 --- a/gcc/ada/libgnat/s-powflt.ads +++ b/gcc/ada/libgnat/s-powflt.ads @@ -36,7 +36,7 @@ package System.Powten_Flt is Maxpow_Exact : constant := 10; -- Largest power of five exactly representable with Float. It is equal to - -- floor (M * log 2 / log 5), when M is the size of the mantissa (24). + -- floor (M * log 2 / log 5), where M is the size of the mantissa (24). -- It also works for any number of the form 5*(2**N) and in particular 10. Maxpow : constant := Maxpow_Exact * 2; diff --git a/gcc/ada/libgnat/s-powlfl.ads b/gcc/ada/libgnat/s-powlfl.ads index 13630fcad40..2bf72d9c17d 100644 --- a/gcc/ada/libgnat/s-powlfl.ads +++ b/gcc/ada/libgnat/s-powlfl.ads @@ -36,7 +36,7 @@ package System.Powten_LFlt is Maxpow_Exact : constant := 22; -- Largest power of five exactly representable with Long_Float. It is equal - -- to floor (M * log 2 / log 5), when M is the size of the mantissa (53). + -- to floor (M * log 2 / log 5), where M is the size of the mantissa (53). -- It also works for any number of the form 5*(2**N) and in particular 10. Maxpow : constant := Maxpow_Exact * 2; diff --git a/gcc/ada/libgnat/s-powllf.ads b/gcc/ada/libgnat/s-powllf.ads index b470ae044de..b184b31ea9c 100644 --- a/gcc/ada/libgnat/s-powllf.ads +++ b/gcc/ada/libgnat/s-powllf.ads @@ -37,8 +37,8 @@ package System.Powten_LLF is Maxpow_Exact : constant := (if Long_Long_Float'Machine_Mantissa = 64 then 27 else 22); -- Largest power of five exactly representable with Long_Long_Float. It is - -- equal to floor (M * log 2 / log 5), when M is the size of the mantissa - -- assumed to be either 64 for IEEE Extended or 53 for IEEE Double. + -- equal to floor (M * log 2 / log 5), where M is the size of the mantissa + -- (assumed to be either 64 for IEEE Extended or 53 for IEEE Double). -- It also works for any number of the form 5*(2**N) and in particular 10. Maxpow : constant := Maxpow_Exact * 2; diff --git a/gcc/ada/libgnat/s-valrea.adb b/gcc/ada/libgnat/s-valrea.adb index f554280c0ea..3b0f0a99a63 100644 --- a/gcc/ada/libgnat/s-valrea.adb +++ b/gcc/ada/libgnat/s-valrea.adb @@ -336,6 +336,7 @@ package body System.Val_Real is pragma Import (Ada, Powfive_300); for Powfive_300'Address use Powfive_300_Address; + H : Double_T; R : Double_T; E : Natural; @@ -359,8 +360,15 @@ package body System.Val_Real is E := Exp - Maxpow; end if; + -- Accumulate 5**Maxpow into R until E <= Maxpow or R saturates to +Inf + while E > Maxpow loop + H := R; R := R * Powfive (Maxpow); + if R = H then + E := Maxpow; + exit; + end if; E := E - Maxpow; end loop; @@ -381,6 +389,7 @@ package body System.Val_Real is pragma Import (Ada, Powfive); for Powfive'Address use Powfive_Address; + H : Double_T; R : Double_T; E : Natural; @@ -407,8 +416,15 @@ package body System.Val_Real is S := 0; end if; + -- Accumulate 5**Maxpow into R until E <= Maxpow or R saturates to +Inf + while E > Maxpow loop + H := R; R := R * Powfive (Maxpow); + if R = H then + E := Maxpow; + exit; + end if; E := E - Maxpow; end loop; From patchwork Tue Jan 7 12:53:31 2025 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: 104247 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 6DD3C385DC13 for ; Tue, 7 Jan 2025 13:11:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6DD3C385DC13 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=SdJprf32 X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by sourceware.org (Postfix) with ESMTPS id 36236385626C for ; Tue, 7 Jan 2025 12:54:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 36236385626C 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 36236385626C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::336 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254464; cv=none; b=jPIJ+rfM4kWI0LHPgQFbjeF/UpTUGE8beXujPTCEfOt3Fk6rfmctamDdl8UfScpaZ1YhbNvwLt5/hZpKVIZA++Urm3WWy3jLpGwC5R9KPhHFbEkd91SI2GTP5A8pDzhua5w6KPpBNgkQ4mDgOc+BOl7VGiChD1AJlHNqtQpkdEE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254464; c=relaxed/simple; bh=WkfWw0azHV5He/6F/DB3iWeqqNFLNDshVL6HlQE9FUI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=euQ7lByp2pvnf3Rv52vYkoBLWIPNkSXokcax0jiFJ8WCibNVn+fucLAbKgfTZK077yyuiSafbGY3jFPjCb1jbPQcfEOZ5JEhwzIzYZxQTfm1q+4ITlAdSxAs74o2Jl2rdqrRvBmIRd4+K1EckLBnK6Ky+gSP+6ytgUCjvWMH39M= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 36236385626C Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-436202dd730so110881695e9.2 for ; Tue, 07 Jan 2025 04:54:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1736254458; x=1736859258; 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=io47pV4gySZJ6gk/0ap+KnWKiMmkwKAKAFoVnJ2u2ig=; b=SdJprf32GJyU8BNtF/ZvjSCPp3sJboP9+4JJL8LPeu+nzMHE8FQmlPilDjDrymvs4S Q84I++m+EkTfr5ZHiGPnblKeMHQyC7ItKBQ0KIlRpa31txkojKkmfUSt7BElUKQ2st0Z SiEyq7hJpcHAGCtoVh5EZJ7Hei9no43ISwtUMU4e3IQaELkW5wGrOXt04CSEONFiPrH/ gwCag3hKdKfoClOrkLIpaXhWLB0Ca1YDDVrteG/gLcxVbuNwhNim3zHe7y2dNpmGIhm9 4tkUIoNaGwTD8WWfcH75rANGllVwfwJbi2zg3P2CLmWuouag5xY05ahTUE+/SyCBdAu+ XeAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736254458; x=1736859258; 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=io47pV4gySZJ6gk/0ap+KnWKiMmkwKAKAFoVnJ2u2ig=; b=Dt0Z9X/5VlN49Ud1F9zYFBocMI0pWTSFBJ42/AX/mW3zUVAb6smbImCd9Y8p613Hq6 R5BHRdZ/4xz6aCzr2epqAWaGCaiHXTPr4QAnJIfTkLoUSt5RiRCXzgzHQHiBD3PCewPN c3ZJVdSnhKR+fCXVfohHdcccb3Ukf3LgMQoGBJ4ri2dWo3MjA8l2oPAc7+egG8EBTXyA GtFpw87iRbGF1Kc/8MQBPDjsvsZRRTzzcjto2b/+5A7jUNbZjOERhHLsFDg95lEZoxBO LTPL2cqvAR3qH+q5yBeIfwTSbN4UnC/Jwv8IHybxaBeumCvIsrXWchq/Xj8ney/u0nh6 VSBg== X-Gm-Message-State: AOJu0YwbC1jehEe0D7wv9YwHaceRbDWmu3HPSZDGBK+Qol46/VI2BUsy a44cVIY01ATmnvdFBdpn4py5XuiJd7jgqV/kkdTl7oDABb6P2yo2bmipFv29V8dEPTb+a0nLZDc = X-Gm-Gg: ASbGncv/bXCRxCDk3Qps5T0yymS2m4Lal4QKOVtjK6nOpSH7Gbw7c7eNUUXdDIprRI2 4FuFx2v1oEvzaxE6FGGdKl7Xpf+QvwhXB2i7f8E0Qr8KzWjqYxO7PVbI2tfoNbuViJOAvdrIZ0I yCuUbwcOu/GVqZw5ksXEcZSImhXODERcuw5tpWApdHrauqgB0gsCA1U+/BkQg6zVtWh2M2vYUHP 3CrhRZkCLDKc2pKEB7D7cNBJtlrOua05WxA+dWY5KHaxepl6Yqg9GcBXeg8Jb8J8G+vb+7c5WnJ PR+ktJodTdTBxPENd8eOMDqzMVOfp3Ch2VwwEuETtmLmsoNq9Yp3LedjK10Q/C4GawuSNcWR X-Google-Smtp-Source: AGHT+IFJa9YUceuzuB5H3VBY/XLBLvfxG09ffdphNb9Jas4P/F6+9oGy6RT+Jtu0uejkADKLgwcEvA== X-Received: by 2002:a05:600c:3596:b0:434:9dfe:20e6 with SMTP id 5b1f17b1804b1-43668b5dfc0mr468942495e9.23.1736254457822; Tue, 07 Jan 2025 04:54:17 -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 5b1f17b1804b1-43656af6c42sm631014805e9.9.2025.01.07.04.54.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 04:54:17 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 13/31] ada: Fix internal error on container aggregate for bounded vectors Date: Tue, 7 Jan 2025 13:53:31 +0100 Message-ID: <20250107125350.619654-13-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250107125350.619654-1-poulhies@adacore.com> References: <20250107125350.619654-1-poulhies@adacore.com> MIME-Version: 1.0 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, KAM_ASCII_DIVIDERS, 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~patchwork=sourceware.org@gcc.gnu.org From: Eric Botcazou The problem is that we analyze references to an object before the actual subtype of the object is established, thus creating a type mismatch that is flagged by the code generator. gcc/ada/ChangeLog: * exp_ch7.ads (Store_After_Actions_In_Scope_Without_Analysis): New procedure declaration. * exp_ch7.adb (Store_New_Actions_In_Scope): New procedure. (Store_Actions_In_Scope): Call Store_New_Actions_In_Scope when the target list is empty. (Store_After_Actions_In_Scope_Without_Analysis): New procedure body. * exp_aggr.adb (Expand_Container_Aggregate): For a declaration that is wrapped in a transient scope, also defer the analysis of the new code until after the declaration is analyzed. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_aggr.adb | 9 +++---- gcc/ada/exp_ch7.adb | 56 +++++++++++++++++++++++++++++++++++++------- gcc/ada/exp_ch7.ads | 7 ++++-- 3 files changed, 57 insertions(+), 15 deletions(-) diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index a51e02bc308..428115f81ba 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -7345,12 +7345,13 @@ package body Exp_Aggr is -- If a transient scope has been created around the declaration, we -- need to attach the code to it so that the finalization actions of - -- the declaration will be inserted after it. Otherwise, we directly - -- insert it after the declaration and it will be analyzed only once - -- the declaration is processed. + -- the declaration will be inserted after it; otherwise, we directly + -- insert it after the declaration. In both cases, the code will be + -- analyzed after the declaration is processed, i.e. once the actual + -- subtype of the object is established. if Scope_Is_Transient and then Par = Node_To_Be_Wrapped then - Insert_Actions_After (Par, Aggr_Code); + Store_After_Actions_In_Scope_Without_Analysis (Aggr_Code); else Insert_List_After (Par, Aggr_Code); end if; diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb index 171ad4ef395..a841d3af60f 100644 --- a/gcc/ada/exp_ch7.adb +++ b/gcc/ada/exp_ch7.adb @@ -514,7 +514,13 @@ package body Exp_Ch7 is -- cleanup actions are performed at the end of the block. procedure Store_Actions_In_Scope (AK : Scope_Action_Kind; L : List_Id); - -- Shared processing for Store_xxx_Actions_In_Scope + -- Shared processing for the Store_xxx_Actions_In_Scope routines: attach + -- the list L of actions to the list of actions stored in the top of the + -- scope stack specified by AK. + + procedure Store_New_Actions_In_Scope (AK : Scope_Action_Kind; L : List_Id); + -- Same as above for the case where the list of actions stored in the top + -- of the scope stack specified by AK is empty. ------------------------------------------- -- Unnesting procedures for CCG and LLVM -- @@ -8907,14 +8913,7 @@ package body Exp_Ch7 is begin if Is_Empty_List (Actions) then - Actions := L; - - if Is_List_Member (SE.Node_To_Be_Wrapped) then - Set_Parent (L, Parent (SE.Node_To_Be_Wrapped)); - else - Set_Parent (L, SE.Node_To_Be_Wrapped); - end if; - + Store_New_Actions_In_Scope (AK, L); Analyze_List (L); elsif AK = Before then @@ -8934,6 +8933,22 @@ package body Exp_Ch7 is Store_Actions_In_Scope (After, L); end Store_After_Actions_In_Scope; + --------------------------------------------------- + -- Store_After_Actions_In_Scope_Without_Analysis -- + --------------------------------------------------- + + procedure Store_After_Actions_In_Scope_Without_Analysis (L : List_Id) is + SE : Scope_Stack_Entry renames Scope_Stack.Table (Scope_Stack.Last); + Actions : List_Id renames SE.Actions_To_Be_Wrapped (After); + + begin + if Is_Empty_List (Actions) then + Store_New_Actions_In_Scope (After, L); + else + Insert_List_Before (First (Actions), L); + end if; + end Store_After_Actions_In_Scope_Without_Analysis; + ----------------------------------- -- Store_Before_Actions_In_Scope -- ----------------------------------- @@ -8952,6 +8967,29 @@ package body Exp_Ch7 is Store_Actions_In_Scope (Cleanup, L); end Store_Cleanup_Actions_In_Scope; + -------------------------------- + -- Store_New_Actions_In_Scope -- + -------------------------------- + + procedure Store_New_Actions_In_Scope (AK : Scope_Action_Kind; L : List_Id) + is + SE : Scope_Stack_Entry renames Scope_Stack.Table (Scope_Stack.Last); + Actions : List_Id renames SE.Actions_To_Be_Wrapped (AK); + + begin + pragma Assert (Is_Empty_List (Actions)); + + Actions := L; + + -- Set the Parent link to provide the context for the actions + + if Is_List_Member (SE.Node_To_Be_Wrapped) then + Set_Parent (L, Parent (SE.Node_To_Be_Wrapped)); + else + Set_Parent (L, SE.Node_To_Be_Wrapped); + end if; + end Store_New_Actions_In_Scope; + ------------------ -- Unnest_Block -- ------------------ diff --git a/gcc/ada/exp_ch7.ads b/gcc/ada/exp_ch7.ads index 22303d4c22f..d013eff9a45 100644 --- a/gcc/ada/exp_ch7.ads +++ b/gcc/ada/exp_ch7.ads @@ -311,7 +311,7 @@ package Exp_Ch7 is -- Return the node to be wrapped if the current scope is transient procedure Store_Before_Actions_In_Scope (L : List_Id); - -- Append the list L of actions to the end of the before-actions store in + -- Append the list L of actions to the end of the before-actions stored in -- the top of the scope stack (also analyzes these actions). procedure Store_After_Actions_In_Scope (L : List_Id); @@ -324,9 +324,12 @@ package Exp_Ch7 is -- last call executed first). Within the list L for a single call, the -- actions are executed in the order in which they appear in this list. + procedure Store_After_Actions_In_Scope_Without_Analysis (L : List_Id); + -- Same as above, but without analyzing the actions + procedure Store_Cleanup_Actions_In_Scope (L : List_Id); -- Prepend the list L of actions to the beginning of the cleanup-actions - -- store in the top of the scope stack. + -- stored in the top of the scope stack. procedure Wrap_Transient_Declaration (N : Node_Id); -- N is an object declaration. Expand the finalization calls after the From patchwork Tue Jan 7 12:53:32 2025 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: 104256 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 DDE2C3858427 for ; Tue, 7 Jan 2025 13:22:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DDE2C3858427 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=Tb3hcn9K X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by sourceware.org (Postfix) with ESMTPS id AC7A33856266 for ; Tue, 7 Jan 2025 12:54:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AC7A33856266 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 AC7A33856266 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254461; cv=none; b=cAqdWCbp/tRdeyeAyocERHEsrF0pO+2xbjLC/C6Wg9C3QABtUJnyhgUsiS9BIcbtofn8/wuPA5KhhxKdcv5QjX6D+JpTo4Vbpp9MVTTzMQ/+VZBb2VZ7yp6KvyxK6PIk2IKSwPjzcCHKy5F0nRZc/vm+z3dILPqxMH1pIXzvMSY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254461; c=relaxed/simple; bh=5lnTjRimlAza89dJQzuMnAxbtZWzC3Z9CwdFrYCeCl4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=fj/uOc3WkbjJMpK89xhgO8/EsW4r2paQAK3bKPddAK/ZNGXnS9opsd0MxFNUUA565bxAs1nux4zXUPHvIH6lMxBS86ZvpDgYlMziZQp4llB9o1qDXYYhiXW6BzMUADgapaRaDNH9IK8imCislYDukR3pLcnqwd1DLFC5ixwELIM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AC7A33856266 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-43621d27adeso107400425e9.2 for ; Tue, 07 Jan 2025 04:54:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1736254459; x=1736859259; 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=yRsU5k8GlapKFIwHSr2R/Og97B0IwwuZSaEPds3PQTU=; b=Tb3hcn9Kqv3yW4SzXN3gcdZ8o+aH+wsXR5cgS7DjFzawRqbwGP1tsSO9o4myZgMPu0 Zid7aeFqyU6sbYF61R4UHzfwdcTSVqz6ycK+G0jm3lnMJzEGjD6RJZWmKCiFyGgdUzsk uoTr7P4gov2Hk75FlqVBhKP3SG0pgFn1TZwD7pd5a3y1EcnJbGbsiupfHejEqxdv2JW0 eEOYhtFs4UXEYP5o6P7ee47H1u/vdyuSMcbX6BJVXg6WO7P7lOXtksbTEQxwid2YzVTv IeoTLaKznaHW9JB5deyx80SmuGhkmDC8O/PquDIntIsuFEn5YMtESiyuhenBmvTJ8VYf 4C8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736254459; x=1736859259; 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=yRsU5k8GlapKFIwHSr2R/Og97B0IwwuZSaEPds3PQTU=; b=MYXNRLurNdIeAxEAFcObEq52r5tzHWkTitODRBmIfkrNqJfiRVCkZW1pWtf+0XEua2 4MIa99O4Yq1vJVTgNFeFt0dU1n0J5pH3QGpg7bWCoATb7b7q9+uqBIyJqmEVPHeSgHLg Z4kzyUnlhyUYA/VAk8NQvLvMFv1UGKoHFlbYq9jCnfyRwZuolxN6+4TcsTGyAQIMoHKO itbiJpxfoacxMdpUlwuSNj7awsE66VlzqnQFjN9h3bMKZ3cnjxr2Mo1KbPSX+lV6/uOX 7rYtm641kgWNP/Eslu3qhTcFcmqxQarvnetlf7iJYaLGqwNHxt0SmnwLtHCwkx3KdwnF FUbg== X-Gm-Message-State: AOJu0YxueU+yAQC78D2yoB9kcMUGCl3NWjcrB1FsBcEChmoVabPXgmWO vZ6Mv3EYzrA1CPvNXpg8GLZt/7EnBxbLKdjHMYi/pPllY/Dxl0XxDyGEZAYnpiJlpJqQ8jZNljM = X-Gm-Gg: ASbGncu8wMHN1hA+KL9gJ5073e1O1r5aZ8g94KuEk4qhYF89TAg1SVVyhKOx8XLXmEo 5zbz0rTnxunbdDPMkydgqEiP1N1LqfxXlmPlHeE3Z/ZECRTM1w3KTKD+W2c9QXuDFNpXvVSCS8+ Pwe8SsO96hqXMSDS4M9ByNVtda7gl4zoVCsZE4UUVPep3WkepFSfJeKW6Wi5W7ChzUqlOJQwz4k ENf4oK53Fja+G40wKjx8paFyPLfjZa6huq3lZ8XqQvuCZ5EL/bzeV4M2jPreiGW+XVDM6kmTRCS mSbxKjsLOudFWgsUPA9weRS6N332JZhYPLk2MZvwW6uO8NECSAGONuTa3hnVnNMv3oGeHzws X-Google-Smtp-Source: AGHT+IEvihNYhvMYi1hyIflmHUftRfhjKyHtEwOM6li1h68qLNWC+BcqQSgu48uXHH0FJqNrBl6WOQ== X-Received: by 2002:a05:600c:1c1a:b0:434:eb73:b0c0 with SMTP id 5b1f17b1804b1-43668548301mr507412935e9.5.1736254459257; Tue, 07 Jan 2025 04:54:19 -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 5b1f17b1804b1-43656af6c42sm631014805e9.9.2025.01.07.04.54.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 04:54:18 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED 14/31] ada: Remove unnecessary qualifiers for First/Next list operations Date: Tue, 7 Jan 2025 13:53:32 +0100 Message-ID: <20250107125350.619654-14-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250107125350.619654-1-poulhies@adacore.com> References: <20250107125350.619654-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~patchwork=sourceware.org@gcc.gnu.org From: Piotr Trojanek Code cleanup related to work on expression functions for GNATprove (which require accessibility checks even when they are not expanded and thus have no explicit return statements). gcc/ada/ChangeLog: * accessibility.adb (First_Selector): Remove redundant and locally inconsistent parenthesis. (Check_Return_Construct_Accessibility): Remove qualifier from list operation. * sem_util.adb (Is_Prim_Of_Abst_Type_With_Nonstatic_CW_Pre_Post): Likewise. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/accessibility.adb | 6 +++--- gcc/ada/sem_util.adb | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/gcc/ada/accessibility.adb b/gcc/ada/accessibility.adb index 376eb9d0bb9..1d7d3a13786 100644 --- a/gcc/ada/accessibility.adb +++ b/gcc/ada/accessibility.adb @@ -1213,7 +1213,7 @@ package body Accessibility is return First (Choices (Assoc)); elsif Nkind (Assoc) = N_Discriminant_Association then - return (First (Selector_Names (Assoc))); + return First (Selector_Names (Assoc)); else raise Program_Error; @@ -1292,7 +1292,7 @@ package body Accessibility is exit; end if; - Nlists.Next (Return_Con); + Next (Return_Con); end loop; pragma Assert (Present (Return_Con)); @@ -1693,7 +1693,7 @@ package body Accessibility is if not Is_List_Member (Assoc) then exit; else - Nlists.Next (Assoc); + Next (Assoc); end if; end loop; end Check_Return_Construct_Accessibility; diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 24f27d08167..a11afa8be2d 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -12654,8 +12654,7 @@ package body Sem_Util is and then Class_Present (Prag) then Pragma_Arg := - Nlists.First - (Pragma_Argument_Associations (Prag)); + First (Pragma_Argument_Associations (Prag)); if not Is_Static_Expression (Expression (Pragma_Arg)) then return True; From patchwork Tue Jan 7 12:53:33 2025 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: 104244 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 1F895386100C for ; Tue, 7 Jan 2025 13:07:56 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id 63C423856277 for ; Tue, 7 Jan 2025 12:54:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 63C423856277 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 63C423856277 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::335 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254461; cv=none; b=kvc5cdxGOX+me/N9blsKU3hh1/FfvUjPCoKJE9BmhzKoB+KnD7HOV47SrQFgBSEFKI4krgYXvjuivZNfSpxm3Ohk/Rz4mL1cCT4lZvVxiwXDjgeoZBXdzsZG+JzWT9KKHUmHSp7qxJY+pEQsOaqXi0v//rePvblHgKke0C7Q2QM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254461; c=relaxed/simple; bh=6mIbIDX7wzMtq+igOuhKt0B4x75qyOogLplFK1gyGvo=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Y5NIDQp+vwpvtyJW2UOBRUxDN6rGR7/PNGxt7XBrO4HdnruuR/GVZ2Seph9euRC0dXeMDA0UQIwbVepDIlKN9rgVS7xXWzflCIYoAY/O8jL2Vc2kFec5IOOBrZkcD7E0MKjL7Aq9puTK4OvlEbRhdUO4Fsnlm3b5YwAff1djl4g= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 63C423856277 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=iPF3+yLh Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-436281c8a38so110871765e9.3 for ; Tue, 07 Jan 2025 04:54:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1736254460; x=1736859260; 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=zFD5TcqRhCrBwMoRKm6s5Xd07wxsFFTOXO6/hWUHO5c=; b=iPF3+yLh/bJAOlom7z9V/h54jQW/5Fy2gwOQUPTO/xtrZ9Md2TRqKD5z6AO484DC73 BbKc2np9hLm/yxNEsm8dAlH58HUZFbhMFOOlNacgsGtAHYiuZIPYonImRJfRqhdvmhUx Z6M3ks7EQML43nVSqon/gP+QNW9UQWzKATr7Y4tf/OXaTE0ETH1LI2TjPUxtJqDhOaBa UMb8jEnAny0OTJlKGGdfzVFf1+/u7BzwtLS3+HnGqmlYKhaf4/KT/4ODwdWIk0ofFv1c LqzGxHZpnycfg/JhQCBsmn5qj2GXMi1gH1E3eTEjVUHNef9yThuGeRiA2vGhZGrzipqu JPCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736254460; x=1736859260; 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=zFD5TcqRhCrBwMoRKm6s5Xd07wxsFFTOXO6/hWUHO5c=; b=ISmUcLjsg3QwAZLAPgNOVFTvm8nMQYreRIyLxfv4Y9mlbQs2bbXmBXT9q89OzpArG+ 96YquJz/X/rtoKL0h/TOBc+jCc5wpPMDXd6DjGXa1gXiNljO/2pYBmzZHUEWwb3578TV 89loRj6nLBjCYnNwJZX1ZnHAiRwUav6bTlIPt1c9n90Ik+lg/LINxvYj0QULNpH/ha1F 6SOiuHIcozRBw9/a15De9FvI/W9PFEjXOIfjqeRw0TJrscgw+fkNst5hF9FcJYRb0Osd yZD6+xyLreMjpOR0NbIewJSe7sZZTCrTd4I186LzBgNyDVlMWmFOhb8IrbRprxwIf119 6LpQ== X-Gm-Message-State: AOJu0Yx9rM6jn/LaFMU7+Fi3YSmg9ExveZPmkTF3BPO8r1DDKwlY5QsC pV/eRfbz46+VoU1av/pvLM0kZuBvBtXk8MFhFBinqzzfBW/xB7poiWYYKMrd0zGoKPStII+Genc = X-Gm-Gg: ASbGncv3aDLC2j+0g78JYOA3SuZ7rkteHlfkB1gB3dkzTLbKL4zxDKkkL22qqt1NDKY rjcq4NJg6LmMCG2RN2AOlEVUczR5gXMfkRu18xiS1kthaKU02aF2Eroseg1fOE+aLHzTq9RaJFB W+OpSrMONTNxLXV6yohE4Lt/2T8jiJvn9G+hUZHfKrAnb1akX02hUTzB7KZF1fhbdhtIxxpOXp4 bziGp2iPCoSthvM2dXS2NiKJ1alhm1vDIMJV7uffEvDaSMx8cQF+DViHKdPg8TeByapa0AMMsmD jplHQmgKfu/RPkRhQ3HzEo4AVNYh0Hvn4YHxVVpfnqlAcDFI8UE3kRxKNwFId5Pn3Oxw1XKX X-Google-Smtp-Source: AGHT+IFSiq5T8RkofCMg/9R4c2aB++hW4yykVS170cC6NmJkdpMt4xPdZ4yTHRSxDWwqgxqnmCvXaA== X-Received: by 2002:a05:600c:1d25:b0:434:fdf3:2c26 with SMTP id 5b1f17b1804b1-43668646362mr520813715e9.19.1736254460021; Tue, 07 Jan 2025 04:54:20 -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 5b1f17b1804b1-43656af6c42sm631014805e9.9.2025.01.07.04.54.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 04:54:19 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED 15/31] ada: Handle attributes related to Ada 2012 iterators as internal Date: Tue, 7 Jan 2025 13:53:33 +0100 Message-ID: <20250107125350.619654-15-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250107125350.619654-1-poulhies@adacore.com> References: <20250107125350.619654-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~patchwork=sourceware.org@gcc.gnu.org From: Piotr Trojanek Use existing machinery for internal attributes to handle attributes related to Ada 2012 iterators. All these attributes exist exclusively as a mean to delay processing. Code cleanup. The only change in behavior is the wording of error emitted when one of the internal attributes appears in source code: from "illegal attribute" (which used to be emitted in the analysis) to "unrecognized attribute (which is emitted by the parser). gcc/ada/ChangeLog: * exp_attr.adb (Expand_N_Attribute_Reference): Remove explicit handling of attributes related to Ada 2012 iterators. * sem_attr.adb (Analyze_Attribute, Eval_Attribute): Likewise; move attribute Reduce according to alphabetic order. * snames.adb-tmpl (Get_Attribute_Id): Add support for new internal attributes. * snames.ads-tmpl: Recognize names of new internal attributes. (Attribute_Id): Recognize new internal attributes. (Internal_Attribute_Id): Likewise. (Is_Internal_Attribute_Name): Avoid duplication in comment. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_attr.adb | 12 ------------ gcc/ada/sem_attr.adb | 32 +++++++------------------------- gcc/ada/snames.adb-tmpl | 33 ++++++++++++++++++++++++--------- gcc/ada/snames.ads-tmpl | 32 +++++++++++++++----------------- 4 files changed, 46 insertions(+), 63 deletions(-) diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb index 904293bbd1d..911b9dcf807 100644 --- a/gcc/ada/exp_attr.adb +++ b/gcc/ada/exp_attr.adb @@ -2266,18 +2266,6 @@ package body Exp_Attr is case Id is - -- Attributes related to Ada 2012 iterators. They are only allowed in - -- attribute definition clauses and should never be expanded. - - when Attribute_Constant_Indexing - | Attribute_Default_Iterator - | Attribute_Implicit_Dereference - | Attribute_Iterable - | Attribute_Iterator_Element - | Attribute_Variable_Indexing - => - raise Program_Error; - -- Internal attributes used to deal with Ada 2012 delayed aspects. These -- were already rejected by the parser. Thus they shouldn't appear here. diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 7295784704f..53b96501d78 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -3423,18 +3423,6 @@ package body Sem_Attr is case Attr_Id is - -- Attributes related to Ada 2012 iterators. Attribute specifications - -- exist for these, but they cannot be queried. - - when Attribute_Constant_Indexing - | Attribute_Default_Iterator - | Attribute_Implicit_Dereference - | Attribute_Iterator_Element - | Attribute_Iterable - | Attribute_Variable_Indexing - => - Error_Msg_N ("illegal attribute", N); - -- Internal attributes used to deal with Ada 2012 delayed aspects. These -- were already rejected by the parser. Thus they shouldn't appear here. @@ -9015,19 +9003,6 @@ package body Sem_Attr is case Id is - -- Attributes related to Ada 2012 iterators; nothing to evaluate for - -- these. - - when Attribute_Constant_Indexing - | Attribute_Default_Iterator - | Attribute_Implicit_Dereference - | Attribute_Iterator_Element - | Attribute_Iterable - | Attribute_Reduce - | Attribute_Variable_Indexing - => - null; - -- Internal attributes used to deal with Ada 2012 delayed aspects. -- These were already rejected by the parser. Thus they shouldn't -- appear here. @@ -10208,6 +10183,13 @@ package body Sem_Attr is end case; end Range_Length; + ------------ + -- Reduce -- + ------------ + + when Attribute_Reduce => + null; + --------- -- Ref -- --------- diff --git a/gcc/ada/snames.adb-tmpl b/gcc/ada/snames.adb-tmpl index d49fdf4d74a..62ca4de4866 100644 --- a/gcc/ada/snames.adb-tmpl +++ b/gcc/ada/snames.adb-tmpl @@ -125,15 +125,30 @@ package body Snames is function Get_Attribute_Id (N : Name_Id) return Attribute_Id is begin - if N = Name_CPU then - return Attribute_CPU; - elsif N = Name_Dispatching_Domain then - return Attribute_Dispatching_Domain; - elsif N = Name_Interrupt_Priority then - return Attribute_Interrupt_Priority; - else - return Attribute_Id'Val (N - First_Attribute_Name); - end if; + case N is + when Name_Constant_Indexing => + return Attribute_Constant_Indexing; + when Name_CPU => + return Attribute_CPU; + when Name_Default_Iterator => + return Attribute_Default_Iterator; + when Name_Dispatching_Domain => + return Attribute_Dispatching_Domain; + when Name_Implicit_Dereference => + return Attribute_Implicit_Dereference; + when Name_Interrupt_Priority => + return Attribute_Interrupt_Priority; + when Name_Iterable => + return Attribute_Iterable; + when Name_Iterator_Element => + return Attribute_Iterator_Element; + when Name_Variable_Indexing => + return Attribute_Variable_Indexing; + when First_Attribute_Name .. Last_Attribute_Name => + return Attribute_Id'Val (N - First_Attribute_Name); + when others => + raise Program_Error; + end case; end Get_Attribute_Id; ----------------------- diff --git a/gcc/ada/snames.ads-tmpl b/gcc/ada/snames.ads-tmpl index 59637940bee..4e0d94f5113 100644 --- a/gcc/ada/snames.ads-tmpl +++ b/gcc/ada/snames.ads-tmpl @@ -943,12 +943,10 @@ package Snames is Name_Compiler_Version : constant Name_Id := N + $; -- GNAT Name_Component_Size : constant Name_Id := N + $; Name_Compose : constant Name_Id := N + $; - Name_Constant_Indexing : constant Name_Id := N + $; -- GNAT Name_Constrained : constant Name_Id := N + $; Name_Count : constant Name_Id := N + $; Name_Default_Bit_Order : constant Name_Id := N + $; -- GNAT Name_Default_Scalar_Storage_Order : constant Name_Id := N + $; -- GNAT - Name_Default_Iterator : constant Name_Id := N + $; -- GNAT Name_Definite : constant Name_Id := N + $; Name_Delta : constant Name_Id := N + $; Name_Denorm : constant Name_Id := N + $; @@ -975,13 +973,10 @@ package Snames is Name_Has_Same_Storage : constant Name_Id := N + $; -- Ada 12 Name_Has_Tagged_Values : constant Name_Id := N + $; -- GNAT Name_Identity : constant Name_Id := N + $; - Name_Implicit_Dereference : constant Name_Id := N + $; -- GNAT Name_Index : constant Name_Id := N + $; -- Ada 22 Name_Initialized : constant Name_Id := N + $; -- GNAT Name_Integer_Value : constant Name_Id := N + $; -- GNAT Name_Invalid_Value : constant Name_Id := N + $; -- GNAT - Name_Iterator_Element : constant Name_Id := N + $; -- GNAT - Name_Iterable : constant Name_Id := N + $; -- GNAT Name_Large : constant Name_Id := N + $; -- Ada 83 Name_Last : constant Name_Id := N + $; Name_Last_Bit : constant Name_Id := N + $; @@ -1063,7 +1058,6 @@ package Snames is Name_Valid : constant Name_Id := N + $; Name_Valid_Scalars : constant Name_Id := N + $; -- GNAT Name_Value_Size : constant Name_Id := N + $; -- GNAT - Name_Variable_Indexing : constant Name_Id := N + $; -- GNAT Name_Version : constant Name_Id := N + $; Name_Wchar_T_Size : constant Name_Id := N + $; -- GNAT Name_Wide_Wide_Width : constant Name_Id := N + $; -- Ada 05 @@ -1152,10 +1146,16 @@ package Snames is -- internal attributes is not permitted). First_Internal_Attribute_Name : constant Name_Id := N + $; + Name_Constant_Indexing : constant Name_Id := N + $; -- GNAT Name_CPU : constant Name_Id := N + $; + Name_Default_Iterator : constant Name_Id := N + $; -- GNAT Name_Dispatching_Domain : constant Name_Id := N + $; + Name_Implicit_Dereference : constant Name_Id := N + $; -- GNAT Name_Interrupt_Priority : constant Name_Id := N + $; + Name_Iterable : constant Name_Id := N + $; -- GNAT + Name_Iterator_Element : constant Name_Id := N + $; -- GNAT Name_Secondary_Stack_Size : constant Name_Id := N + $; -- GNAT + Name_Variable_Indexing : constant Name_Id := N + $; -- GNAT Last_Internal_Attribute_Name : constant Name_Id := N + $; -- Names of recognized locking policy identifiers @@ -1480,12 +1480,10 @@ package Snames is Attribute_Compiler_Version, Attribute_Component_Size, Attribute_Compose, - Attribute_Constant_Indexing, Attribute_Constrained, Attribute_Count, Attribute_Default_Bit_Order, Attribute_Default_Scalar_Storage_Order, - Attribute_Default_Iterator, Attribute_Definite, Attribute_Delta, Attribute_Denorm, @@ -1512,13 +1510,10 @@ package Snames is Attribute_Has_Same_Storage, Attribute_Has_Tagged_Values, Attribute_Identity, - Attribute_Implicit_Dereference, Attribute_Index, Attribute_Initialized, Attribute_Integer_Value, Attribute_Invalid_Value, - Attribute_Iterator_Element, - Attribute_Iterable, Attribute_Large, Attribute_Last, Attribute_Last_Bit, @@ -1600,7 +1595,6 @@ package Snames is Attribute_Valid, Attribute_Valid_Scalars, Attribute_Value_Size, - Attribute_Variable_Indexing, Attribute_Version, Attribute_Wchar_T_Size, Attribute_Wide_Wide_Width, @@ -1662,12 +1656,18 @@ package Snames is -- the special processing required to deal with the fact that their -- names are not attribute names. + Attribute_Constant_Indexing, Attribute_CPU, + Attribute_Default_Iterator, Attribute_Dispatching_Domain, - Attribute_Interrupt_Priority); + Attribute_Implicit_Dereference, + Attribute_Interrupt_Priority, + Attribute_Iterable, + Attribute_Iterator_Element, + Attribute_Variable_Indexing); subtype Internal_Attribute_Id is Attribute_Id - range Attribute_CPU .. Attribute_Interrupt_Priority; + range Attribute_Constant_Indexing .. Attribute_Variable_Indexing; type Attribute_Set is array (Attribute_Id) of Boolean; -- Type used to build attribute classification flag arrays @@ -2058,9 +2058,7 @@ package Snames is -- i.e. an attribute reference that returns an entity. function Is_Internal_Attribute_Name (N : Name_Id) return Boolean; - -- Test to see if the name N is the name of an INT attribute (Name_CPU, - -- Name_Dispatching_Domain, Name_Interrupt_Priority, - -- Name_Secondary_Stack_Size). + -- Test to see if the name N is the name of an internal attribute function Is_Procedure_Attribute_Name (N : Name_Id) return Boolean; -- Test to see if the name N is the name of a recognized attribute that From patchwork Tue Jan 7 12:53:34 2025 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: 104233 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 EE10B385DDC8 for ; Tue, 7 Jan 2025 12:58:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EE10B385DDC8 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=hDW3wYO7 X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id 14A543856276 for ; Tue, 7 Jan 2025 12:54:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 14A543856276 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 14A543856276 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::335 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254462; cv=none; b=JJB8nunE6wRAICWEE22Oac/3YYPWxIICJn6EDkIoPpkzviNJhgawGqwDt79+xquWLFNOiLkxPpdxD6t0ZHhB1bsPDiBAeVZvoeBMeSdLtwb4lsP7aif3NZpsKVgXYgob5ZD/zE7noAwqvN6asscohUrKTg+3QTLRG9jp13BED28= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254462; c=relaxed/simple; bh=8FNbw5H6WskdMfZ59YEiuGmGwCAeft7OV8iRJoxCPTI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=acuylOYkurFnySz6b+bl93VjbZFPG+p22RgZWj8Y06uClWJUoFvpy49ddOqkpz/18PEhq827Z2qKJmof4+Zq0WLoz4ZFV2TbvskHDVHvseAldhe7xIURf6hh+NEjWBuxK0gF0QTUuW3NyuVGmFhFqTxU6qmTDQo3jsH+kEo73e4= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 14A543856276 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-43626213fffso95874215e9.1 for ; Tue, 07 Jan 2025 04:54:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1736254461; x=1736859261; 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=tJ1WAnhjC2cRUcwAF780wirjG/7FFQ9Kv6lj3IVpJng=; b=hDW3wYO7/YrTLwNxXKaIIuq37ksiDPskgx95lHrE7aJEMaQVMcoKfA56mI6XtIu7wg ulMBdUxZWRRkapuzzcc2o3kWBKlrgxQZIMIiigGQ8SYlv0U8fRC5Qrw+c/l01Z2kOehj s61M7ggAg+lgx35TxcuZizH9++5l7gl2CfnKQFhxNNsYFa6Veun05j+4apMFkggiHaGa 8xLIt+CATNmRZeaCnZt9JH8vnj5r6nqmWlV8iM2dB9AgVpDeViiuGqJcDq/SLo63a5Lt OLYnrfhgvkgGOBUZ6Rp8wAY7lieUao0P6Kk25Y7D6DdEGhDTSF953TdnN5S3xu5fo0eO yLlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736254461; x=1736859261; 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=tJ1WAnhjC2cRUcwAF780wirjG/7FFQ9Kv6lj3IVpJng=; b=W14baM3jymN9hvT2/z2udh92czkXJJHPiyveZmhPTMTp9c4hWzUbPB8uosDvoEZ8GN Bthave2Iqg5XVjq4dfigwT/jHHosRBZCMKPXUfur7OWfZbFOkkP4uPq8c40OdpzvTQwY Q5tzcmdQ+XD8Fmoe2krmyCEyQnVZu4lI5FDsr8sdHRG/BAEQY8B98biryN7U2AFQsKi2 NeSttxcIuLHI+OaTiXqvckDB0WUV+WZ+S13aHmSO4wwHy43OOAwsifHG/eJGC70dZ8xc N52sRP11tlca/JWII4tqYPupnZc0Nuex+os7tMSdjdiE9CpoCXVaegnx8xCjIULZEAQd wIrA== X-Gm-Message-State: AOJu0YxdX3PbXSTHF4EzK/xhH0OdteO/FSwikxgL4LYZ4SnM1Y5U+dGl +RYToa0ruK+iU95Rho/S+Tb2/dMLo6A60hwgKGjFlP+e6FBy2634WouLFoqceNQl5TRj+AUEccA = X-Gm-Gg: ASbGncvKlgS60LdwMx5S1H+7qBiqcgt7iCShvvXeIUG3/dYjgtkVefY9Qc8YfuxrA0V 46R7dl4sUuI1lETRlfhKtjCgGvt3AxpHhm8758gHk+ulDD86MYNzJ+FMngrMnMDXYuvxuzNfqil bP00auOjbjWwIhOdVEB2gYZAyh2QgV8ysviKl/JOEO0WNoKqWHVQhHZNOxjCxhbsSnDS5pY+/R5 Yw4WqvIIGGEcVKpDU6IsY3m6SVtI778mrVtaXLWBhjoQXpAYD0Ay5TWW0/bGqdCV/jny0Wx3Jz/ rbjC+FKNuWSdMg+BaWWn6MjpVvy5zZZziwQ57DKHbL61zefT6CPnLRbJUnXElahyPLWu0bI7 X-Google-Smtp-Source: AGHT+IF8OQLc6bNKzy5Tm1ktg7xja5OeMucsn3yFHdZroJiMYhyjB4NDjJrpy7bq5gPTEdYY8VUiQg== X-Received: by 2002:a05:600c:1f93:b0:434:fa73:a906 with SMTP id 5b1f17b1804b1-436dcab6a20mr17089365e9.4.1736254460761; Tue, 07 Jan 2025 04:54:20 -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 5b1f17b1804b1-43656af6c42sm631014805e9.9.2025.01.07.04.54.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 04:54:20 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED 16/31] ada: Untangle check for restriction No_Implementation_Attributes Date: Tue, 7 Jan 2025 13:53:34 +0100 Message-ID: <20250107125350.619654-16-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250107125350.619654-1-poulhies@adacore.com> References: <20250107125350.619654-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~patchwork=sourceware.org@gcc.gnu.org From: Piotr Trojanek Code cleanup; given that no attribute is both defined by Ada 83 and specific to GNAT, the semantics is unaffected. gcc/ada/ChangeLog: * sem_attr.adb (Analyze_Attribute): Simplify logic. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_attr.adb | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 53b96501d78..39725d23442 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -3214,26 +3214,23 @@ package body Sem_Attr is -- Deal with Ada 83 issues - if not Attribute_83 (Attr_Id) then - if Ada_Version = Ada_83 then - Error_Msg_Name_1 := Aname; - Error_Msg_N ("(Ada 83) attribute% is not standard??", N); - end if; - - if Attribute_Impl_Def (Attr_Id) then - Check_Restriction (No_Implementation_Attributes, N); - end if; + if not Attribute_83 (Attr_Id) and then Ada_Version = Ada_83 then + Error_Msg_Name_1 := Aname; + Error_Msg_N ("(Ada 83) attribute% is not standard??", N); end if; -- Deal with Ada 2005 attributes that are implementation attributes -- because they appear in a version of Ada before Ada 2005, ditto for -- Ada 2012 and Ada 2022 attributes appearing in an earlier version. + -- Likewise for GNAT implementation-defined attributes. if (Attribute_05 (Attr_Id) and then Ada_Version < Ada_2005) or else (Attribute_12 (Attr_Id) and then Ada_Version < Ada_2012) or else (Attribute_22 (Attr_Id) and then Ada_Version < Ada_2022) + or else + Attribute_Impl_Def (Attr_Id) then Check_Restriction (No_Implementation_Attributes, N); end if; From patchwork Tue Jan 7 12:53:35 2025 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: 104236 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 841073851AA0 for ; Tue, 7 Jan 2025 13:03:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 841073851AA0 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=HO099+cv X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id E1C6A385627D for ; Tue, 7 Jan 2025 12:54:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E1C6A385627D 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 E1C6A385627D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::42e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254463; cv=none; b=gVl80O2KoREv6srbicz/JIDQlSKWOeMI8jPn703YydshjTixU1tnUlMA6NaFPVaXqZA6rDZkCGYp+Z1q9xO7+3wGmBlQ9JugN0SC7jx/Bzg27jrXSYTeapRwfIuRL2DJ+v/H3bX0n57mEHlhQJW8bZxMtOBocWa5KxidEg29J4w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254463; c=relaxed/simple; bh=bPtRw37xeeCVr1kfEKcpBBnCm94t9cuAje5hj09NHC0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=aSl5Dhtg9ZlFgW2EYUpHH6rbwNQtYkL5jhM2okG+Pn05OYD6nvyfky9NFAY0xZ3/ARE3oX5pGW7+hnofME+GjzL9apiPAMszOboA7AhAxwlx9T1nWau2gWJ32oXARr2IQx2Vtmp5n/4FVzSUTN3qvnDeZ2Rw1pYkj1ukqecAsck= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E1C6A385627D Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-385e27c75f4so11166699f8f.2 for ; Tue, 07 Jan 2025 04:54:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1736254461; x=1736859261; 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=C8sSOPv1U1NXmuEPG5WBTVY+6L/QTr7ODyWOYVI6HOs=; b=HO099+cveLsVROF7XtDTGCbRPJ8+IjBetaHM3VRB49yUroWDVYKjGsDkocfPN6wZN8 eno+9hxzRekVCH39sENQcjr0raemEpD8Mw3/17dBnYDGsRrsDdMpOlHp1JZO+kJHa4bR X3WOiFJ9RHwux6zXCElNCZ5KKRlHqwgGGdd4S9YYZNXxcNCVvuWKTW4qRAklmVUXfDsk UUzCE25VfvoXjYPRM7k2PPBqnLosNaUA5coUAiwUF/0uz+793aNkfgeWJ0WihF16+XYY hTJnuK3MrXZIEBztEZUh8XDSVOuiSU1CCvK3wIlIrT50x5yuifW030ApqYW82KuhN4PO fulw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736254461; x=1736859261; 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=C8sSOPv1U1NXmuEPG5WBTVY+6L/QTr7ODyWOYVI6HOs=; b=Lirm2lWfgATHqWVnVC2xJlRFcFOavomZUjrWXc/hZh4G2T3sCwRTG7Bekl86rU2+jP SQQRSMsZpXx6nty+Nt33YNtnPJW6JRMJfw8ExQd3Q1xEngUD5HbiL8Ppko9/Ej6psV+2 bPCtu1G5XhZq/Z3KJPLncg6+s0JlnhxB19nUQU5uOZU70PY7xzbekYIxnb8ngSaDuDU8 pMQ4Bzo6u96UhT4Vkzwne/CAiy5xxrxiGfZuaqC5RRVNDRPqtUUQDWMEDQ1wtwCA/H1J 8upiP7fnWl6w0LATXvNWPACMYs/GX7XclNFPe999hU95O7i5ric1oXjDfWijZfd0sUBo oj6w== X-Gm-Message-State: AOJu0Yy/0x2SoNMvXrNaQWUW5nJ4yTkPsh62pwr20Nod7rEKzq/uJNAd k0V2eHr11U1AT5h2AdBA0jN4+gE1DfBnPG1BjJeQMjEI2a1+bpXw5SnhNvyZTtgPYavG0GoKCis = X-Gm-Gg: ASbGncsZz9BAHq8C+hpkPu+fTK5ajJQX/QdAzpgnz9izETKWz7vlVoPNCPH0pkio+wb vsy7cO68/pqwAU9WF6sF3qjDNa8dQ2D7bUQjbUptjFfiKg6r8maFfdWnMtQ5IHvk4s0hpWaRTnj xm5Nr7cwEwIA+nbv/716ouQvu9pXbLpB4MAdbGBvW1hl4oDMyZsJsi4j9rwf8oz+UCXyU5FGOsI hqjPyOpGpnMUmEkiUY+QMCX4fLJkeXIJLEButgHH3glL1aqKx3YrhHdojjYJRv6nEIScj4wZKHC s/HYiEuLuDj2b69PTeB9kUoWFm+8FI7qqxtzjnd2MOMLghexjzUNtmrh499YC5/Av5QNEDE8 X-Google-Smtp-Source: AGHT+IH70H7WiY59T4c9ZTpAXjRpYxZS4bRUcRUJHIF/DHXebqPE2+HpEtiWxnra7V3mWlY2tcv10Q== X-Received: by 2002:a5d:6d84:0:b0:385:f1d9:4b90 with SMTP id ffacd0b85a97d-38a221ea720mr52274710f8f.13.1736254461594; Tue, 07 Jan 2025 04:54:21 -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 5b1f17b1804b1-43656af6c42sm631014805e9.9.2025.01.07.04.54.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 04:54:21 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED 17/31] ada: Avoid conversion from String to Name_Id at runtime Date: Tue, 7 Jan 2025 13:53:35 +0100 Message-ID: <20250107125350.619654-17-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250107125350.619654-1-poulhies@adacore.com> References: <20250107125350.619654-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~patchwork=sourceware.org@gcc.gnu.org From: Piotr Trojanek Code cleanup. gcc/ada/ChangeLog: * sem_prag.adb (Analyze_Attribute): Replace runtime conversion with existing constant. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_prag.adb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 64b5b01869d..defa0d78794 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -14791,7 +14791,7 @@ package body Sem_Prag is GNAT_Pragma; Check_Valid_Configuration_Pragma; Check_Arg_Count (1); - Check_Optional_Identifier (Arg1, "max_size"); + Check_Optional_Identifier (Arg1, Name_Max_Size); Arg := Get_Pragma_Arg (Arg1); Check_Arg_Is_OK_Static_Expression (Arg, Any_Integer); From patchwork Tue Jan 7 12:53:36 2025 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: 104250 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 4A8DC385F028 for ; Tue, 7 Jan 2025 13:14:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4A8DC385F028 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=ieipwMyk X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by sourceware.org (Postfix) with ESMTPS id 86A5F3856273 for ; Tue, 7 Jan 2025 12:54:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 86A5F3856273 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 86A5F3856273 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::330 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254463; cv=none; b=chEET8rPemMi9o7IrrM71TjNTVt9Kor7w3r+Xx8bQFKcZy/iDCHFkm/+iiOhTFW9c+xke1A0thNCQjMOG16FzBa67hrdsgHsWH7rJ7cB43vRMnRsva9c9GJNjp6knHHzDsuNbonz3UeK7XzAnX1t6By/jfsRz0jUxyKK1bcBtCQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254463; c=relaxed/simple; bh=GyuuFzlG0wCDsFyGkQDMtN7rhTZq3CQHte8Q5FpglwI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=a69aX27Z5pEwSq4ITgpv+9XJ1VKmDnXuTzE7cPn2vwRkZSocDLXjPdaLg556OOf1pd4XZOmLczRST89kt6CQlc3e/iNMPOqFtzJ7vpiYPxPuJH4EKIOrc2G6godVxSTslmvLnKs7XZfwZXy49B5q//mg9NY79A4Q+VvGQd97lYA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 86A5F3856273 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-436345cc17bso112125385e9.0 for ; Tue, 07 Jan 2025 04:54:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1736254462; x=1736859262; 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=xK8Io1GCLYnmlCRm5dK3AR1hSrqsYOGSMAnepjFbkVY=; b=ieipwMykKN6GVnEBCfnTEGyK/FKIayg6zVJvN34ox3lVW3UDWN2qLD/sfh6bxkz3Ms 6RFYITfmFSGd2RVMD1SI5Yy5sw5HYy0hDv6eI6Knl4Z4YcUAzSuCsxSXgmscjYL1bsL5 itPYoTo2WZVCLMHwachXZNDmnzmH94nXEBfdpRLOZwCcLFQqIyW/MrxDwkhNhrJgJ2ow 1LpH9AMtHjyQFCxrq60QE2tE1kHkIkbxHSBnewx8KiFnIo11+taJKezbqZxK48OoCLn+ PiTr7RXb0VUAnTN+ZHjwWI98BKiev5FBNdIbc2Fcv7dVuHpt3vQ1bMVNeQUH8WgHUrxd Zfaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736254462; x=1736859262; 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=xK8Io1GCLYnmlCRm5dK3AR1hSrqsYOGSMAnepjFbkVY=; b=qVFjJ5yN+mKNH/c5EnZcvEwBjcjhMvWu6/CkuI8R5tDg3pu2DhVoDs5mGA0xG5jMev 5MoWPmLgf9JjXuj+FKi3kBYov8UgXQn2CKuTTn3kpucEJEt4xY8dUmqtqcsCNq/kSJ4K Je2oh25lylh1eVgRBHtfkfAYinHMWe8FmdofggV6vTroA/GQfJ39ObxhpLaYbbVyx7Do lNfrMO4EU1at79Y1kOaePMPtEIKzaLv9xGT0LCJL/16nA0YksvGpCG1+Cjn9goP5Y5TX 9E17Anp4oDLxsvq8+tupkJoZQJ2g9d1Os87EjUlJnU2OcsIMa5AkqsmSxfIbszRyPEw4 5HJw== X-Gm-Message-State: AOJu0YzHc3hk9LeMPWtW0SFlHys2iDe0dT4enpaKgaj9KKSaf4LKuDF8 Tw6NGSBCCWrESx8C17FGHIVO32PZpWMGMKneCVf3G7F/wi2I8tox2UW0HPA53OrwGuOoD/9/0ag = X-Gm-Gg: ASbGnctc8yJ3x72DUD9V2RxrDPkJ9dvvUUjroHzLsj0duv5LnXrK2dZYe8TSNECXzzz KuvlKBqGun/ZPHqGXecc6Rfoz2gm1glTyb2A7QgbI8f0SCaO2Hdpu9SiWXmExe+M46Un+JAQSJD FhxzhR97GPn7uIe31YH4vslVutTaAguy8Ty2O+OU8lW5gUUaCQ7UZyHWARSPIgArDdW64qzXFp7 cwQQJ82sbiLeb8qpf7EiHb+xjNUjSE7xlC+kw6SyZ8i+8mca+j7Tfk7LwQTs1p56bIdDOZpf8LT H8ObE8MDKdZHbvEWb/1vQMGuBY76efSs21MogOlGCLG8Iqw8eoCqgksc3bmbsQ/nOAH1JJlf X-Google-Smtp-Source: AGHT+IEBkABr+KU9QYlV2Sut7FvxaItketTDh89Lbj/a6jVJeIXqNpK0LQfvN7dtsYhMHP80jBetHA== X-Received: by 2002:a05:600c:3b02:b0:434:f609:1af7 with SMTP id 5b1f17b1804b1-43668547462mr519683685e9.4.1736254462229; Tue, 07 Jan 2025 04:54:22 -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 5b1f17b1804b1-43656af6c42sm631014805e9.9.2025.01.07.04.54.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 04:54:21 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED 18/31] ada: Remove flag Is_Inherited_Pragma which is only set and never used Date: Tue, 7 Jan 2025 13:53:36 +0100 Message-ID: <20250107125350.619654-18-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250107125350.619654-1-poulhies@adacore.com> References: <20250107125350.619654-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~patchwork=sourceware.org@gcc.gnu.org From: Piotr Trojanek Code cleanup; behavior is unaffected. Flag Is_Inherited_Pragma is only set in GNAT, but is not actually used, neither by the compiler nor by any backend. gcc/ada/ChangeLog: * contracts.adb (Inherit_Pragma): Don't set flag Is_Inherited_Pragma. * gen_il-fields.ads (Opt_Field_Enum): Remove field identifier. * gen_il-gen-gen_nodes.adb (N_Pragma): Remove field from node. * sinfo.ads (Is_Inherited_Pragma): Remove field description. (N_Pragma): Remove field reference. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/contracts.adb | 8 ++------ gcc/ada/gen_il-fields.ads | 1 - gcc/ada/gen_il-gen-gen_nodes.adb | 1 - gcc/ada/sinfo.ads | 5 ----- 4 files changed, 2 insertions(+), 13 deletions(-) diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb index 365c3e61130..4aed4dff27b 100644 --- a/gcc/ada/contracts.adb +++ b/gcc/ada/contracts.adb @@ -3593,8 +3593,7 @@ package body Contracts is -------------------- procedure Inherit_Pragma (Prag_Id : Pragma_Id) is - Prag : constant Node_Id := Get_Pragma (From_Subp, Prag_Id); - New_Prag : Node_Id; + Prag : constant Node_Id := Get_Pragma (From_Subp, Prag_Id); begin -- A pragma cannot be part of more than one First_Pragma/Next_Pragma @@ -3602,10 +3601,7 @@ package body Contracts is -- flagged as inherited for distinction purposes. if Present (Prag) then - New_Prag := New_Copy_Tree (Prag); - Set_Is_Inherited_Pragma (New_Prag); - - Add_Contract_Item (New_Prag, Subp); + Add_Contract_Item (New_Copy_Tree (Prag), Subp); end if; end Inherit_Pragma; diff --git a/gcc/ada/gen_il-fields.ads b/gcc/ada/gen_il-fields.ads index 70ece337e63..c778f00856d 100644 --- a/gcc/ada/gen_il-fields.ads +++ b/gcc/ada/gen_il-fields.ads @@ -266,7 +266,6 @@ package Gen_IL.Fields is Is_Ignored_Ghost_Pragma, Is_Implicit_With, Is_In_Discriminant_Check, - Is_Inherited_Pragma, Is_Initialization_Block, Is_Interpolated_String_Literal, Is_Known_Guaranteed_ABE, diff --git a/gcc/ada/gen_il-gen-gen_nodes.adb b/gcc/ada/gen_il-gen-gen_nodes.adb index af5049bf33e..c3a97e6e16e 100644 --- a/gcc/ada/gen_il-gen-gen_nodes.adb +++ b/gcc/ada/gen_il-gen-gen_nodes.adb @@ -1439,7 +1439,6 @@ begin -- Gen_IL.Gen.Gen_Nodes Sm (Is_Generic_Contract_Pragma, Flag), Sm (Is_Ignored, Flag), Sm (Is_Ignored_Ghost_Pragma, Flag), - Sm (Is_Inherited_Pragma, Flag), Sm (Next_Pragma, Node_Id), Sm (Next_Rep_Item, Node_Id), Sm (Uneval_Old_Accept, Flag), diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads index 6abda7474bb..e9b2f0f3c5c 100644 --- a/gcc/ada/sinfo.ads +++ b/gcc/ada/sinfo.ads @@ -1763,10 +1763,6 @@ package Sinfo is -- discriminant check has a correct value cannot be performed in this -- case (or the discriminant check may be optimized away). - -- Is_Inherited_Pragma - -- This flag is set in an N_Pragma node that appears in a N_Contract node - -- to indicate that the pragma has been inherited from a parent context. - -- Is_Initialization_Block -- Defined in block nodes. Set when the block statement was created by -- the finalization machinery to wrap initialization statements. This @@ -2694,7 +2690,6 @@ package Sinfo is -- Next_Rep_Item -- Is_Generic_Contract_Pragma -- Is_Checked_Ghost_Pragma - -- Is_Inherited_Pragma -- Is_Analyzed_Pragma -- Class_Present set if from Aspect with 'Class -- Uneval_Old_Accept From patchwork Tue Jan 7 12:53:37 2025 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: 104240 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 88EB33851C02 for ; Tue, 7 Jan 2025 13:06:24 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by sourceware.org (Postfix) with ESMTPS id 3D386385627A for ; Tue, 7 Jan 2025 12:54:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3D386385627A 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 3D386385627A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::336 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254464; cv=none; b=MbiOGCOsC8KUuPgIYqIs4FTwdeQ02g4EXYJ1x/h4A7674HwV4ntnrXn/0fwyfNpX5yJLY3wM+hqzrj2uwaGoQgM+sWKulH1+8snmWpYwrHOtGnmb03FH/zrpiLiRRqEInomO8YVtZQGI1qjveB1l+McT3DUBCHor65ujFQNmQb0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254464; c=relaxed/simple; bh=AMpN4wak//f7JoQhggZSGXS3uKCgzr+LduxRLEUF04g=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=dGx6yEUwUvOwrlRDXaYnbKSP9pnaK2KuvZGeaxT9RtXq6zinbPd9GuOAWmxBwUSXOLAo7Fx/kRUGBGkjND5sT/ISiIWQ+qy87PmLo/1REAr5X5rr5AJOXlgAJUsSbAVQOVDSdVj44CZmDZh02b6JLFtbqNkj5dz98DeqkylDQIs= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3D386385627A 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=GN3u9Dvh Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4361b0ec57aso154042145e9.0 for ; Tue, 07 Jan 2025 04:54:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1736254463; x=1736859263; 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=oZuEOqRwTYRFjkIB+i35+SaEPknx/FPUNDv0n2T14uc=; b=GN3u9DvhvJe4MDOeYlAAExUj9Q4D0LyvSc+KAwpvUZs13xfAwrAVp7jzjfvycFqctx EidjENxYZ8/Wp96uLUgvVSu6YyXZqDGfZB5J7K/dSDEBsYqcWusDkQCIOROJXbCR5T7K ajnn3S40LX2obFs3xaxd/Ix4IM+PG9uQcj8CZCMmx78LBQPDT3OxwL5YQm+fNFIh55xW tY2S+vHmH3rHvOLnSlrh/1MbhIfeUDG3YJcffMfjLI+4q/CyXwMfkwZ5N52+wSoW/Iw7 wlvLO86VII6rmfO3Osxpldvy0r7KVc4ZuLNj9QSf6+gWPbv0P2AIsWzY9gKAhMnzQKuG aE9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736254463; x=1736859263; 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=oZuEOqRwTYRFjkIB+i35+SaEPknx/FPUNDv0n2T14uc=; b=CZQeTw9gOfGv4ZsDpN4m8wKI4dandS7ffA0XHbq7YA2RjIgKclBT6D6EHZoX6O4qLf 8DfA/3Y/oTBDxqlYHFKJRYsATHFytOlxhnXJ9cmvZLms6PBoaGOplNMnSUk4dY/fFpz8 vdyOYyDcBxffNO2OsR2CQA3mRIAmtzvuhesdOguquLU6Whzf3eHbcOAjKqH5QHXj6Mbb elci55HXdNy8zzPnxnPJzF25IHIWtn1x8pP6gB12MIDfuCh7eqrZtbVrFc/srXYCFS24 rCQiUz2TYx5ZX/9Z6Vf0cgDdOwdTBHEV1qOIOCw1xtu6///H8AeP2WZgdhBsHTzyzRo1 XQ3Q== X-Gm-Message-State: AOJu0YwxEyUmMsbPivUK3Np+EhwntKkJQl7llWSrIEenOO5KCbnA+Vcd lgXP9WhbPswMm0w/68fWezzouOKnYhieuvHBKSS59dlMbUfIoaAW5zGnuFA9t+w1gBq2konqksk = X-Gm-Gg: ASbGncth+BsJb/rwdQ51ajzkwvlpFsVrvExXnnMdvTSo6QBJ4uZviX5FS48MUOEbKRs SYa//t8u1o1wT3ZJxAwNEnI1JUwt9oWS8ZoddkJC6IVbk8dc1+4/xjQ6bsuPcHW+HG0yO4wQS8t HVTr3VidWaoeFmzYWRQUUQGTfpkVHZttfJ+G3XC2SN7CSDo/nMTc9oljcQDdDWsKEdBEv3I3kPU j0dsSzBLd1kyFr+1XyPMJNiMA6PRJESGKrcYrE9XP80d1bXX2wxz7DUDXfL9k1arDwSIcu64eHw wCpj8kC+UCgNjs3guvNvZs0XoIkOUbUZbqyH83cl93MbhH3TImII6hTDoPbCNGdqoknQVWOC X-Google-Smtp-Source: AGHT+IG1MpGOe+k9E4Bia/2Y8DoIdCRLDQSOB0POkFpW9Y4se/DjjkRz52n4AmdnVW4DTy6BO9M/FQ== X-Received: by 2002:a05:600c:1c8f:b0:431:93d8:e1a1 with SMTP id 5b1f17b1804b1-43668b61b5bmr497920025e9.27.1736254462897; Tue, 07 Jan 2025 04:54:22 -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 5b1f17b1804b1-43656af6c42sm631014805e9.9.2025.01.07.04.54.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 04:54:22 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Steve Baird Subject: [COMMITTED 19/31] ada: Improved checking of uses of package renamings Date: Tue, 7 Jan 2025 13:53:37 +0100 Message-ID: <20250107125350.619654-19-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250107125350.619654-1-poulhies@adacore.com> References: <20250107125350.619654-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~patchwork=sourceware.org@gcc.gnu.org From: Steve Baird In some cases, the RM 8.5.1(3.1) legality rule about uses of renamings of limited views of packages was implemented incorrectly, resulting in rejecting legal uses. gcc/ada/ChangeLog: * gen_il-fields.ads: add new Renames_Limited_View field. * gen_il-gen-gen_entities.adb: add Renames_Limited_View flag for packages. * einfo.ads: add comment documenting Renames_Limited_View flag. * sem_ch8.adb (Analyze_Package_Renaming): Set new Renames_Limited_View flag. Test new Renames_Limited_View flag instead of calling Has_Limited_With. If Has_Limited_With is True, that just means that somebody, sometime during this compilation needed to reference the limited view of the package; so that function returns True too often to be used here. (Find_Expanded_Name): Test new Renames_Limited_View flag instead of calling Has_Limited_With. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/einfo.ads | 9 +++++++++ gcc/ada/gen_il-fields.ads | 1 + gcc/ada/gen_il-gen-gen_entities.adb | 1 + gcc/ada/sem_ch8.adb | 7 ++++--- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads index 1946e68b3c7..a7c0584d8da 100644 --- a/gcc/ada/einfo.ads +++ b/gcc/ada/einfo.ads @@ -4247,6 +4247,15 @@ package Einfo is -- within an accept statement. For all remaining cases (discriminants, -- loop parameters) the field is Empty. +-- Renames_Limited_View +-- Defined in package entities. True for a package renaming if either +-- a) the renamed package is not itself a renaming, and the renaming +-- denotes a limited view of the renamed package (as seen at the +-- point of the renaming declaration, as opposed to later on when +-- the renaming is referenced); or +-- b) the renamed package is itself a renaming and the +-- Renames_Limited_View flag is True for the renamed package. + -- Requires_Overriding -- Defined in all subprograms and entries. Set for subprograms that -- require overriding as defined by RM-2005-3.9.3(6/2). Note that this diff --git a/gcc/ada/gen_il-fields.ads b/gcc/ada/gen_il-fields.ads index c778f00856d..fe2da80c548 100644 --- a/gcc/ada/gen_il-fields.ads +++ b/gcc/ada/gen_il-fields.ads @@ -879,6 +879,7 @@ package Gen_IL.Fields is Relative_Deadline_Variable, Renamed_In_Spec, Renamed_Or_Alias, -- Shared among Alias, Renamed_Entity, Renamed_Object + Renames_Limited_View, Requires_Overriding, Return_Applies_To, Return_Present, diff --git a/gcc/ada/gen_il-gen-gen_entities.adb b/gcc/ada/gen_il-gen-gen_entities.adb index 8cf66b2611d..3df1f8e7284 100644 --- a/gcc/ada/gen_il-gen-gen_entities.adb +++ b/gcc/ada/gen_il-gen-gen_entities.adb @@ -1281,6 +1281,7 @@ begin -- Gen_IL.Gen.Gen_Entities Sm (Related_Instance, Node_Id), Sm (Renamed_In_Spec, Flag), Sm (Renamed_Or_Alias, Node_Id), + Sm (Renames_Limited_View, Flag), Sm (Scope_Depth_Value, Unat), Sm (SPARK_Aux_Pragma, Node_Id), Sm (SPARK_Aux_Pragma_Inherited, Flag), diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index 533b62aef32..c6b8f6c5d7c 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -1665,8 +1665,7 @@ package body Sem_Ch8 is Set_Etype (New_P, Standard_Void_Type); elsif Present (Renamed_Entity (Old_P)) - and then (From_Limited_With (Renamed_Entity (Old_P)) - or else Has_Limited_View (Renamed_Entity (Old_P))) + and then Renames_Limited_View (Old_P) and then not Unit_Is_Visible (Cunit (Get_Source_Unit (Renamed_Entity (Old_P)))) then @@ -1691,8 +1690,10 @@ package body Sem_Ch8 is if Present (Renamed_Entity (Old_P)) then Set_Renamed_Entity (New_P, Renamed_Entity (Old_P)); + Set_Renames_Limited_View (New_P, Renames_Limited_View (Old_P)); else Set_Renamed_Entity (New_P, Old_P); + Set_Renames_Limited_View (New_P, From_Limited_With (Old_P)); end if; -- The package renaming declaration may become Ghost if it renames a @@ -7077,7 +7078,7 @@ package body Sem_Ch8 is ("renaming of limited view of package & not usable in this" & " context (RM 8.5.3(3.1/2))", Prefix (N), P_Name); - elsif Has_Limited_View (P_Name) + elsif Renames_Limited_View (Entity (Prefix (N))) and then not Unit_Is_Visible (Cunit (Get_Source_Unit (P_Name))) and then not Is_Visible_Through_Renamings (P_Name) then From patchwork Tue Jan 7 12:53:38 2025 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: 104258 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 C888D3857C6D for ; Tue, 7 Jan 2025 13:25:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C888D3857C6D 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=fBTaraaw X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by sourceware.org (Postfix) with ESMTPS id E7F143856082 for ; Tue, 7 Jan 2025 12:54:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E7F143856082 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 E7F143856082 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::330 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254465; cv=none; b=jSle9lfj4A2sX+sJMV9bpD9CLWQp02T7CjIX8L/+7BbCCN7qYwJGXfurFA+gIXce3qDG2xIIEPkxJlC4WXc+GQybAbio30eAb0VnxuCHI4EJX/H/w7zrZbpnuJ7YN+WQ77N6CBR0BD2/g9EEBcSb+my2jbRXmol3UKWv4znBZKA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254465; c=relaxed/simple; bh=pHQV+PA3SGNVIc2om1++BIHX2tuDPMB3sLzJO9unRrc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=lYOUCWJHHHfQuhE8B8IKhQwahfz5W8HGZGta7wMHgxpXwp65w3WPhCdIdY/iqGmj5ApVqW60pfjPUCWlmxPndBI4C2E0MdBfhQvmwxIYgot8QyevhgTTiDyZe3UcQBxmRmPXloiY756xnaJMLimHUwOk5G2c0pLUC3XgyZJ1jJs= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E7F143856082 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-436341f575fso159646265e9.1 for ; Tue, 07 Jan 2025 04:54:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1736254464; x=1736859264; 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=uj4ZZwqwu6x+aap+GatGI1pllSLf4rEqryfZAJzG4YU=; b=fBTaraawvbO1AZD97D6CmBC7s27d3MTSQT0DnW/RDs7kepplosIZhkZ0PJD+TJOryW 1SnocWyYQFUgim0VfAOIwGrOPrCwjEv11jbn1C5vrafNCf1MdjEaOjy4pQi7ExEOYqt+ fsF06GJ5Bj0gR6I1VkedpclOrj2jGj04hjCyM6ar9hs5NvSu16hmODkXomQ1hxb6Rjg4 TaVvySntyvchzdkhsw891Q+Kxy+L1pXFL8RilVzCa1E2YOPJ3WJpQAplT92cPu+pIGpv 6zemvIqje9pDzJzMGIjockO2uQUoabECpVtKFVvMQ3OErSIdHItxGX4Hmkqbfrf+e5Q1 ltwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736254464; x=1736859264; 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=uj4ZZwqwu6x+aap+GatGI1pllSLf4rEqryfZAJzG4YU=; b=AM3MAjTpC5V45QkfVvgE5/rgPo8ULeH/EfG4gmXO3f71MhXm89yt507hjqS9qh5n2X jWxsmm4Wa9ZHlk41sa5+T5J/e+aPNkRkgg5pxjurvt0qX+l79cFQSbEfvZdPOv2E1nuw B16foSFMJTdFygDTMYmI3Jjl0pJBTgpjzv/eIC+4BbFHibeyQjNipzGe6yffOW2aOp4m vpFVwzIDslDUO4DFUCRzIUyrGZ8mqzC+/CwOXal9nUPsdwej486Jql00xUdu746IV0MM tR2kH73HW6tCy72J1HBlIxiYvJO7OwTL2uu2HADCWukc279T20bnzUGzEPk436/7d2b+ xwYg== X-Gm-Message-State: AOJu0YyHOgNdCVrnHyXXlxeGJ9JwUWAg+klLWlvx/WLfam0tP81aZHdl 0xE6/ehXoS1ecO3hpqAGR6huXc0aSwOIVbcKRMKBGFtgFN8+NZOeV6esxQM7yeYDF2K7Iw5lzos = X-Gm-Gg: ASbGncv/od/DeLGURN4l9HBG6kxW8UobDeWIcT771q8+tZfu/CmPWr5A+Aa+mxzCvpC beaqklSJVTrrXqOz8SPa46I0k72xoNcxgMcjWk4ALK8mwobLgqGr9UT2bsCypHjTj/pi6n7BXdS kjlqTQ7yXAEnwh5EhrC8vbItHOVn9/CJdrBPzKPqCOk0tkzXfvgUlZ3szWsP+2yUR6oQZjA+Zcb 9RvqXqHOF5KivpjE54A5tuCkyqFLpeJjxHjIYVzrTq7vNHucAfg86lM2Tmv259+DtBy1y/To9JP jKy8n7uryyVeKbjZrLNYgBYjVc9HHOtl2M+2a3wgq8v0nSf9oJ8Yww4RDYoo71kCqjEm74ry X-Google-Smtp-Source: AGHT+IGcBYVbmaWUus4odHthQMLIQqP4P6rF9g25gIliTVbTKAdaXymJyXqeI40sRTe5+QX+6L2wmQ== X-Received: by 2002:a5d:5e09:0:b0:385:f909:eb2c with SMTP id ffacd0b85a97d-38a223f7548mr54729562f8f.38.1736254463665; Tue, 07 Jan 2025 04:54:23 -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 5b1f17b1804b1-43656af6c42sm631014805e9.9.2025.01.07.04.54.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 04:54:23 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Ronan Desplanques Subject: [COMMITTED 20/31] ada: Fix abort deferral for finally parts Date: Tue, 7 Jan 2025 13:53:38 +0100 Message-ID: <20250107125350.619654-20-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250107125350.619654-1-poulhies@adacore.com> References: <20250107125350.619654-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~patchwork=sourceware.org@gcc.gnu.org From: Ronan Desplanques This patch fixes two problems with how abort was deferred in finally parts. First, calls to runtime subprograms are now omitted when aborting is disallowed by active restrictions. Second, Abort_Undefer is now correctly called when the finally part propagates an exception. gcc/ada/ChangeLog: * exp_ch11.adb (Expand_N_Handled_Sequence_Of_Statements): Fix abort deferral. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_ch11.adb | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/gcc/ada/exp_ch11.adb b/gcc/ada/exp_ch11.adb index 66f38671008..189e0911fc4 100644 --- a/gcc/ada/exp_ch11.adb +++ b/gcc/ada/exp_ch11.adb @@ -1302,14 +1302,25 @@ package body Exp_Ch11 is Expand_Cleanup_Actions (Parent (N)); end if; - if Present (Finally_Statements (N)) then - Prepend_To - (Finally_Statements (N), - Build_Runtime_Call (Sloc (N), RE_Abort_Defer)); - - Append_To - (Finally_Statements (N), - Build_Runtime_Call (Sloc (N), RE_Abort_Undefer)); + if Present (Finally_Statements (N)) and then Abort_Allowed then + if Exceptions_OK then + Set_Finally_Statements + (N, + New_List + (Build_Runtime_Call (Sloc (N), RE_Abort_Defer), + Build_Abort_Undefer_Block + (Sloc (N), + Stmts => Finally_Statements (N), + Context => N))); + else + Prepend_To + (Finally_Statements (N), + Build_Runtime_Call (Sloc (N), RE_Abort_Defer)); + + Append_To + (Finally_Statements (N), + Build_Runtime_Call (Sloc (N), RE_Abort_Undefer)); + end if; Analyze_List (Finally_Statements (N)); end if; From patchwork Tue Jan 7 12:53:39 2025 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: 104245 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 764623860740 for ; Tue, 7 Jan 2025 13:09:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 764623860740 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=DNw91/+M X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by sourceware.org (Postfix) with ESMTPS id 9DB013856096 for ; Tue, 7 Jan 2025 12:54:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9DB013856096 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 9DB013856096 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::332 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254465; cv=none; b=noiNpnJbkLAwn4//qgRwAbVBMh1l1q4hBDGFUC2Ici+kgbIWrsrZioXFoQjvWz/8uGUfpsNnPYkOvDsDBRhGYnMLpwIxB1RTiY8VRleDbU8xvBXohvRzfcNgeVNfALLb2HBwy+Y+k0DxsJrkjZOD0RqLQXfxuoXhheAYmVnrZdw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254465; c=relaxed/simple; bh=M6f1hhm9C7rxnAm3JV69Y6S8KxSSRT42uapJinWQNgs=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=uwwLcnyAthf3DrGO//72BSBXl5qzqPk49Ucys128LKD4Bc6eZwdKdlw7/zuXAviFfpMrw5TjFmI9HktJCFO7AKyZBG6BMFNXCAzZphJhahhVXoxU5f9mW9FAweSTn5pOuFw2szRrH7fNNL2/DGY8lyI/+H6MIoBMQjz+uA7MO3Y= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9DB013856096 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-43618283dedso153857845e9.3 for ; Tue, 07 Jan 2025 04:54:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1736254464; x=1736859264; 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=QctD9aKuvbNS0oqFvTJ5vAYO5LkjzJD0mf3KD1enGJE=; b=DNw91/+MimMNW8fMDKllsNZ1nVcLQoXKWRbSGILGKiOY+t7vUCZpYbu7bpcJcfxdeh z2WxksFzgodvyvlOC3z+rW1p57eJXZ3868EeSNkvIvrvehkaCmmudvz2Fav7t9qZumwQ /SPyFS97XrRBnur9+XbF3psLTot/rhvOxRWxv1ym6PF32al288ZH9e7jYnco31Ck0Uxy 7tY1Kshww6dOIaCJowyMWqQGkPVBKP8jcijbp+U7rTEZQ0ZAUiEmVkuHHHHDdfnIc9kg OnF0D1kzZ921GXG5KmCzx9ztwOWEmUy7ucR7ccgi4kES9OMS184BQk8G0+XyoaJ3B0Kn PY0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736254464; x=1736859264; 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=QctD9aKuvbNS0oqFvTJ5vAYO5LkjzJD0mf3KD1enGJE=; b=Go64nCrhz5REG3xPtUoFM6PbF0XM6TmGKupRLCc66R/fj6oyl+1mzWjWlZPw6Pwk6a qf97EFFELAn+Q/QhTksTDegWAqlTtJIpNkYXlUzT6tFxqNgAkucs7in8J1gx4Y+ZM/K+ 55tKFMk2trPMnORjakVQRpFhGixbo2b5Z9GNaPV0GdEBW8c4hCdkTXkF7qCDVV0yy72d aW0GEvkTKHr6adVEBjiMEYZLUC0ow2D5DVpZdAqg/eHhBeQLbJvL8tZ+OZirZWZViF37 HOmaxi3Tu7rH/J0gSZ2VDwc96qE8ENU2RD7yACZGqAbnIa3mwnNdCzj981NizgvyMbdU V6lw== X-Gm-Message-State: AOJu0YyDlQ8TwNKdvxzzN1qBO0Q7LES3rdOPUNnSpUBCpcdnl5ZrQqo9 NIRtou0QNSw6nAcOYIxREEvsGyjXQ7xyMJITwK52Wtqgk7NXvmb3UUURxK+ENEvpoR6FmU6pOqQ = X-Gm-Gg: ASbGncssRybo2W1wFqObrzfPulZllGDddENXeGrBsTgF9tuRz8XtRkLEohsDldgKNwa a8ZDUPRan7twbmnmGHGbMTbECWK9/UOHYzIePpFiVBjqK57N3U9thKPFCrsa7yocA0JYQMixbZY CWsPVCn/5TC04lxpFl2Fm67VlP85FqeZO5P9c94dQ0wYSYS0e9J0bGqGrAUtuTKGS8zkIeCAadz iC7EIUgAENHDUL0QUcn6LDqH0cbOA7I7+ZMl0ziljlOrhxI+TQg7Bz0jY9yeEj/4FyLEhJPr3/c 5oSUM9ZD5aTQQXtmSRG7qYAh0kyK+gBr4JmdchZSubyIQVJ0HEWhOQhn5EVbXuiWdKY7uxaq X-Google-Smtp-Source: AGHT+IE9euHp9FQy6sQMILfZg2+FPtshHqk8p8wq0VzrGa2kYZptEWkq+S/eHC2Kui2zfSew/y25ow== X-Received: by 2002:a7b:cd98:0:b0:42c:b9c8:2bb0 with SMTP id 5b1f17b1804b1-4366b2f95c5mr520561605e9.4.1736254464330; Tue, 07 Jan 2025 04:54:24 -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 5b1f17b1804b1-43656af6c42sm631014805e9.9.2025.01.07.04.54.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 04:54:23 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED 21/31] ada: Remove dead code in detection of null record definitions Date: Tue, 7 Jan 2025 13:53:39 +0100 Message-ID: <20250107125350.619654-21-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250107125350.619654-1-poulhies@adacore.com> References: <20250107125350.619654-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~patchwork=sourceware.org@gcc.gnu.org From: Piotr Trojanek Code cleanup; behavior is unaffected. gcc/ada/ChangeLog: * sem_util.adb (Is_Null_Record_Definition): Remove check for Component_List being present after using it; replace check for component item being a component declaration with an assertion; fix style in comment. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_util.adb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index a11afa8be2d..55e9979a215 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -18984,22 +18984,19 @@ package body Sem_Util is function Is_Null_Record_Definition (Record_Def : Node_Id) return Boolean is Item : Node_Id; begin - -- Testing Null_Present is just an optimization, not required. + -- Testing Null_Present is just an optimization, not required if Null_Present (Record_Def) then return True; elsif Present (Variant_Part (Component_List (Record_Def))) then return False; - elsif No (Component_List (Record_Def)) then - return True; end if; Item := First_Non_Pragma (Component_Items (Component_List (Record_Def))); while Present (Item) loop - if Nkind (Item) = N_Component_Declaration - and then Is_Internal_Name (Chars (Defining_Identifier (Item))) - then + pragma Assert (Nkind (Item) = N_Component_Declaration); + if Is_Internal_Name (Chars (Defining_Identifier (Item))) then null; else return False; From patchwork Tue Jan 7 12:53:40 2025 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: 104261 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 7C92C3857C4F for ; Tue, 7 Jan 2025 13:31:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7C92C3857C4F 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=TPYIf6+M X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by sourceware.org (Postfix) with ESMTPS id 6B1593856084 for ; Tue, 7 Jan 2025 12:54:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6B1593856084 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 6B1593856084 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::42f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254466; cv=none; b=DNWZxZtX4H/APsXAYP4zG4Rn4PUBxFn5ZlNXMbBIfRKBMqV6t2Jpfp/M5TtmaZJSl/XyB+OuKRbHjh8r+tSDq0UM+5fkusJXCVjfrHNvYHVL/CLgtDP66TbyUz0gKpKi1Q7iA9r3HJ2PP9XPtIh3Q/MtAeHmMqhMvFYVqxphnCY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254466; c=relaxed/simple; bh=X4dEavxaRby27XuQyjFOWbPfqScRyjAApLt3yiifpxE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Ze3LwTpidoANIoKLPnmaCI4B/3OFoCB+l0IGPTbwWpTBwuvWbK/27KpDLAzQo6UX9gswe/HgYf3LM9HJwNyKRRLNyGDRvxEDWrnM4I/PLgP/oJ5wGudncRRNMY4fx9L8ygGDqIBekcqHA4IUFr/6qKUjEJdVwL6VRjikhsccp3g= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6B1593856084 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-385e2880606so11213658f8f.3 for ; Tue, 07 Jan 2025 04:54:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1736254465; x=1736859265; 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=/7eL9K+RxnBY58Dd6PVIuVG9g7ffbKDLPK3XAAGtwAM=; b=TPYIf6+MplQvg+16PT8IPP2Y3hnVtqro0ZpxhDsswFKTxnVYgH+vLKYsC7Axx4UahD ZTXNTDhV+c8RK4KQGeqEgfxvr9ADmH8AYbp2/S78H3l9/BgtOaXyJch1tH8x6DEuBUZH M9T6ZiwB7ZjlRFtkF6dbiEkhu91EPsty7XbvwS4mfu81hQ55xLNGWOZMcnL32Xd5Lg/d mEA4vXNKlszUTiWIoHRn+b8llnt15mhJnxSBFXGpVz54T0HaPrZXxxVA1rtbas5WEWz/ 1jbm0VeEvbaX/uTPd4E0mCKgkDYrNXw1IF6mTH47S7f2t4Pllo+48YT0XvGSZhMeOJtb hqqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736254465; x=1736859265; 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=/7eL9K+RxnBY58Dd6PVIuVG9g7ffbKDLPK3XAAGtwAM=; b=Fu3gcKCo6j2AW9Ghh8pi/1NL+05DFuZAT+P+UVLTxAwPtWBo5NK8PFGTlWfni54ndT 5xCbTK3560q+9TP0T/TeHn6hUZ5PXdGlMXsx9mM6HWVVFRgVqjsmhZCpvwHboBlQo25f wKC3BZ4oOOfDl4qbbAdyG8Salnz+oWwNPOQedl31zq9XqOjk7Mwinvjjpu1qxUQ9Fw48 Y/YeETP1dUPqKkzUzyNFuIwcTMKFVuRd/f/1aThK8LNtfUFH2jeKg+nxs3Hq0kUuX5ee xp/3W5vNwaol65MwBK/nNtQjVg9m/zbJlgXOEOxrw7K3/QrQ47+lM1R3truAsrBwiMcq 6yFg== X-Gm-Message-State: AOJu0YzEZoU2I+Q3MIpcRS3R9Rolnr6u17ePKAQKYfWcCG2PX9MPnlg0 CRg4Uw2XdBfTjT+X2/yNT5eH0QMJqa/GLzib29Q3qm7BpBLfPKP9GUOiC/7MSZTOHAnCNt4g8zA = X-Gm-Gg: ASbGncvTqk7hwuaRaG+9VIaq7DpXkhbmGBbVgOFXoiHa/DJ1jJsiGUNDXrOsdpbpjIA guoiD0SJQN02sPAsV+6tvWRBwMp4zDD3SkQcIRyJQz4yp7T9Be9W8fWzo3XhYfe86DtrmamgoSz NuQUdvA/JRDfv/VAsna93O8DoB2o8pALL78x4G0qMeXPniE3IjOMrxD34AFYsntsAyOdSqUwkZ6 fejqfyODdTLo9hH87V92mubqpLOzZx8L1DABC9B1tk7TnZd5VIaJhVocaRep6qW7ef39/2TaWTC yabgC2javPMJYxKPML3AN/Ir3xj+YWdSULirCZKmPBm5suAa28EuN+zD2mzOO1wC2QGsWLHc X-Google-Smtp-Source: AGHT+IHjoSdOBcuUHdlozXMaYwUps0kvSr7IKE/2Q4GZKQnfusj/7idqIdOUXwkkLzzf30bPn8ngAA== X-Received: by 2002:a05:6000:1fa7:b0:385:d7f9:f157 with SMTP id ffacd0b85a97d-38a223f833fmr46057173f8f.36.1736254465032; Tue, 07 Jan 2025 04:54:25 -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 5b1f17b1804b1-43656af6c42sm631014805e9.9.2025.01.07.04.54.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 04:54:24 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED 22/31] ada: Fix violations of GNAT-specific GNATcheck rules Date: Tue, 7 Jan 2025 13:53:40 +0100 Message-ID: <20250107125350.619654-22-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250107125350.619654-1-poulhies@adacore.com> References: <20250107125350.619654-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~patchwork=sourceware.org@gcc.gnu.org From: Piotr Trojanek Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * diagnostics-pretty_emitter.adb (Get_Last_Line_Char): Fix whitespace. * sem_aggr.adb (Resolve_Array_Aggregate): Fix style. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/diagnostics-pretty_emitter.adb | 1 - gcc/ada/sem_aggr.adb | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/gcc/ada/diagnostics-pretty_emitter.adb b/gcc/ada/diagnostics-pretty_emitter.adb index e376ae12803..c624f400169 100644 --- a/gcc/ada/diagnostics-pretty_emitter.adb +++ b/gcc/ada/diagnostics-pretty_emitter.adb @@ -327,7 +327,6 @@ package body Diagnostics.Pretty_Emitter is is Cur_Loc : Source_Ptr := Get_Line_End (Buf, Loc); begin - while Cur_Loc > Buf'First and then Buf (Cur_Loc) in ASCII.LF | ASCII.CR loop diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index 5bef9e22484..562240ca4ef 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -2968,8 +2968,8 @@ package body Sem_Aggr is Scope_Parent : Node_Id; begin if Nkind (Exp) /= N_Identifier - or else not Present (Entity (Exp)) - or else not Present (Scope (Entity (Exp))) + or else No (Entity (Exp)) + or else No (Scope (Entity (Exp))) or else Ekind (Scope (Entity (Exp))) /= E_Loop then return OK; From patchwork Tue Jan 7 12:53:41 2025 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: 104264 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 4CF903858283 for ; Tue, 7 Jan 2025 13:39:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4CF903858283 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=WLFEtBDT X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id 1DA73385B519 for ; Tue, 7 Jan 2025 12:54:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1DA73385B519 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 1DA73385B519 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::335 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254467; cv=none; b=db9bTPt8FjC0Yfs5GKLHEmtVv0xIyNiWuMZFJfmH/sxScCpHG2ysueDPrp5zXaMjYQe+LCnpOu5Z227VzHtbKp6wpLsj9pk4JDcGqx2JM2Ji6vyXc6YFGN0btsI0BBVXy4y02/MNy8Ale/SBUPuXpcTONjAnL0MrHkfBTUYWnSA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254467; c=relaxed/simple; bh=YonPLnNecUC/kA1HKmy5otiDAi8MydiDK3gQcBERfzQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=t8BqAtyiln9DAjkggLulupD4XGi2CTBxD48VRz+SU5xMz/Ux6nznziJ0rOaXWM+dx+iML+I2tStOugbII+UT40On/bJEi8zSEXbgWVhAyRrKL+Vde6p2Wt3KSPSKR29Iv5riMhPDMC99kVqzSMjJ0mv33UJtjxGI/qM7we6jp6E= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1DA73385B519 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-43618283dedso153858015e9.3 for ; Tue, 07 Jan 2025 04:54:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1736254466; x=1736859266; 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=XnVR7Tq++2pbnPOX1lrk15Zmwg/PpVDlNEMC1WFAz+o=; b=WLFEtBDTnrvrtHmXjOrySwlperHAEmfEjNBRe2ZcjtmBDrqFNXBz5YzlVJoNkwmRWa zJH1TzM0ljHpepshbK4Fi//nal9rMLeCjm12ePyzglxixeor0Z+cZ8Bt5yRGC/ZZWYxV gOltg6At4nx9hjV248LP/uFl4wR2bZvi9IAhzPJe2w5Xijb7jM1X4KHc8MyzzZgIhX0z oUeJ7v/frGL0apanCm50q0kAWjupJaKL5RneApLfXonOhEqD1HIkqRmNrPvHbEqEvZrf yePG/ZWJEwVWoEFZvtDcQIOMeDFCwFwzKrKlLcH0PrZNon4jC3N+DsistlGE5DPGqWkI BZRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736254466; x=1736859266; 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=XnVR7Tq++2pbnPOX1lrk15Zmwg/PpVDlNEMC1WFAz+o=; b=tr+qJ0bm+57MjAtgFVZOwvaqnK3iGQqC+W/dg3iWuldPcEDPaM3EaJBDwBmHDHGoqk DvyZqA9m09WXCkNYv6Fgfl9c3z/FmnsKfWFxwIjgmGAPBfU3VRDRvQsVVhqZHE5zyfRn u5le6gmCHnIiptkKNUE3TndXGLGRPN8vzrBTlHbMLPwgbRrzbvdobbiunkc8WpS3rwZM mxcMgkNpcqsFYBe7LOB9z0QcZYIzDFoUXbvBCoJKAyIdJwJ9ug5JNt6K+fLFg8bcvOF/ yZt+N/na0w+/egcKipwA/RFbKF35n4MCI30hJD2+HNYsVjUmDYwMz1p8iyJdQFXu7dyZ TGeQ== X-Gm-Message-State: AOJu0YzrqGo1tFZLhswDHaKBksy4MF1UkrZqBHpW0k8bcbzdpLrr/wb0 jwYu+GSEmKXUNJ5yVRUKGNRvAdww9C0/dLOZp5LTzX8VntBBhJqdAmbGNhfAsn4xSa0v5L6ePpo = X-Gm-Gg: ASbGncs8Mg1y+jn2c8svRyPirT+NaUUM95wmTr2hMcOLJGFCGz63WuAZm7hOImr1Xc1 D7NvNlIl+XQbGQhHonSThZVlpxZTh2TEBCzoD3Ku0zjRYzykAKY3rNiqzd25SyFCifxlMvA6kAJ 4ecXfIMJnKKQucnHKiNfR61eDxG5tt2G5v5Jza8IhaDcmiAbxjFblf3RHtCDqIR/ENnG3CBJLQd 4q29ZqebPxZbhjK5d3yOiNdvW+B+oxtR/A4WHBn5TbeCuqeDarRUU0eSrQZGbyZ1edGcPwb71No POQVBt5sAq/+WzX8R+Y45RXuXICsLpU3/Z/eCbkQxZUmqiSQyjIdFJf2Jkvn39+HATU/Nh6a X-Google-Smtp-Source: AGHT+IGfdJWNKbvEI4aqOONYNv//gzFcR89+oKndhbZgvFFURcNQ0HxB/oPiVXoZ/EYghHjXxW8f6w== X-Received: by 2002:a05:600c:4511:b0:431:44f6:566f with SMTP id 5b1f17b1804b1-43668642d71mr517130995e9.13.1736254465736; Tue, 07 Jan 2025 04:54:25 -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 5b1f17b1804b1-43656af6c42sm631014805e9.9.2025.01.07.04.54.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 04:54:25 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED 23/31] ada: Improve protection against wrong use from GDB Date: Tue, 7 Jan 2025 13:53:41 +0100 Message-ID: <20250107125350.619654-23-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250107125350.619654-1-poulhies@adacore.com> References: <20250107125350.619654-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~patchwork=sourceware.org@gcc.gnu.org From: Piotr Trojanek A code cleanup in routine intended to be used from DGB, suggested by running GNATcheck rule Boolean_Negations. However, this code can be tuned to protect against more illegal uses. gcc/ada/ChangeLog: * exp_disp.adb (Write_DT): Add guards that prevent crashes on illegal node numbers. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_disp.adb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb index f45c32356a9..6d0f2c87017 100644 --- a/gcc/ada/exp_disp.adb +++ b/gcc/ada/exp_disp.adb @@ -8674,9 +8674,10 @@ package body Exp_Disp is begin -- Protect this procedure against wrong usage. Required because it will - -- be used directly from GDB + -- be used directly from GDB. - if not (Typ <= Last_Node_Id) + if Typ not in First_Node_Id .. Last_Node_Id + or else Nkind (Typ) not in N_Entity or else not Is_Tagged_Type (Typ) then Write_Str ("wrong usage: Write_DT must be used with tagged types"); From patchwork Tue Jan 7 12:53:42 2025 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: 104263 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 817EA3858410 for ; Tue, 7 Jan 2025 13:36:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 817EA3858410 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=Vv2BKK/U 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 B75933856088 for ; Tue, 7 Jan 2025 12:54:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B75933856088 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 B75933856088 Authentication-Results: server2.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=1736254468; cv=none; b=ZIjwCmGAgh6PBKJUH7QR8lCXcCoYM6ze6d4c8DRyLBh13vUGkNFCmmibe9rdHD9zIZOgALVUp2se28vyKgGQBDcvICeYon8kj3otcomhYrqErnfZYPY6H0LJn1HXf4sYw7c1XpuKF2VBqObDWWHRdMXvJ/+ejU3Z19On1Neyw3U= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254468; c=relaxed/simple; bh=jS5Jv4zY3oJVG3r0rWDEViyufdGzp/oJVaSsP9H/+bw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ccFArNBEsUFRW8B7NWdAMzIJcdTfmTk63/gcm0O6zGvjTrgJ0VdoEqKtatZitfAY3XU7iIWWpTku8DVyqNvSLncQEWiNhOMWRRxSiZGcAgjskfh9y2QWmbNXMJoi1Q7Ir5CI0P6lcpvtNPScEQkRQfwtlrW5uLOkUQCD32dSjmM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B75933856088 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4361dc6322fso103279175e9.3 for ; Tue, 07 Jan 2025 04:54:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1736254466; x=1736859266; 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=NAmeqSjz3oZcIYBAb6tQi/F0n+IKhRRQJbUS4KimXiI=; b=Vv2BKK/UKtC23SGbRBk1QMsbfPU4nH/H1b70KczofhoOo7szQxxtlHDw1Q/nBAu4a6 o9GMj1Ea25wNRWx1qOQBJgdGNDFTHHDqjIlJnug+fC3f9nFvIxHaw4x3QxpomLhRm2tC mUKlnRG2Y+zXX4W7/wZ8HpdAo/QQH4xXkYo/UhuHrk/VrjYXT1PCrHpumqyYCoZIok8F FEcT9xjIRZ3akaYifZCqxN8LUDKCecvs+WY66nWeYU+gINRA/Kpsuy0dwtDU/tdjQkmP QSPu1fw5p1JwuQYNHLBS2J8ogs5yrqIxfTtHShVfaCXn9iNiZ/imBTMViO4WtAG3Mv28 +aSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736254466; x=1736859266; 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=NAmeqSjz3oZcIYBAb6tQi/F0n+IKhRRQJbUS4KimXiI=; b=J1s2C76rSPdlvJDGyGuHbWm9R5VVlozKYwJNdNZTEn58326P8HCyRF3jBiDQdIzaJV Dy2uG6QJIGYdXpXaaMoXA3MSihS+a6RDUqe+S/dzksgxKNByKfkv0gsA41/DDiAuP+U4 5AZFskhiYqVqrHhDrjJyq9yquncjFMRrgHEvlqqWC/YXo6s28fqiJ46mdozKgwzDefDB katvcdaFPe5xCB//+wOMuPi60CI0nej4j02QyhOhKdRkTR7rqbFpNVSuoirnyybs0Cp+ cmCGV3Woa2fjNMXLVSyVCtlsQGSlx72KjoZTW3qc86imKRRpY9p/zxoCmTsO0PlQqY3C wxGw== X-Gm-Message-State: AOJu0YxU4g62UCDfp9yHn2kZHtKjDJyzeBvOB4HzCG4eNXGRFJvpFwLe qK4iX+yhIz6fbUW5f6HjIT7eyp9NR2ZrdA19pSn0oumx71V/8Y/ukgKO7usSFIB9p0b1E3G8bs8 = X-Gm-Gg: ASbGncvpuGZ0wdK77M2yhVFhLELAm4Ak2uLTaWhPBe8PD9Vbqj7el+ENF06rB+3mmCD CJbaZWDVntdpBr/hh5zTjZ1EXFWwNa0E7ju6vN/OvI1Rv8kwxCaHxDly72MrDDmppZYIlv6EWG7 I5Gg/MagUkP4QLMOxDkbJbp5kVhoJIDc+VDLqzlS5f6zQSsnMD7hsNZYRi7jj050m2LnSl2D3SA JUnqcFFS17CJtdApsd1vVV+nsakoWO151MRQVdYWaIFPiX61IuGdYnufoVGmMTkyBg0v1C228rG gGv5JHmfH5zSRgeckhN02H0p8IbUtkeyYpgRV12VQIknuKtv9F+PdxsG0gUBtXp0xh9yJ/uK X-Google-Smtp-Source: AGHT+IHyCW6ojegn8RlgaEjqiOcJ5q02SXJ2ywaVUBj/nSnYgzZsvNl06KCCzv/eBO6qCSVnQD0CEw== X-Received: by 2002:a05:600c:1c95:b0:431:44fe:fd9f with SMTP id 5b1f17b1804b1-43668b5f5aamr472979355e9.23.1736254466411; Tue, 07 Jan 2025 04:54:26 -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 5b1f17b1804b1-43656af6c42sm631014805e9.9.2025.01.07.04.54.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 04:54:26 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED 24/31] ada: Fix constants overlayed by variables Date: Tue, 7 Jan 2025 13:53:42 +0100 Message-ID: <20250107125350.619654-24-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250107125350.619654-1-poulhies@adacore.com> References: <20250107125350.619654-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~patchwork=sourceware.org@gcc.gnu.org From: Piotr Trojanek Code cleanup suggested by GNATcheck rule Constant_Overlays. gcc/ada/ChangeLog: * repinfo-input.adb (Decode_Name, Read_Name_With_Prefix): Use constant overlay with pragma Import. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/repinfo-input.adb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/ada/repinfo-input.adb b/gcc/ada/repinfo-input.adb index 78de4412228..c5cc34a6350 100644 --- a/gcc/ada/repinfo-input.adb +++ b/gcc/ada/repinfo-input.adb @@ -341,7 +341,8 @@ package body Repinfo.Input is else declare - S : String (Integer (Lo) .. Integer (Hi)); + S : constant String (Integer (Lo) .. Integer (Hi)); + pragma Import (Ada, S); for S'Address use Text (Lo)'Address; begin @@ -627,7 +628,8 @@ package body Repinfo.Input is else declare - S : String (Integer (Lo) .. Integer (Hi)); + S : constant String (Integer (Lo) .. Integer (Hi)); + pragma Import (Ada, S); for S'Address use Text (Lo)'Address; begin From patchwork Tue Jan 7 12:53:43 2025 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: 104267 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 ABB423858430 for ; Tue, 7 Jan 2025 13:42:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ABB423858430 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=k6/qp7y8 X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by sourceware.org (Postfix) with ESMTPS id ADF223856093 for ; Tue, 7 Jan 2025 12:54:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ADF223856093 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 ADF223856093 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::42a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254469; cv=none; b=i7PRIc7KvVf2ebFDeP3+f4AZU/7CxysMXcnnRp7kRWWXcpuF9Ri8Uk3V81PEjYq5a8RHru+wc6NdOaGGT37/gc2MdIdfZ0m/QSAWgfZBInbE5BZ8wa9mh4xmz8rOvZHPBpmRkcZTOcq2eWojpKg3QtWW1iG93YdmHbnbpELQd9k= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254469; c=relaxed/simple; bh=pDyGXbJ9WkrIFx33MV6M60uOoKJf1Cer2r5mYV+vPnQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=piuk9E6ni5V9Hws0TQojZTDMVxel1A0LSBr0P5iYoIsRRL+swcCxilFLf+zpEmMpX2kfwyjwuoOQXPNFcP0kAWtdV+AF9PPBFqVADtKeSylyuIloUk0SiuWMKfuEqzX4jgdMIE4yArba8n8y6xaZMuOFbCcXbQXAtuE55S1xeXk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ADF223856093 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-385e0e224cbso7735941f8f.2 for ; Tue, 07 Jan 2025 04:54:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1736254467; x=1736859267; 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=AclxKwEjnpSM+QyFEQE66ykh9PDxcOovtQoGuXqa3uc=; b=k6/qp7y8O/Mu/OcxobIbaeMUqhjA/G9lifY2WHyokt+afoRtU0hqq1DSvzO3A0EO+m 9kThODKGHowJq1kQYXwDoe1Q87P41PAmFK2CjW8npLbMVbdH152BVNJmNfBYBrWPTfZU yW48owlYULQBVAaZAIsgeM7IgQ1t83uZz9de09eQ+cEzB4FypukBEGeBpjJQIK5Ulo4R q0vbzpzB1o2yVZZxvQPdA4mn+h3uCcSmfXx6vAQow+TrnMFl8dC17eO2KuZ7X61NVnXQ 9jE4og8ryNNJTICsqPjkmSWGP+kkbdHrKDiqbHjRnO/Cmxa0x21rz8GHrlS5KM41sg6/ 4VlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736254467; x=1736859267; 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=AclxKwEjnpSM+QyFEQE66ykh9PDxcOovtQoGuXqa3uc=; b=slom6Sw6q8ROWWAp9aIo5NWxtzqP0TPDko2e0OkgGSaifxov7wbe2nzaiuDRpZgfJL WtkNENZatmSHFLLw/Blf8TcUlyKGCw2cFAT9V9Pt3yvvJrt4baeBFgppmhURQ8O+uUcf BVLhuBLBC3RlixmYwPBj1I1ifwDoEBKgaXWMSFix/YPvmfwgTxbr6JDxJsmOv8wqXK3B 0padN8q5iTh+lA0J+g1Q4JCchBvH3oqH/ZmIFo3sCLRyiPgwMIVV4AuySsRxsgC/xjVd zV4jFGq5git31uz8JW6sw5DG4cMAyqBTBGQuccOowqFxc/OkcOpOZGWciUGUSYL+4KsN 47Ig== X-Gm-Message-State: AOJu0Yyh0mbyhjTPa2rA22RDCArH0F9ImKwFgIadeylh/TvvXSaAxBxl /5tZNZD8lzpK09wjPNhJ7q5589JHxd2A7SgFUDOdBFdH86bnJEp3BxGLtujlPQjjRQu1V6SgbXg = X-Gm-Gg: ASbGncuzN49LBmIoOysNkmA9vyCin1pZHfPkP18mk3m5T+dLTF117AoKkul7q5mQXKL uB5LpqDLKOfdFmZ4pBewCLfD+tpgHDRUsNgy1xW4DqzcxeibVuyefu2SD8SXVLNgPh+A6NgxFHB VPybCXUQsyCDg9ASqpHND/eND3PYnMPr1YGsc9sHvsrOAoOZgZSqwcp/WiaKVio9D29JCD/4r9n Dw+AVTIFjoHA4njrjqd1T/i5Ug+GeWq8o/+kuo3Foyu2zVGgcy7R04PWlbTy64MpG/z9pPrFMsM +1S/4UJKjx6pRMq5NsWogkBK2D5Pd9/Eb1oSDNTxIt40S76hLx8gjvExa/h326yzNurticBf X-Google-Smtp-Source: AGHT+IE26NYIOkWbQfw434Sb3vRmDw/qGEf4nYoMIpnkj+MIzlgc1emrRuQLHeNxKlCNDkQHNqUeCg== X-Received: by 2002:a05:6000:2ae:b0:385:f560:7911 with SMTP id ffacd0b85a97d-38a221f300cmr55172880f8f.10.1736254467119; Tue, 07 Jan 2025 04:54: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 5b1f17b1804b1-43656af6c42sm631014805e9.9.2025.01.07.04.54.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 04:54:26 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Javier Miranda Subject: [COMMITTED 25/31] ada: Cleanup preanalysis of static expressions (part 2) Date: Tue, 7 Jan 2025 13:53:43 +0100 Message-ID: <20250107125350.619654-25-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250107125350.619654-1-poulhies@adacore.com> References: <20250107125350.619654-1-poulhies@adacore.com> MIME-Version: 1.0 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, KAM_ASCII_DIVIDERS, 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~patchwork=sourceware.org@gcc.gnu.org From: Javier Miranda According to RM 13.14(8/4), a static expression in an aspect specification does not cause freezing; however, the frontend performs many calls to Preanalyze_Spec_Expression made during the analysis of aspects. This patch, suggested by Eric Botcazou, takes care of this additional code cleanup which requires also replacing many occurrences of the global variable In_Spec_Expression by calls to Preanalysis_Active. gcc/ada/ChangeLog: * exp_util.adb (Insert_Actions): Document behavior under strict preanalysis. * sem.ads (In_Strict_Preanalysis): New subprogram. (Preanalysis_Active): Replace 'and' operator by 'and then'. * sem.adb (In_Strict_Preanalysis): Ditto. * sem_attr.adb (Check_Dereference): Replace In_Spec_Expression occurrence by call to Preanalysis_Active, and document it. (Resolve_Attribute [Atribute_Access]): Ditto. (Eval_Attribute): No evaluation under strict preanalysis. (Validate_Static_Object_Name): No action under strict preanalysis. * sem_ch13.adb (Check_Aspect_At_End_Of_Declarations): Replace calls to Preanalyze_Spec_Expression by calls to Preanalyze_And_Resolve. (Check_Aspect_At_Freeze_Point): Ditto. (Resolve_Aspect_Expressions [Dynamic/Static/Predicate aspects]): Code cleanup adjusting the code to emulate Preanalyze_And_Resolve, instead of Preanalyze_Spec_Expression. (Resolve_Aspect_Expressions [CPU/Interrupt_Priority/Priority/ Storage_Size aspects]): Replace calls to Preanalyze_Spec_Expression by call to Preanalyze_And _Resolve. * sem_ch3.adb (Analyze_Object_Declaration): Replace In_Spec_Expression occurrence by call to Preanalysis_Active. (Find_Type_Of_Object): Add documentation. * sem_ch4.adb (Analyze_Case_Expression): Replace In_Spec_Expression occurrence by call to Preanalysis_Active. * sem_ch6.adb (Analyze_Expression_Function): Minor code reorganization moving the code preanalyzing the expression after the new body has been inserted in the tree to ensure that its Parent attribute is available for preanalysis. * sem_cat.adb (Validate_Static_Object_Name): No action under strict preanalysis. * sem_elab.adb (Check_For_Eliminated_Subprogram): Replace In_Spec_Expression occurrence by call to Preanalysis_Active. * sem_eval.adb (Eval_Intrinsic_Call [Name_Enclosing_Entity]): Ditto. * sem_elim.adb (Check_For_Eliminated_Subprogram): Ditto. * sem_res.adb (Resolve_Entity_Name): Ditto. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_util.adb | 16 +++++++-------- gcc/ada/sem.adb | 11 ++++++++++- gcc/ada/sem.ads | 5 +++++ gcc/ada/sem_attr.adb | 25 ++++++++++++++++-------- gcc/ada/sem_cat.adb | 1 + gcc/ada/sem_ch13.adb | 25 +++++++++++------------- gcc/ada/sem_ch3.adb | 7 +++++-- gcc/ada/sem_ch4.adb | 2 +- gcc/ada/sem_ch6.adb | 46 ++++++++++++++++++++++---------------------- gcc/ada/sem_elab.adb | 2 +- gcc/ada/sem_elim.adb | 5 +++-- gcc/ada/sem_eval.adb | 2 +- gcc/ada/sem_res.adb | 2 +- 13 files changed, 87 insertions(+), 62 deletions(-) diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 66ba73226ed..69d6e25794e 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -7708,20 +7708,20 @@ package body Exp_Util is return; end if; - -- Insert the action when the context is "Handling of Default and Per- - -- Object Expressions" only when requested by the caller. - - if Spec_Expr_OK then - null; - -- Ignore insert of actions from inside default expression (or other -- similar "spec expression") in the special spec-expression analyze -- mode. Any insertions at this point have no relevance, since we are -- only doing the analyze to freeze the types of any static expressions. -- See section "Handling of Default and Per-Object Expressions" in the - -- spec of package Sem for further details. + -- spec of package Sem for further details. However, if the user does + -- nevertheless request the insert, then obey it. + + -- Under strict preanalysis we cannot ignore insert of actions because + -- we may be adding to the tree a subtype declaration that is required + -- for proper preanalysis (see Sem_Ch3.Find_Type_Of_Object). - elsif In_Spec_Expression then + if In_Spec_Expression and then not Spec_Expr_OK then + pragma Assert (not In_Strict_Preanalysis); return; end if; diff --git a/gcc/ada/sem.adb b/gcc/ada/sem.adb index a7e3df9f06e..9b013995b8a 100644 --- a/gcc/ada/sem.adb +++ b/gcc/ada/sem.adb @@ -1338,13 +1338,22 @@ package body Sem is Scope_Stack.Locked := True; end Lock; + --------------------------- + -- In_Strict_Preanalysis -- + --------------------------- + + function In_Strict_Preanalysis return Boolean is + begin + return Preanalysis_Active and then not In_Spec_Expression; + end In_Strict_Preanalysis; + ------------------------ -- Preanalysis_Active -- ------------------------ function Preanalysis_Active return Boolean is begin - return not Full_Analysis and not Expander_Active; + return not Full_Analysis and then not Expander_Active; end Preanalysis_Active; ---------------- diff --git a/gcc/ada/sem.ads b/gcc/ada/sem.ads index 89b616f0bd4..f317479d461 100644 --- a/gcc/ada/sem.ads +++ b/gcc/ada/sem.ads @@ -703,6 +703,11 @@ package Sem is -- This function returns True if an explicit pragma Suppress for check C -- is present in the package defining E. + function In_Strict_Preanalysis return Boolean; + pragma Inline (In_Strict_Preanalysis); + -- Determine whether preanalysis is active at the point of invocation + -- and we are not processing a Spec Expression. + function Preanalysis_Active return Boolean; pragma Inline (Preanalysis_Active); -- Determine whether preanalysis is active at the point of invocation diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 39725d23442..e74d3051b34 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -2106,11 +2106,12 @@ package body Sem_Attr is -- designated type of the access type, since the type of the -- referenced array is this type (see AI95-00106). - -- As done elsewhere, freezing must not happen when preanalyzing - -- a pre- or postcondition or a default value for an object or for - -- a formal parameter. + -- However, we must not freeze the designated type during + -- preanalysis; neither under strict preanalysis nor when + -- preanalyzing a pre- or postcondition or a default value + -- for an object or for a formal parameter. - if not In_Spec_Expression then + if not Preanalysis_Active then Freeze_Before (N, Designated_Type (P_Type)); end if; @@ -8139,6 +8140,13 @@ package body Sem_Attr is if Nkind (N) /= N_Attribute_Reference then return; + + -- No evaluation required under strict preanalysis because locating + -- static expressions is not needed; this also minimizes making tree + -- modifications during strict preanalysis. + + elsif In_Strict_Preanalysis then + return; end if; Aname := Attribute_Name (N); @@ -11342,10 +11350,11 @@ package body Sem_Attr is end loop; -- If Prefix is a subprogram name, this reference freezes, - -- but not if within spec expression mode. The profile of - -- the subprogram is not frozen at this point. + -- but not during preanalysis (including preanalysis of + -- spec expressions). The profile of the subprogram is not + -- frozen at this point. - if not In_Spec_Expression then + if not Preanalysis_Active then Freeze_Before (N, Entity (P), Do_Freeze_Profile => False); end if; @@ -11354,7 +11363,7 @@ package body Sem_Attr is -- If it is an object, complete its resolution. elsif Is_Overloadable (Entity (P)) then - if not In_Spec_Expression then + if not Preanalysis_Active then Freeze_Before (N, Entity (P), Do_Freeze_Profile => False); end if; diff --git a/gcc/ada/sem_cat.adb b/gcc/ada/sem_cat.adb index d8928119512..0bd976cbf65 100644 --- a/gcc/ada/sem_cat.adb +++ b/gcc/ada/sem_cat.adb @@ -2177,6 +2177,7 @@ package body Sem_Cat is or else not Comes_From_Source (N) or else In_Subprogram_Or_Concurrent_Unit or else Ekind (Current_Scope) = E_Block + or else In_Strict_Preanalysis then return; diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index a9aba1de6e4..2beb6b95daf 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -10039,7 +10039,7 @@ package body Sem_Ch13 is -- If the predicate pragma comes from an aspect, replace the -- saved expression because we need the subtype references - -- replaced for the calls to Preanalyze_Spec_Expression in + -- replaced for the calls to Preanalyze_And_Resolve in -- Check_Aspect_At_xxx routines. if Present (Asp) then @@ -10853,12 +10853,12 @@ package body Sem_Ch13 is | Aspect_Static_Predicate then Push_Type (Ent); - Preanalyze_Spec_Expression (Freeze_Expr, Standard_Boolean); + Preanalyze_And_Resolve (Freeze_Expr, Standard_Boolean); Pop_Type (Ent); elsif A_Id = Aspect_Priority then Push_Type (Ent); - Preanalyze_Spec_Expression (Freeze_Expr, Any_Integer); + Preanalyze_And_Resolve (Freeze_Expr, Any_Integer); Pop_Type (Ent); else @@ -10916,13 +10916,14 @@ package body Sem_Ch13 is | Aspect_Static_Predicate then Push_Type (Ent); - Preanalyze_Spec_Expression (End_Decl_Expr, T); + Preanalyze_And_Resolve (End_Decl_Expr, T); Pop_Type (Ent); elsif A_Id = Aspect_Predicate_Failure then - Preanalyze_Spec_Expression (End_Decl_Expr, Standard_String); + Preanalyze_And_Resolve (End_Decl_Expr, Standard_String); + elsif Present (End_Decl_Expr) then - Preanalyze_Spec_Expression (End_Decl_Expr, T); + Preanalyze_And_Resolve (End_Decl_Expr, T); end if; Err := @@ -11346,7 +11347,7 @@ package body Sem_Ch13 is -- Do the preanalyze call if Present (Expression (ASN)) then - Preanalyze_Spec_Expression (Expression (ASN), T); + Preanalyze_And_Resolve (Expression (ASN), T); end if; end Check_Aspect_At_Freeze_Point; @@ -16341,19 +16342,16 @@ package body Sem_Ch13 is -- name resolution errors if the predicate function has -- not been built yet. - -- Note that we cannot use Preanalyze_Spec_Expression + -- Note that we cannot use Preanalyze_And_Resolve -- directly because of the special handling required for -- quantifiers (see comments on Resolve_Aspect_Expression -- above) but we need to emulate it properly. if No (Predicate_Function (E)) then declare - Save_In_Spec_Expression : constant Boolean := - In_Spec_Expression; Save_Full_Analysis : constant Boolean := Full_Analysis; begin - In_Spec_Expression := True; Full_Analysis := False; Expander_Mode_Save_And_Set (False); Push_Type (E); @@ -16361,7 +16359,6 @@ package body Sem_Ch13 is Pop_Type (E); Expander_Mode_Restore; Full_Analysis := Save_Full_Analysis; - In_Spec_Expression := Save_In_Spec_Expression; end; end if; @@ -16404,7 +16401,7 @@ package body Sem_Ch13 is | Aspect_Priority => Push_Type (E); - Preanalyze_Spec_Expression (Expr, Any_Integer); + Preanalyze_And_Resolve (Expr, Any_Integer); Pop_Type (E); -- Ditto for Storage_Size. Any other aspects that carry @@ -16412,7 +16409,7 @@ package body Sem_Ch13 is -- relevant to the misuse of deferred constants. when Aspect_Storage_Size => - Preanalyze_Spec_Expression (Expr, Any_Integer); + Preanalyze_And_Resolve (Expr, Any_Integer); when others => if Present (Expr) then diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 7bedc043c8d..f0ce27b5e23 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -4575,7 +4575,8 @@ package body Sem_Ch3 is and then Is_Itype (T) then Set_Has_Delayed_Freeze (T); - elsif not In_Spec_Expression then + + elsif not Preanalysis_Active then Freeze_Before (N, T); end if; end if; @@ -18796,7 +18797,9 @@ package body Sem_Ch3 is end if; -- When generating code, insert subtype declaration ahead of - -- declaration that generated it. + -- declaration that generated it. Similar behavior required under + -- preanalysis (including strict preanalysis) to perform the + -- minimum decoration, and avoid reporting spurious errors. Insert_Action (Obj_Def, Make_Subtype_Declaration (Sloc (P), diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index 7bd30d6993e..6ec351e42a6 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -1795,7 +1795,7 @@ package body Sem_Ch4 is if Is_OK_Static_Subtype (Exp_Type) and then Has_Static_Predicate_Aspect (Exp_Type) - and then In_Spec_Expression + and then Preanalysis_Active then null; diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index d81bdc50ee0..9cd135d48ce 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -533,29 +533,6 @@ package body Sem_Ch6 is Set_Corresponding_Body (N, Defining_Entity (New_Body)); Set_Corresponding_Spec (New_Body, Def_Id); - -- Within a generic preanalyze the original expression for name - -- capture. The body is also generated but plays no role in - -- this because it is not part of the original source. - -- If this is an ignored Ghost entity, analysis of the generated - -- body is needed to hide external references (as is done in - -- Analyze_Subprogram_Body) after which the subprogram profile - -- can be frozen, which is needed to expand calls to such an ignored - -- Ghost subprogram. - - if Inside_A_Generic then - Set_Has_Completion (Def_Id, not Is_Ignored_Ghost_Entity (Def_Id)); - Push_Scope (Def_Id); - Install_Formals (Def_Id); - Preanalyze_Spec_Expression (Expr, Typ); - End_Scope; - else - Push_Scope (Def_Id); - Install_Formals (Def_Id); - Preanalyze_Spec_Expression (Expr, Typ); - Check_Limited_Return (Orig_N, Expr, Typ); - End_Scope; - end if; - -- If this is a wrapper created in an instance for a formal -- subprogram, insert body after declaration, to be analyzed when the -- enclosing instance is analyzed. @@ -591,6 +568,29 @@ package body Sem_Ch6 is end; end if; + -- Within a generic preanalyze the original expression for name + -- capture. The body is also generated but plays no role in + -- this because it is not part of the original source. + -- If this is an ignored Ghost entity, analysis of the generated + -- body is needed to hide external references (as is done in + -- Analyze_Subprogram_Body) after which the subprogram profile + -- can be frozen, which is needed to expand calls to such an ignored + -- Ghost subprogram. + + if Inside_A_Generic then + Set_Has_Completion (Def_Id, not Is_Ignored_Ghost_Entity (Def_Id)); + Push_Scope (Def_Id); + Install_Formals (Def_Id); + Preanalyze_Spec_Expression (Expr, Typ); + End_Scope; + else + Push_Scope (Def_Id); + Install_Formals (Def_Id); + Preanalyze_Spec_Expression (Expr, Typ); + Check_Limited_Return (Orig_N, Expr, Typ); + End_Scope; + end if; + -- In the case of an expression function marked with the aspect -- Static, we need to check the requirement that the function's -- expression is a potentially static expression. This is done diff --git a/gcc/ada/sem_elab.adb b/gcc/ada/sem_elab.adb index 414caf2edaa..1fa714d229e 100644 --- a/gcc/ada/sem_elab.adb +++ b/gcc/ada/sem_elab.adb @@ -17389,7 +17389,7 @@ package body Sem_Elab is -- Nothing to do if call is being preanalyzed, as when within a -- pre/postcondition, a predicate, or an invariant. - elsif In_Spec_Expression then + elsif Preanalysis_Active then return; end if; diff --git a/gcc/ada/sem_elim.adb b/gcc/ada/sem_elim.adb index d553950dbd7..2bff3dc4ae2 100644 --- a/gcc/ada/sem_elim.adb +++ b/gcc/ada/sem_elim.adb @@ -728,9 +728,10 @@ package body Sem_Elim is begin -- No check needed within a default expression for a formal, since this -- is not really a use, and the expression (a call or attribute) may - -- never be used if the enclosing subprogram is itself eliminated. + -- never be used if the enclosing subprogram is itself eliminated. Same + -- under strict preanalysis. - if In_Spec_Expression then + if Preanalysis_Active then return; end if; diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb index c55e4d3bb24..399b22d0c52 100644 --- a/gcc/ada/sem_eval.adb +++ b/gcc/ada/sem_eval.adb @@ -2927,7 +2927,7 @@ package body Sem_Eval is | Name_Source_Location => if Inside_A_Generic - or else In_Spec_Expression + or else Preanalysis_Active then null; else diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 889cbd307b4..5f990f3dc4e 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -8147,7 +8147,7 @@ package body Sem_Res is and then Comes_From_Source (E) and then No (Constant_Value (E)) and then Is_Frozen (Etype (E)) - and then not In_Spec_Expression + and then not Preanalysis_Active and then not Is_Imported (E) and then Nkind (Parent (E)) /= N_Object_Renaming_Declaration then From patchwork Tue Jan 7 12:53:44 2025 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: 104251 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 E714438515CD for ; Tue, 7 Jan 2025 13:14:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E714438515CD 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=PfCwE773 X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by sourceware.org (Postfix) with ESMTPS id 17B0F3857022 for ; Tue, 7 Jan 2025 12:54:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 17B0F3857022 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 17B0F3857022 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254469; cv=none; b=EzkNSI1oZAuf67O0aUEd0nr9v9ZgUj2PlythtLpXtfxs0npf3JQyzsNsV6GfB/qvfnqvn9Tqz7EGHWNj9Ug+PpNxEdxZon3WVI6rVW8DRKeN74NisbzkaFjfNNGwF9JTPeuLGG6Hq4OfmhMclvBTwqpoXPBGUe0Scnd+XznFldA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254469; c=relaxed/simple; bh=og4Frv2ZtePZprf5Ixwt5fun9P1o7SJDDnqaTnN0OSk=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=e7LbR98QVVOh+0zB25wIEU4LPFo6IBdYakleyVG5ciLgvUOulDZ1MUhfhQz852Uy7xJIDTqAnNTUH9k9O0FkBX0NQRsz8f5JxohUBUxfrcoYCFR4eXunVyk4IDFZCiqkdMfhM0bV6UzcJUYbwHEQwJanDjpEY8AsIigIggyCIGo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 17B0F3857022 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4361e89b6daso106784305e9.3 for ; Tue, 07 Jan 2025 04:54:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1736254468; x=1736859268; 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=6DJ0kqVDqJZf9U4t2ijws0TQLd6qgkO7gNd1+W9TCuc=; b=PfCwE773HpgsneLLTigK0uSvMlbvWbgQjq+tyu85kDIGHZuE5oh+ni15CSyJao2d3H oxKpLvYrlLEMC00+REgFIMho04Ncx+8n/dhCZBfh97Jkq7GtW0Z7fKHxZhA0nlBcQOlF 4+ZHEIFz6x76PhhdB6ApxrMQNue5TCIu4ApG/AzHUv4Nmwb3EjbNDj/fI6newNj9Qvr4 aj0C85DkIBbxvmAxBJ4lENhK4o+g5/ywQwkalY/AYir8lNEKwHxJrq8pIH8BZWkQe9Ln Je/YfGoB00CatZOZG4P6FQrjB2Tcdyu0Ie6i3DNyGb+gJEn7m/axTqonzSLQMApUYsL6 bZ4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736254468; x=1736859268; 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=6DJ0kqVDqJZf9U4t2ijws0TQLd6qgkO7gNd1+W9TCuc=; b=vZ7EsLVAPxWmcuXo9iFDA0bcLvF1lGad4+7PZXelT00sBtObugujCaRpzlUW5riJXc 5gOH7ywdI6vdV/jzBX8aKYjrmE9oQgGvlKh0b8Meb7ecAKsgeZnPMJvbSzBvJ6ijmdIc Iyy7381sTtQjfuyvp4YgVJjBIar/aKlZaGxjRdEKd78/0TK2OIETWgCYHnQUe+ehK4lZ vHC2hTV53i3gYudj2Y5Ysj8Sc3VEZYSxApjGWd7YKNVQonCXEvF7UJ/YpVUtxxPCrmAn M2vZXdcAZZZUoYaclNUaFy7bjksNxwEyS+F65ZS9zQH0dY4+hbZ6AIekR/yp67zclarE 8LXg== X-Gm-Message-State: AOJu0Yw4qWJ2gKSMK4Umc/lbvSociXPV5yGIXcWpeugOLsXMuFZZYVaZ jONKNrDt9nYFtMHwL1jropu+7Ubqz7koOW498Bz0DHb4uWmCs0hHMYKbKL8qDXnb57v49kLCcWA = X-Gm-Gg: ASbGncvqvmDfj62dOiCCeYQn7gd8YPKNrxP8VX5cA1gYgoF2+3qwCgYIljg8+qPKPQs rvKGfBGIDIhzsRLgIRBAFerD4wdbhioBDdfLwsPRk+v22TkH8FXUlvosCkjL/5iqrox/4WVXLRW BGXPJ7qQ8IMJsf58pVTo1/vmXi22cefNI+T1jOiDJbcb3bXfqf9k9TSxUxSfwRDasA4QugN3dps TCDddgdFCNr1OotTJSAz2DwcVmRjQE5VjLnVALYcTU96LL/I6ze+S19BMMDYaeLT8VZdGWeFwYo HY1mcebBxTCbgeXiOW2TNnrYmJ/V1130Y6lSjP9qbmqzvrs8OjBH66Glg2OYtH1wXYD+G6K9 X-Google-Smtp-Source: AGHT+IFRBBD0v2MfBoBZ9NaivLFCfGvBTRfeJV//KSCl+kpua99gCjdo4EUVEQwmlXxrZYZkjZDuDQ== X-Received: by 2002:a05:600c:4ec9:b0:436:51bb:7a43 with SMTP id 5b1f17b1804b1-4366854852dmr521821405e9.5.1736254467820; Tue, 07 Jan 2025 04:54: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 5b1f17b1804b1-43656af6c42sm631014805e9.9.2025.01.07.04.54.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 04:54:27 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 26/31] ada: Do not raise exceptions from Exp_Aggr.Packed_Array_Aggregate_Handled Date: Tue, 7 Jan 2025 13:53:44 +0100 Message-ID: <20250107125350.619654-26-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250107125350.619654-1-poulhies@adacore.com> References: <20250107125350.619654-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~patchwork=sourceware.org@gcc.gnu.org From: Eric Botcazou An exception is now raised during bootstrap and this causes compatibility issues with older compilers. gcc/ada/ChangeLog: * exp_aggr.adb (Packed_Array_Aggregate_Handled): Remove declaration and handler for Not_Handled local exception. Check the return value of Get_Component_Val instead. (Get_Component_Val): Return No_Uint instead of raising Not_Handled. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_aggr.adb | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index 428115f81ba..378168fe40b 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -8962,9 +8962,6 @@ package body Exp_Aggr is Typ : constant Entity_Id := Etype (N); Ctyp : constant Entity_Id := Component_Type (Typ); - Not_Handled : exception; - -- Exception raised if this aggregate cannot be handled - begin -- Handle one- or two dimensional bit packed array @@ -8997,7 +8994,7 @@ package body Exp_Aggr is -- Given a expression value N of the component type Ctyp, returns a -- value of Csiz (component size) bits representing this value. If -- the value is nonstatic or any other reason exists why the value - -- cannot be returned, then Not_Handled is raised. + -- cannot be returned, then No_Uint is returned. ----------------------- -- Get_Component_Val -- @@ -9020,7 +9017,7 @@ package body Exp_Aggr is if not Compile_Time_Known_Value (N) or else Nkind (N) = N_String_Literal then - raise Not_Handled; + return No_Uint; end if; Val := Expr_Rep_Value (N); @@ -9098,6 +9095,9 @@ package body Exp_Aggr is -- justified modular type processing), so we do not have to -- worry about that here. + Val : Uint; + -- Temporary value + Lit : Node_Id; -- Integer literal for resulting constructed value @@ -9146,16 +9146,23 @@ package body Exp_Aggr is if Len = 0 then Aggregate_Val := Uint_0; + else Expr := First (Expressions (N)); - Aggregate_Val := Get_Component_Val (Expr) * Uint_2 ** Shift; + Val := Get_Component_Val (Expr); + if No (Val) then + return False; + end if; + Aggregate_Val := Val * Uint_2 ** Shift; for J in 2 .. Len loop Shift := Shift + Incr; Next (Expr); - Aggregate_Val := - Aggregate_Val + - Get_Component_Val (Expr) * Uint_2 ** Shift; + Val := Get_Component_Val (Expr); + if No (Val) then + return False; + end if; + Aggregate_Val := Aggregate_Val + Val * Uint_2 ** Shift; end loop; end if; @@ -9182,10 +9189,6 @@ package body Exp_Aggr is end; end; end; - - exception - when Not_Handled => - return False; end Packed_Array_Aggregate_Handled; ---------------------------- From patchwork Tue Jan 7 12:53:45 2025 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: 104260 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 1B8D33858405 for ; Tue, 7 Jan 2025 13:28:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1B8D33858405 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=Av4EQ/Sn 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 DC188385843B for ; Tue, 7 Jan 2025 12:54:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DC188385843B 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 DC188385843B 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=1736254470; cv=none; b=kRfBKfdFWSvkyGy6a9RUfQOCLSNd49IbVtYZfxJQEnrQBDvcoaJwC3ZOc3slt9tmw5bfyBY+5ujg+yJlxk90uK60DZD6PXFo2v/LHpLP7+mAFZqp9moMEN3kqfJnt5OS5KbAHtBKJAFMfJlaSX4rWJlse82HQ9pbhcMK47nBM9M= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254470; c=relaxed/simple; bh=wepg3GYFURUOUW3RoZp0M2JJU+hO0dTnZ8UoXe0MI8A=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=JeQM18ZBXdL41xVxMe+DP+Fe10MXBM29QNx6LYz7+wxlYbgA2mhPTRxdnWT75MbO7d2GECxwhuQD65k+DcFazTlKR6OXJh68BcCx2Dfuv0xrStrPdnhcLB6j0WEDoBN1jvuAhfmb1edvoEZCSUM8dIi2Vj+hXqtd7YPEwPhSfqc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DC188385843B Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-3862d161947so7369465f8f.3 for ; Tue, 07 Jan 2025 04:54:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1736254468; x=1736859268; 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=nGu3DrxpC1JYzZWVotYzBzvxdD/9Y6xGEU+qDRgGDvU=; b=Av4EQ/Sn6xUyVywTRITnVDYnN+BZ3rvoO+5kb9nCoFWFCtS824vrGvblTp/Bvi7V9n wKHdNcgr1nZBkl12cPLpNfycOSMFYY5s7Bxhdpc3f4Y0H6c0GNNTokaAl2eB2Od61Ftd 88iePIydC+D3kun3oKyjo49Q5U9K+8S4pDJRPWukAExYq742yjuQ7uEaAfoQxhRbnsr6 NIsMfaj41CZ8HPyZeXOlLRjBZqbTLpEh1MM/lyZWihCb4aHHVOo04qmHzoKz9FrfeObP rwqShFKKp2XY9DNYkkay3v1qkRRqqqPPyj6Y+n/21kp+F5JlkNLM3bbWPNzJ4Zi+Kg6r t5uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736254468; x=1736859268; 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=nGu3DrxpC1JYzZWVotYzBzvxdD/9Y6xGEU+qDRgGDvU=; b=v/Zv/6joqYQKT62ejnLBwcAZAPoOk4XgUYVm4dav9cpuI5GsD9Dt+p+cFWWxpNFeH4 EttWs2GDw4g33sRbSr/8q8q8L7PIY8Nh56yomjThPlj9RrqBkcxFgKJm4zNvfANIIezf HO7Th23okT0n9uawG8gXlkiJcMBij6QENJZW6DvTW6n+OWbxgiu85ZZHaDBzBiApn1N5 v0Y+jnugLGI2mdLp7xBPYp8tBuyPanNp3s5daKd4/sB6qXHQ2Fe+cnen6ZiVtduxCM+R CDvSiCBVuaXeMf+AKI5HGhQq0RWmXFpv+TkVJh5WLkrFuyq7eda+j44Mj1qeA6v/el0n OIzw== X-Gm-Message-State: AOJu0Yz7+Hj6FRwszzb9qaTrTHBczTRxCAei8EDjiMi3u6nDAjFkSAAn ZgWVlXbTxHdK66vC4AVswVi6vU5xIQG/PhBhou8XZHxFXbJS6+Hp+U6V5BIzcI6PA26kVWhT9wY = X-Gm-Gg: ASbGnct/WF5bABrb7e1pp14N888X28NIt6UbRIbaOjXzizb+GXeAtDEW6kterz5KyVL OEMNduNjXEhBNskR1coWuY2cYc2IR1T/mrDXU1uSK3dMGzw9W3p4e2ynIfTg4hghZnAVBG8zPyD qXeogKaCetU742NRB4tHp1iKz2zVpcFFahlqEa7gIqnyj22c0SLT/3WwBtgfP0mtWfYx2o0qHBo kCjRuX6kf+pR3t4RyFnKAKWZqT/enJU28gAm4uAYNK9fKAMnpvW+KIZjNH9vPtdsbDgKviC6vGX 4G5HCOtzbpvMxszg3r7JYDnBvWk+B3Y5X0K4nnC52TMTT3rBQnl+L+JvTOA8bH/WshKe/Ytu X-Google-Smtp-Source: AGHT+IHhhjsqgRM+CfpzLDIIcR94FNvO4qgWRM+DHeLW6eFZSZ1NO7UN8m3iBjR73TKFoQahJnLHFA== X-Received: by 2002:a5d:598d:0:b0:385:e013:39ef with SMTP id ffacd0b85a97d-38a221e30aemr46219619f8f.6.1736254468493; Tue, 07 Jan 2025 04:54:28 -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 5b1f17b1804b1-43656af6c42sm631014805e9.9.2025.01.07.04.54.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 04:54:28 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED 27/31] ada: Remove unused AST flag Address_Warning_Posted Date: Tue, 7 Jan 2025 13:53:45 +0100 Message-ID: <20250107125350.619654-27-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250107125350.619654-1-poulhies@adacore.com> References: <20250107125350.619654-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 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~patchwork=sourceware.org@gcc.gnu.org From: Piotr Trojanek Flag Address_Warning_Posted was only read and never written, so it can be safely removed. gcc/ada/ChangeLog: * gen_il-fields.ads (Opt_Field_Enum): Remove flag. * gen_il-gen-gen_nodes.adb (N_Attribute_Definition_Clause): Remove field. * sem_ch13.adb (Validate_Address_Clauses): Remove read of the flag. * sinfo.ads (Address_Warning_Posted): Remove flag description. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gen_il-fields.ads | 1 - gcc/ada/gen_il-gen-gen_nodes.adb | 1 - gcc/ada/sem_ch13.adb | 6 ++---- gcc/ada/sinfo.ads | 6 ------ 4 files changed, 2 insertions(+), 12 deletions(-) diff --git a/gcc/ada/gen_il-fields.ads b/gcc/ada/gen_il-fields.ads index fe2da80c548..789fb76875d 100644 --- a/gcc/ada/gen_il-fields.ads +++ b/gcc/ada/gen_il-fields.ads @@ -65,7 +65,6 @@ package Gen_IL.Fields is Activation_Chain_Entity, Acts_As_Spec, Actual_Designated_Subtype, - Address_Warning_Posted, Aggregate_Bounds_Or_Ancestor_Type, Aliased_Present, All_Others, diff --git a/gcc/ada/gen_il-gen-gen_nodes.adb b/gcc/ada/gen_il-gen-gen_nodes.adb index c3a97e6e16e..b361aeeca1d 100644 --- a/gcc/ada/gen_il-gen-gen_nodes.adb +++ b/gcc/ada/gen_il-gen-gen_nodes.adb @@ -98,7 +98,6 @@ begin -- Gen_IL.Gen.Gen_Nodes (Sy (Name, Node_Id, Default_Empty), Sy (Chars, Name_Id, Default_No_Name), Sy (Expression, Node_Id, Default_Empty), - Sm (Address_Warning_Posted, Flag), Sm (Check_Address_Alignment, Flag), Sm (Entity_Or_Associated_Node, Node_Id), -- just Entity Sm (From_Aspect_Specification, Flag), diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 2beb6b95daf..00489722921 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -18055,11 +18055,9 @@ package body Sem_Ch13 is X_Offs : Uint; begin - -- Skip processing of this entry if warning already posted, or if - -- alignments are not set. + -- Skip processing of this entry if alignments are not set - if not Address_Warning_Posted (ACCR.N) - and then Known_Alignment (ACCR.X) + if Known_Alignment (ACCR.X) and then Known_Alignment (ACCR.Y) then Expr := Original_Node (Expression (ACCR.N)); diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads index e9b2f0f3c5c..94bbb2f974e 100644 --- a/gcc/ada/sinfo.ads +++ b/gcc/ada/sinfo.ads @@ -788,11 +788,6 @@ package Sinfo is -- created for the expansion of an allocator with a subtype_indication -- and the designated subtype is an unconstrained composite type. - -- Address_Warning_Posted - -- Present in N_Attribute_Definition nodes. Set to indicate that we have - -- posted a warning for the address clause regarding size or alignment - -- issues. Used to inhibit multiple redundant messages. - -- Aggregate_Bounds -- Present in array N_Aggregate nodes. If the bounds of the aggregate are -- known at compile time, this field points to an N_Range node with those @@ -7549,7 +7544,6 @@ package Sinfo is -- Check_Address_Alignment -- From_Aspect_Specification -- Is_Delayed_Aspect - -- Address_Warning_Posted -- Note: if From_Aspect_Specification is set, then Sloc points to the -- aspect name, and Entity is resolved already to reference the entity From patchwork Tue Jan 7 12:53:46 2025 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: 104262 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 DBE1A3858C48 for ; Tue, 7 Jan 2025 13:34:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DBE1A3858C48 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=hE5mUh5w X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by sourceware.org (Postfix) with ESMTPS id 7301538560A5 for ; Tue, 7 Jan 2025 12:54:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7301538560A5 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 7301538560A5 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::330 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254470; cv=none; b=ENosc2lw3rf8fPI6DQ9Qn7oMS5GkOcdGHddEIi1rG6Nlt+le4geCVQ5pVZr+g1mFvY/Pq7JqUDj4GeZjO+AFNJjNzwlw7BDRgqcvjUJlZdX4YSc7WuK8tS9HxMioKw19i2C7f29iHNaGHSSdZ93uW05bAA+d8P9eauYXULw1H/w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254470; c=relaxed/simple; bh=sO9bAhOjrCYjpVPfs2TeCeVuvieCoB6Xsj5PJFhkN8g=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=QLGIlxqsepoeMaFF9yLvRIiqzF+IIcXt8bv1rUFzwoGGk8XvlWMSTCbHBAwcA2uleSY8UUa2A727cyuJOjxTqfxYSADHQ6OQaFnrQCNAUjP3VWJm8usyRheEPER2i8XnWjnRMU8gG+tS3cSbazu0cP0TXpLG4eIXP1Dqa+s+n5I= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7301538560A5 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-4361b0ec57aso154043065e9.0 for ; Tue, 07 Jan 2025 04:54:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1736254469; x=1736859269; 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=xW0xAcgzqVflvQTaBvi8JZVplhQJ/L39VDFPS8Q3loI=; b=hE5mUh5wGV7aWS/hgrMCIYpYHyb7Ql3HdqDE/Ja1wDOBxwBY2Dm8IAeU/hUu6GatEa AJWvvfjZZRBbDOvhFjLaC4+gvQ1EJbCNzo3xIrKu+GgpX27lmDfMag2i5zcpOTYbL9X1 C+nYPgFKjN0ZnTdbildGIt9eexLDQAcaLYmuWc+XtLB7yYGi4F+qNz6PWaylfdpWiO5M 8pbdPosJVZE1+0W7ojMHc8FSI5GUxwV9KdDDekrwxlkXkb3jnzs5IJTgoS3zbTDfRzMH p/KUo3KM0iO3bzYRYUYCPWpv27RPTwSWuT8zC+aVwNWNLPJjln3St2d6uERfxJfV+qQe 2svA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736254469; x=1736859269; 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=xW0xAcgzqVflvQTaBvi8JZVplhQJ/L39VDFPS8Q3loI=; b=L4bQnuPmtLUbNpXs3Z2vK1Ftq8fFufdoRtd6kZr+f576qHGBai4JbGWQalOAn5kGh3 JuIn7VnrqmaM5JweGnN6cgpo46+VxRLaQtKHkfk61A9Qlw6EBDea64wo7/azMzt+n/6X 6+7HUCx6ZF7ZU8Rj7hgrL63Dw4YVjD4FI5vQeRFTZ2o+hA+2CdZYBldcsU317AjEiGcL QDSjUO1q5uOcEPmFA8KjRYB6QFc6b9iRUamRbcVQ6xdrQmVGCsjYgXsxDm/RP2MO/LdJ sj/rDkDkotk6rKpE5YK6f/yZfmiY1CNgj8VpYpwJ2u/xxhLbO5hd6DxWTUnt9GdB4VtH lnog== X-Gm-Message-State: AOJu0Ywt2C671gmNavjzufiyNDvKGXsedG7DLtRFQSl1udinvBKpP0bR lg9A3im4EUogg+0y53hsf/Tp5OMzNeJHyEp/3bDk6g8W0qv+GbknQwmXaxPsTFLGn37R9ddQqdA = X-Gm-Gg: ASbGncusJn85QcwOo9Ky0qgzDRap8RUQHl/jBYeB58J6mtJf0YcKr7dnlw1gQwtcijq wuri4kWXkytowDTtzqFtCB0aGdYkm0I6IM1SgoqM266Jp2hFBg4cPQO4XDbhHy++TQQdXOhsYJo nttPDl5ZqaohmGpVzBSdrSQGfKBTMPWqIYdZ+nd7ePPy1HUTnkylT0c2jX1vnIzLB3tBgQDIjuS g0M3RHBoORVexTW9f9NIvwlsXdjIFW4G7OwTthWfMGL99QovXPzNYhETe4Zv/cSOA1+3WlUl2xd hW5nshFJv5RM4FBWv39eZIDpZz+wluKZegnwKHHsKzZD7gQpFg7fUst6B+5h1tkJy/gdvK44 X-Google-Smtp-Source: AGHT+IHrQZn+sybe0OWmKmT3f5pNyKSzKlJa0vEAWljPeVSt0ahfRflpxzMtDXq/N9s1MI+DUKzZSg== X-Received: by 2002:a05:600c:4511:b0:431:44f6:566f with SMTP id 5b1f17b1804b1-43668642d71mr517132555e9.13.1736254469140; Tue, 07 Jan 2025 04:54:29 -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 5b1f17b1804b1-43656af6c42sm631014805e9.9.2025.01.07.04.54.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 04:54:28 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 28/31] ada: Do not create temporaries for initialization statements Date: Tue, 7 Jan 2025 13:53:46 +0100 Message-ID: <20250107125350.619654-28-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250107125350.619654-1-poulhies@adacore.com> References: <20250107125350.619654-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 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~patchwork=sourceware.org@gcc.gnu.org From: Eric Botcazou Assignment statements marked with the No_Ctrl_Actions or No_Finalize_Actions flag are initialization statements and, therefore, no temporaries are needed to hold the value of the right-hand side for them. gcc/ada/ChangeLog: * gcc-interface/trans.cc (Call_to_gnu): Always use the return slot optimization if the parent node is an initialization statement. (gnat_to_gnu) : Build an INIT_EXPR instead of a MODIFY_EXPR if this is an initialization statement. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/trans.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interface/trans.cc index cda73d509e8..b65a846ee66 100644 --- a/gcc/ada/gcc-interface/trans.cc +++ b/gcc/ada/gcc-interface/trans.cc @@ -5517,10 +5517,17 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, gigi_checking_assert (!Do_Range_Check (gnat_node)); + /* If the parent is an initialization statement, we can use the + return slot optimization. */ + if (Nkind (gnat_parent) == N_Assignment_Statement + && (No_Ctrl_Actions (gnat_parent) + || No_Finalize_Actions (gnat_parent))) + op_code = INIT_EXPR; + /* ??? If the return type has variable size, then force the return slot optimization as we would not be able to create a temporary. That's what has been done historically. */ - if (return_type_with_variable_size_p (gnu_result_type)) + else if (return_type_with_variable_size_p (gnu_result_type)) op_code = INIT_EXPR; /* If this is a call to a pure function returning an array of scalar @@ -7811,6 +7818,12 @@ gnat_to_gnu (Node_Id gnat_node) = build_unary_op (ADDR_EXPR, TREE_TYPE (arg), gnu_lhs); } + /* If the statement is an initialization, build one too. */ + else if (No_Ctrl_Actions (gnat_node) + || No_Finalize_Actions (gnat_node)) + gnu_result + = build_binary_op (INIT_EXPR, NULL_TREE, gnu_lhs, gnu_rhs); + /* Otherwise build a regular assignment. */ else gnu_result From patchwork Tue Jan 7 12:53:47 2025 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: 104252 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 934D138515C8 for ; Tue, 7 Jan 2025 13:15:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 934D138515C8 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=hWrHfyr/ X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by sourceware.org (Postfix) with ESMTPS id 19F6D385608E for ; Tue, 7 Jan 2025 12:54:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 19F6D385608E 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 19F6D385608E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254471; cv=none; b=KTDPMY7rbiAtTw6ODsy7gdfvpUA1LavZUrBnmVNH4g7OeetwcdnSktqeLWS5zhCG3VBXAJOmgw/RYUjb52JeegAuH1GaWnb6n4SWyXqnEvA5AkGNHkA11R5SJp6oeJsdEj3EUbGfQ7BpzBXqvQwUQxOyCTiJuIzBo4aWKwts08M= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254471; c=relaxed/simple; bh=Q5TToDd4LU8zNfQq7qe4XN8FjtdpBjspHpSKZusaMPw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=xOIAOO13IGvlX5aemuzasu2plJ46KM2LQrKQTY2TYpT743hTckfcBpidPwu+XsmVAhekx5MhpvhzQQTLbCCOzUSOaA0enMVAYB6gLIXMCDh3F+7L9c0kvtG/Lg6ojHpjgJYr3nbyBjAwzHTLet0UoAa0bHnfYjhJNppQKwBB2KU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 19F6D385608E Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-4361fe642ddso161722935e9.2 for ; Tue, 07 Jan 2025 04:54:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1736254470; x=1736859270; 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=gWmzEBdwbzj82Zy86KO+PET7VSnX/se6cxn8K9FeFNE=; b=hWrHfyr/qZV3ys8wnyRLBnfiE0fOcz9bdrm6T1WNBsvm+e+L2JZoNTxHdNCHz69URr hKvy6kSJ3zFwYMWMphAAf29TSJMULR1AxSHfiVhyZXFNTSy+CCWMelrcDJOUlm2iPgnS rm4l8rF709+YB175nuaDQPZQu3/9VBkryPXeLYZwyN2ZSxslr47pdM6YWtuhfwCQaTZX JqcH6+Gq+rQShHD0MuigcHqRaxZFKKbo4LtOIJ8khi82bYNh47k1ETpMUPGevvuxeWcW rNB6XOiAlnhi+4qtvYqkh+vM096qplYg8fzL8Wr3w6YUp8EOPm4svZ4P4AA+v0UMMDdz IuzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736254470; x=1736859270; 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=gWmzEBdwbzj82Zy86KO+PET7VSnX/se6cxn8K9FeFNE=; b=daiAI36kiSijawIDhxtIz7B2xHmA0cnfBjRejpfHpQoLPuXYJq5echm0HPYgg6AIAj 4mvuKELNM7moyjSO8DM83JkUNETlhW0KlIDNE/PIGFYW+V4j9vg5ib52g1Tr1mKAgXud ESFsD46enfnl04guk5OxkdNP8xW3qUnXrdD8j8KS+Cf9Ir8Uxc7V5NfscKlsOyBxtmHg P1TrXau4qp2yHuT7LQnBKUMl4K9osl0Z95j1nxMraVSe6yqEkyEcULOsUl1R4G7abC6c zH82voGI1Pkj5jTWrXe7F9p139kUvkXNgaGr7gB6HoVfpFKkBJgjUVZ8b7X6fOwhmCvZ h6pA== X-Gm-Message-State: AOJu0YxHeUwFTJrkg+uqSYPkmb5vNzREkbXlcSfuAHnT4QIeK3AXyNU3 uaYtuCEnVxDb+DPdd78E/mT7EbQZNZW6XXaZtCh9HNhFPm6N58n6wxwEp36nORRnw+BuwVuBF88 = X-Gm-Gg: ASbGnctgVJ+8OdheRcf4LAB9m15ikcFUEecGHNhC5zfPJD0yoCSkvsxmnTWbOGmR08S hDrGnE5VEiTbjWXDMKJ4Vcuu9nmKgW2cU5CZA/Rw3E0Eo0ORa1Al+0x+2BOhp6tg369waK0hQV7 DOdDE0Pmu7mFh9uVDelzIBuiCwMcBpFFX6UumEHXtZL466PAf2r0QFs0ie7VUDS3VDnLEsoG+80 kYM5gZQUSeJ+2S7UsNIPhbwmByrVtrcMqdJQfnA7RklGeuXfE+g8OFwlp3KI+eVOnYXlej6qu3s YVYjHz9V3TzJD9/TEUTvFm5Z5ya1+rNvHdP1MNcDKzr9hnGzXquh2tkHjryAkPDpmU+fzPfI X-Google-Smtp-Source: AGHT+IHeNKhjLRrHToxDkm/PNmvCyCQpwoi9LmHIT3PcSvkQooFmEx5sYH5srpS0nRJrD5fdyAJu2Q== X-Received: by 2002:a5d:588b:0:b0:385:de8d:c0f5 with SMTP id ffacd0b85a97d-38a221eabecmr59384966f8f.16.1736254469809; Tue, 07 Jan 2025 04:54:29 -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 5b1f17b1804b1-43656af6c42sm631014805e9.9.2025.01.07.04.54.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 04:54:29 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Alexandre Oliva Subject: [COMMITTED 29/31] ada: Drop g-cpp* units not needed by the compiler Date: Tue, 7 Jan 2025 13:53:47 +0100 Message-ID: <20250107125350.619654-29-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250107125350.619654-1-poulhies@adacore.com> References: <20250107125350.619654-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 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~patchwork=sourceware.org@gcc.gnu.org From: Alexandre Oliva Having moved __gnat_convert_caught_object to g-cstyin.o, we can drop other g-cpp* units that are now needed by programs that actually use their APIs to get more information about C++ exceptions and type_info objects. gcc/ada/ChangeLog: * gcc-interface/Make-lang.in (GNAT_ADA_OBJS, GNATBIND_OBJS): Drop g-cpp, g-cppexc and g-cppstd. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/Make-lang.in | 6 ------ 1 file changed, 6 deletions(-) diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in index b0c568ad60b..1fefd6aa31f 100644 --- a/gcc/ada/gcc-interface/Make-lang.in +++ b/gcc/ada/gcc-interface/Make-lang.in @@ -513,9 +513,6 @@ GNAT_ADA_OBJS+= \ ada/libgnat/a-numeri.o \ ada/libgnat/ada.o \ ada/libgnat/g-byorma.o \ - ada/libgnat/g-cpp.o \ - ada/libgnat/g-cppexc.o \ - ada/libgnat/g-cppstd.o \ ada/libgnat/g-cstyin.o \ ada/libgnat/g-heasor.o \ ada/libgnat/g-htable.o \ @@ -697,9 +694,6 @@ GNATBIND_OBJS += \ ada/libgnat/a-numeri.o \ ada/libgnat/ada.o \ ada/libgnat/g-byorma.o \ - ada/libgnat/g-cpp.o \ - ada/libgnat/g-cppexc.o \ - ada/libgnat/g-cppstd.o \ ada/libgnat/g-cstyin.o \ ada/libgnat/g-hesora.o \ ada/libgnat/g-htable.o \ From patchwork Tue Jan 7 12:53:48 2025 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: 104270 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 93FAC3858C41 for ; Tue, 7 Jan 2025 13:45:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 93FAC3858C41 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=L2Sl81y4 X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by sourceware.org (Postfix) with ESMTPS id B3861385608A for ; Tue, 7 Jan 2025 12:54:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B3861385608A 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 B3861385608A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::336 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254472; cv=none; b=Sq8e6Og9n5dcmx/7Edus82obE+bMgEdvmMN02wG1laYEIBgmWGOlDAiO3DHDgwCaIIb6aSS5A9/J2FYxxSf+tqhP+tk/31XkSOoqFOetvfRmr+dncWsZtImqWHwYM+21BXlom/2xp0HSz5uzY8XyygLZLtCPwWzK4RWm9GQ3C/Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736254472; c=relaxed/simple; bh=ojRFc9cwaSnjMdXXkJ/9WRrNo2GtHYQKvQLW3tvf8P8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Nm+BZe2UhsddEgmDXUSzoTC+aj6vwps5jSNg6+2QFeMTmbVEQYhtFQvbQ0d6sDywE9ni00FB8WOgyuNzDwGB64gC7kwuU36eu1C5V4DSVBWv5b293vFIaM6jlLOWskQFRPcr1VM50+7pXS94RX95fT8B5Oc8Q/iL+AwAPrT0DGg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B3861385608A Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4361dc6322fso103279565e9.3 for ; Tue, 07 Jan 2025 04:54:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1736254470; x=1736859270; 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=abI229yiYahyEL/L0bPU2j+Qph9wKOFIywDlVPB9+b4=; b=L2Sl81y4zQkcx1iYDF/Aj+mfED1EzplfshAKe1C0UqPPO8QZ1mqSu+7Utb+qL8nBmU ckMI18FwT4Fgdx5m5aLItR1RBYEadWQEzCxcy1t4sPdnIb9W/GIMF2OSRVSZ6Y4Nom/8 8XLn3APG3HjQ4o0fXZVJj/HnX5+K//8M67xvl6N+kG1d2vN+PQ+Vb3TGOBtv2Ae+uqAs scUM8cBJbu9uoF6d34XAb9P4M5qV9iFaxrlHmi/onyX/6q2vmKIxvGGBWv3zOYQoT4GB YbjjgF6DFn9Syyp54EV76Wg8QpraiysAHOJDP+CrL158vYR80LOHNGcEeiVFlLMloUFf NpYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736254470; x=1736859270; 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=abI229yiYahyEL/L0bPU2j+Qph9wKOFIywDlVPB9+b4=; b=sS7w+v1cCrC02kp+HblOZTgVp1iHUBU4n21xXyOCWTAYtQT8bB5UkSeHSe3ld4Mkao LxdXJHivDGafNC7rcN/1h25k+1vx5aQU1ywSxrjmc9cSeFQDF1JmcIMfZ+NdKKghbSGs o3MZqERp1mU7sWCC7y9mSCfH5VKDSXdGWGNIYvZigNK/kUwaf+fIOjcvIBz7vTZDMG/M BE7J2q1pwQau/vtLHt2X8IHfRFEF5MC8Um9REEziHG6pizZfzJym7apDdtnfLxw/tHrj nHAafJ2AfKWHRRJiGHKnJm8t3xpMJfZj8/1305IdAlPwgtWTVSDEJ4JosVzZ9HwjWYcm /HXQ== X-Gm-Message-State: AOJu0YwjgbhxLvph2mrz9HqDZwChZTG4vKTuWx+o3ZnIVylbznKYsjQz RAsbiSw+zzj3CuF/oonUetOty/VGgFOD4pkuMLnzgUdruuiXBhBamVfxIcJKiEXYd7t5oUUDu6I = X-Gm-Gg: ASbGncsF/fNeZec70stDQAQ1y3dTlFwhTOGowWGX+JiObbHldyEbb6qg+zY6kPM3MgH NaMnb/ufWjgTX7v/Je/bxDGSzXCcn7lP1YOTKc2sl6OvvdwmHwH80+mbpdqzT5LE03EP+0vmS2n uTY6HOlIXWNHZWugxI18dU0B80RBAxg7MZKdBhWhZ09HtmfkbS9uMjuwaEXvDpMH+l2UmqfBG3p nIdvJJQyAQ2IWZXJ3JWkOmx5Dqlir6Z9LMIa22ZUdvMx9ZDCtzUzYyMwKMEpy9+OD3LXK0DERG+ /pgdSUN4fgM3leKoywQu33r4O8LOuWLKrzMgtZgFi7bW5uYWv5MGQDsZ6vkEqAcGxjV/hLIu X-Google-Smtp-Source: AGHT+IGgmySPvfz+bGFHETGCBARJWscmpFK7yqv5I609WqEwaq4Dw1JmUGM7fJsObGgOlO5aZ5Qr2A== X-Received: by 2002:a05:600c:4ecc:b0:434:a802:e9b2 with SMTP id 5b1f17b1804b1-4366854887cmr523748455e9.4.1736254470440; Tue, 07 Jan 2025 04:54:30 -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 5b1f17b1804b1-43656af6c42sm631014805e9.9.2025.01.07.04.54.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 04:54:30 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: =?utf-8?q?Marc_Poulhi=C3=A8s?= Subject: [COMMITTED 30/31] ada: Adjust pragma obsolescent message Date: Tue, 7 Jan 2025 13:53:48 +0100 Message-ID: <20250107125350.619654-30-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250107125350.619654-1-poulhies@adacore.com> References: <20250107125350.619654-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 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~patchwork=sourceware.org@gcc.gnu.org Do not mention an explicit version. gcc/ada/ChangeLog: * libgnat/a-calcon.ads: Adjust. * libgnat/a-calend.ads: Adjust. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/libgnat/a-calcon.ads | 16 ++++++++++++---- gcc/ada/libgnat/a-calend.ads | 14 ++++++++++---- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/gcc/ada/libgnat/a-calcon.ads b/gcc/ada/libgnat/a-calcon.ads index a7be1f7f3fd..a94d5c63dff 100644 --- a/gcc/ada/libgnat/a-calcon.ads +++ b/gcc/ada/libgnat/a-calcon.ads @@ -37,7 +37,8 @@ with Interfaces.C; package Ada.Calendar.Conversions is function To_Ada_Time (Unix_Time : Interfaces.C.long) return Time; - pragma Obsolescent (To_Ada_Time, "Retires in v26"); + pragma Obsolescent + (To_Ada_Time, "This function may be removed in a future version"); -- Old version which will overflow at the 2038 Epochalypse function To_Ada_Time_64 (Unix_Time : Interfaces.C.long_long) return Time; @@ -74,7 +75,9 @@ package Ada.Calendar.Conversions is function To_Duration (tv_sec : Interfaces.C.long; tv_nsec : Interfaces.C.long) return Duration; - pragma Obsolescent (To_Duration, "Retires in v26"); + pragma + Obsolescent + (To_Duration, "This function may be removed in a future version"); -- Old version which will overflow at the 2038 Epochalypse function To_Duration_64 @@ -90,7 +93,10 @@ package Ada.Calendar.Conversions is (D : Duration; tv_sec : out Interfaces.C.long; tv_nsec : out Interfaces.C.long); - pragma Obsolescent (To_Struct_Timespec, "Retires in v26"); + pragma + Obsolescent + (To_Struct_Timespec, + "This function may be removed in a future version"); -- Old version which will overflow at the 2038 Epochalypse procedure To_Struct_Timespec_64 @@ -122,7 +128,9 @@ package Ada.Calendar.Conversions is -- The input date is considered to be in UTC function To_Unix_Time (Ada_Time : Time) return Interfaces.C.long; - pragma Obsolescent (To_Unix_Time, "Retires in v26"); + pragma + Obsolescent + (To_Unix_Time, "This function may be removed in a future version"); -- Old version which will overflow at the 2038 Epochalypse function To_Unix_Time_64 (Ada_Time : Time) return Interfaces.C.long_long; diff --git a/gcc/ada/libgnat/a-calend.ads b/gcc/ada/libgnat/a-calend.ads index 64907455896..032fad8294f 100644 --- a/gcc/ada/libgnat/a-calend.ads +++ b/gcc/ada/libgnat/a-calend.ads @@ -291,7 +291,8 @@ private package Conversion_Operations is function To_Ada_Time (Unix_Time : Long_Integer) return Time; - pragma Obsolescent (To_Ada_Time, "Retires in v26"); + pragma Obsolescent + (To_Ada_Time, "This function may be removed in a future version"); -- Old Unix to Ada Epoch conversion function To_Ada_Time_64 (Unix_Time : Long_Long_Integer) return Time; @@ -310,7 +311,8 @@ private function To_Duration (tv_sec : Long_Integer; tv_nsec : Long_Integer) return Duration; - pragma Obsolescent (To_Duration, "Retires in v26"); + pragma Obsolescent + (To_Duration, "This function may be removed in a future version"); -- Old Struct timespec to Duration conversion function To_Duration_64 @@ -322,7 +324,10 @@ private (D : Duration; tv_sec : out Long_Integer; tv_nsec : out Long_Integer); - pragma Obsolescent (To_Struct_Timespec, "Retires in v26"); + pragma + Obsolescent + (To_Struct_Timespec, + "This function may be removed in a future version"); -- Old Duration to struct timespec conversion procedure To_Struct_Timespec_64 @@ -342,7 +347,8 @@ private -- Time to struct tm conversion function To_Unix_Time (Ada_Time : Time) return Long_Integer; - pragma Obsolescent (To_Unix_Time, "Retires in v26"); + pragma Obsolescent + (To_Unix_Time, "This function may be removed in a future version"); -- Old Ada to Unix Epoch conversion function To_Unix_Time_64 (Ada_Time : Time) return Long_Long_Integer;