From patchwork Thu Aug 29 13:07:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 1978423 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=jKfJK9XR; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WvhRs6qcPz1yfy for ; Thu, 29 Aug 2024 23:08:41 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9D21A3860750 for ; Thu, 29 Aug 2024 13:08:39 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id A2D2F385F01D for ; Thu, 29 Aug 2024 13:08:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A2D2F385F01D 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 A2D2F385F01D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::42c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724936889; cv=none; b=Uq2cYwiyK6yJJuogjrHF5akG+uP9tk7n4X+ethwhiT4TnC5r3KrGByOlANwpo3FbkKImUMv/ET3p7RFZoOqfiYS4E5aNT50YY4fGB38FP91gPsi44UFqYntuVGiVuGLEwFB2srjNaSntyJlpPc0YakSz/gZ4svLukDJA0OYWzGo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724936889; c=relaxed/simple; bh=miiYkLtpu4vRP144yQ8T0ZDfylTHa/VB7wR4rEYZoN4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=W9ZC0GlF4nTzezoMsifJrXj49Cpp+31VaxWY18lW3ngzNRLfk73NyM+jD6BPFZRTGLC6icGWfTMO9EA0QjFmdMaHJ5xlVkVrh89eU8rAv9VovHQPqlEZOT9mDEVetf6Atcg/KolYzFdlObCz9zFWY7FZ5FSsKNKPlHu22o7mDt8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-3719398eafcso421611f8f.1 for ; Thu, 29 Aug 2024 06:08:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1724936884; x=1725541684; 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=x7iq1hRg2DoL1VFjYEqUDqcM3I+PcxkRRU80DKEviUI=; b=jKfJK9XRbpBoP0z1TWMFQKTRdn2QylksVpZNQBdlJhpiFIamy0T89rktfCJ8i6fPno OyVzmi6NnSFIS3LjvQjtW23EimLC7NUYNYGvndJyiniYCT/jm3NN9QAWltMMPzAVW4Bm r+vlIDb+YbwM1hL3vH6RD+QJar8xFdtlNJdajVmvjYjqtKRZz3Pfw0UkO8NcDdt35v9m rbwyvx5bW02DWvVMKBqa7epLphxbgvz9Lqk0iTgrvcdFrJPuCBIUQMlKa0J1+eXxaOgw N3XvBZQmsjFuWZYRbtg51NgENxLJgRbRf0KcsHdrsPFIadrc63Wq0Ef3caQClJbwl8iX 5fDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724936884; x=1725541684; 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=x7iq1hRg2DoL1VFjYEqUDqcM3I+PcxkRRU80DKEviUI=; b=b+08fHUkLO9fVK3ZYHTDl3ImkLLKEt35KBL1LkpxhJDCgyfw7EXUIdqD/byFfxnJoD 1D9eiGgA21uwSX58aMqaLBAFozsYzmPnvAB3W1QVhE/t9piugCb7p+/oykfUvybBy6BM cyWTFRLCEH8Zfd7/NfXlcwxh0aF5quzKi13lscoCI8FSNmyTMCfFl/FBY4syteiqQegn frmWLInvLb48NgeL/pS+dcWslQqTPNT9x7OelNhemEY9SPILsY9V7qS9hTizyOt2JkHC KyGR/kvNnVm7q6XltfcWMLLbph0NeVL0Qnaj63XXZ5wU17/jaaOzbos3Z9K7CJXUZovQ 672Q== X-Gm-Message-State: AOJu0YzzNnT40HB9CtcPi/Y9aDNjyLnwtY0onZolJsOWFEsNHzlNb91n z+lbS9Cr7IfgSrsdq6uE8bTJxtPKkLFhgmw5/n4aqA3s+r8tts+Yxr25xKnqkHqEdTzsyLdbKdc = X-Google-Smtp-Source: AGHT+IHuptAQfCw2ArZfP2escmPpdtMcnSOcRy9hBT84tgrsOabXwemyaCNVcmA6PDuPAeq3ZYkeNQ== X-Received: by 2002:adf:f008:0:b0:371:a844:d331 with SMTP id ffacd0b85a97d-3749b594fcbmr2047713f8f.62.1724936883571; Thu, 29 Aug 2024 06:08:03 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:5e2c:51b0:ac4a:92ca]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bb6deb2f5sm17074605e9.2.2024.08.29.06.08.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 06:08:02 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Justin Squirek Subject: [COMMITTED 01/17] ada: Update documentation for conditional when constructs Date: Thu, 29 Aug 2024 15:07:31 +0200 Message-ID: <20240829130750.1651060-1-poulhies@adacore.com> X-Mailer: git-send-email 2.45.2 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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org From: Justin Squirek This patch moves the documentation for conditional when constructs out of the curated set (e.g. into -gnatX0). gcc/ada/ * doc/gnat_rm/gnat_language_extensions.rst: Move conditional when constructs out of the curated set. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate. Tested on x86_64-pc-linux-gnu, committed on master. --- .../doc/gnat_rm/gnat_language_extensions.rst | 141 ++++++++------- gcc/ada/gnat_rm.texi | 170 +++++++++--------- gcc/ada/gnat_ugn.texi | 4 +- 3 files changed, 157 insertions(+), 158 deletions(-) diff --git a/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst b/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst index 32f00c0c7a5..af10289b8b1 100644 --- a/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst +++ b/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst @@ -68,77 +68,6 @@ For example: Link to the original RFC: https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-local-vars-without-block.md -Conditional when constructs ---------------------------- - -This feature extends the use of ``when`` as a way to condition a control-flow -related statement, to all control-flow related statements. - -To do a conditional return in a procedure the following syntax should be used: - -.. code-block:: ada - - procedure P (Condition : Boolean) is - begin - return when Condition; - end; - -This will return from the procedure if ``Condition`` is true. - -When being used in a function the conditional part comes after the return value: - -.. code-block:: ada - - function Is_Null (I : Integer) return Boolean is - begin - return True when I = 0; - return False; - end; - -In a similar way to the ``exit when`` a ``goto ... when`` can be employed: - -.. code-block:: ada - - procedure Low_Level_Optimized is - Flags : Bitmapping; - begin - Do_1 (Flags); - goto Cleanup when Flags (1); - - Do_2 (Flags); - goto Cleanup when Flags (32); - - -- ... - - <> - -- ... - end; - -.. code-block - -To use a conditional raise construct: - -.. code-block:: ada - - procedure Foo is - begin - raise Error when Imported_C_Func /= 0; - end; - -An exception message can also be added: - -.. code-block:: ada - - procedure Foo is - begin - raise Error with "Unix Error" - when Imported_C_Func /= 0; - end; - - -Link to the original RFC: -https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-conditional-when-constructs.rst - Fixed lower bounds for array types and subtypes ----------------------------------------------- @@ -345,6 +274,76 @@ particular the ``Shift_Left`` and ``Shift_Right`` intrinsics. Experimental Language Extensions ================================ +Conditional when constructs +--------------------------- + +This feature extends the use of ``when`` as a way to condition a control-flow +related statement, to all control-flow related statements. + +To do a conditional return in a procedure the following syntax should be used: + +.. code-block:: ada + + procedure P (Condition : Boolean) is + begin + return when Condition; + end; + +This will return from the procedure if ``Condition`` is true. + +When being used in a function the conditional part comes after the return value: + +.. code-block:: ada + + function Is_Null (I : Integer) return Boolean is + begin + return True when I = 0; + return False; + end; + +In a similar way to the ``exit when`` a ``goto ... when`` can be employed: + +.. code-block:: ada + + procedure Low_Level_Optimized is + Flags : Bitmapping; + begin + Do_1 (Flags); + goto Cleanup when Flags (1); + + Do_2 (Flags); + goto Cleanup when Flags (32); + + -- ... + + <> + -- ... + end; + +.. code-block + +To use a conditional raise construct: + +.. code-block:: ada + + procedure Foo is + begin + raise Error when Imported_C_Func /= 0; + end; + +An exception message can also be added: + +.. code-block:: ada + + procedure Foo is + begin + raise Error with "Unix Error" + when Imported_C_Func /= 0; + end; + +Link to the original RFC: +https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-conditional-when-constructs.rst + Storage Model ------------- diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index 3a766ccc38d..a2c14e203c3 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -19,7 +19,7 @@ @copying @quotation -GNAT Reference Manual , Jul 29, 2024 +GNAT Reference Manual , Aug 26, 2024 AdaCore @@ -895,7 +895,6 @@ GNAT language extensions Curated Extensions * Local Declarations Without Block:: -* Conditional when constructs:: * Fixed lower bounds for array types and subtypes:: * Prefixed-view notation for calls to primitive subprograms of untagged types:: * Expression defaults for generic formal functions:: @@ -905,6 +904,7 @@ Curated Extensions Experimental Language Extensions +* Conditional when constructs:: * Storage Model:: * Attribute Super:: * Simpler accessibility model:: @@ -28939,7 +28939,6 @@ for use in playground experiments. @menu * Local Declarations Without Block:: -* Conditional when constructs:: * Fixed lower bounds for array types and subtypes:: * Prefixed-view notation for calls to primitive subprograms of untagged types:: * Expression defaults for generic formal functions:: @@ -28949,7 +28948,7 @@ for use in playground experiments. @end menu -@node Local Declarations Without Block,Conditional when constructs,,Curated Extensions +@node Local Declarations Without Block,Fixed lower bounds for array types and subtypes,,Curated Extensions @anchor{gnat_rm/gnat_language_extensions local-declarations-without-block}@anchor{445} @subsection Local Declarations Without Block @@ -28973,80 +28972,8 @@ end if; Link to the original RFC: @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-local-vars-without-block.md} -@node Conditional when constructs,Fixed lower bounds for array types and subtypes,Local Declarations Without Block,Curated Extensions -@anchor{gnat_rm/gnat_language_extensions conditional-when-constructs}@anchor{446} -@subsection Conditional when constructs - - -This feature extends the use of @code{when} as a way to condition a control-flow -related statement, to all control-flow related statements. - -To do a conditional return in a procedure the following syntax should be used: - -@example -procedure P (Condition : Boolean) is -begin - return when Condition; -end; -@end example - -This will return from the procedure if @code{Condition} is true. - -When being used in a function the conditional part comes after the return value: - -@example -function Is_Null (I : Integer) return Boolean is -begin - return True when I = 0; - return False; -end; -@end example - -In a similar way to the @code{exit when} a @code{goto ... when} can be employed: - -@example -procedure Low_Level_Optimized is - Flags : Bitmapping; -begin - Do_1 (Flags); - goto Cleanup when Flags (1); - - Do_2 (Flags); - goto Cleanup when Flags (32); - - -- ... - -<> - -- ... -end; -@end example - -@c code-block - -To use a conditional raise construct: - -@example -procedure Foo is -begin - raise Error when Imported_C_Func /= 0; -end; -@end example - -An exception message can also be added: - -@example -procedure Foo is -begin - raise Error with "Unix Error" - when Imported_C_Func /= 0; -end; -@end example - -Link to the original RFC: -@indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-conditional-when-constructs.rst} - -@node Fixed lower bounds for array types and subtypes,Prefixed-view notation for calls to primitive subprograms of untagged types,Conditional when constructs,Curated Extensions -@anchor{gnat_rm/gnat_language_extensions fixed-lower-bounds-for-array-types-and-subtypes}@anchor{447} +@node Fixed lower bounds for array types and subtypes,Prefixed-view notation for calls to primitive subprograms of untagged types,Local Declarations Without Block,Curated Extensions +@anchor{gnat_rm/gnat_language_extensions fixed-lower-bounds-for-array-types-and-subtypes}@anchor{446} @subsection Fixed lower bounds for array types and subtypes @@ -29100,7 +29027,7 @@ Link to the original RFC: @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-fixed-lower-bound.rst} @node Prefixed-view notation for calls to primitive subprograms of untagged types,Expression defaults for generic formal functions,Fixed lower bounds for array types and subtypes,Curated Extensions -@anchor{gnat_rm/gnat_language_extensions prefixed-view-notation-for-calls-to-primitive-subprograms-of-untagged-types}@anchor{448} +@anchor{gnat_rm/gnat_language_extensions prefixed-view-notation-for-calls-to-primitive-subprograms-of-untagged-types}@anchor{447} @subsection Prefixed-view notation for calls to primitive subprograms of untagged types @@ -29153,7 +29080,7 @@ Link to the original RFC: @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-prefixed-untagged.rst} @node Expression defaults for generic formal functions,String interpolation,Prefixed-view notation for calls to primitive subprograms of untagged types,Curated Extensions -@anchor{gnat_rm/gnat_language_extensions expression-defaults-for-generic-formal-functions}@anchor{449} +@anchor{gnat_rm/gnat_language_extensions expression-defaults-for-generic-formal-functions}@anchor{448} @subsection Expression defaults for generic formal functions @@ -29182,7 +29109,7 @@ Link to the original RFC: @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-expression-functions-as-default-for-generic-formal-function-parameters.rst} @node String interpolation,Constrained attribute for generic objects,Expression defaults for generic formal functions,Curated Extensions -@anchor{gnat_rm/gnat_language_extensions string-interpolation}@anchor{44a} +@anchor{gnat_rm/gnat_language_extensions string-interpolation}@anchor{449} @subsection String interpolation @@ -29336,7 +29263,7 @@ Link to the original RFC: @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-string-interpolation.md} @node Constrained attribute for generic objects,Static aspect on intrinsic functions,String interpolation,Curated Extensions -@anchor{gnat_rm/gnat_language_extensions constrained-attribute-for-generic-objects}@anchor{44b} +@anchor{gnat_rm/gnat_language_extensions constrained-attribute-for-generic-objects}@anchor{44a} @subsection Constrained attribute for generic objects @@ -29344,7 +29271,7 @@ The @code{Constrained} attribute is permitted for objects of generic types. The result indicates whether the corresponding actual is constrained. @node Static aspect on intrinsic functions,,Constrained attribute for generic objects,Curated Extensions -@anchor{gnat_rm/gnat_language_extensions static-aspect-on-intrinsic-functions}@anchor{44c} +@anchor{gnat_rm/gnat_language_extensions static-aspect-on-intrinsic-functions}@anchor{44b} @subsection @code{Static} aspect on intrinsic functions @@ -29353,11 +29280,12 @@ and the compiler will evaluate some of these intrinsics statically, in particular the @code{Shift_Left} and @code{Shift_Right} intrinsics. @node Experimental Language Extensions,,Curated Extensions,GNAT language extensions -@anchor{gnat_rm/gnat_language_extensions experimental-language-extensions}@anchor{6a}@anchor{gnat_rm/gnat_language_extensions id2}@anchor{44d} +@anchor{gnat_rm/gnat_language_extensions experimental-language-extensions}@anchor{6a}@anchor{gnat_rm/gnat_language_extensions id2}@anchor{44c} @section Experimental Language Extensions @menu +* Conditional when constructs:: * Storage Model:: * Attribute Super:: * Simpler accessibility model:: @@ -29367,7 +29295,79 @@ particular the @code{Shift_Left} and @code{Shift_Right} intrinsics. @end menu -@node Storage Model,Attribute Super,,Experimental Language Extensions +@node Conditional when constructs,Storage Model,,Experimental Language Extensions +@anchor{gnat_rm/gnat_language_extensions conditional-when-constructs}@anchor{44d} +@subsection Conditional when constructs + + +This feature extends the use of @code{when} as a way to condition a control-flow +related statement, to all control-flow related statements. + +To do a conditional return in a procedure the following syntax should be used: + +@example +procedure P (Condition : Boolean) is +begin + return when Condition; +end; +@end example + +This will return from the procedure if @code{Condition} is true. + +When being used in a function the conditional part comes after the return value: + +@example +function Is_Null (I : Integer) return Boolean is +begin + return True when I = 0; + return False; +end; +@end example + +In a similar way to the @code{exit when} a @code{goto ... when} can be employed: + +@example +procedure Low_Level_Optimized is + Flags : Bitmapping; +begin + Do_1 (Flags); + goto Cleanup when Flags (1); + + Do_2 (Flags); + goto Cleanup when Flags (32); + + -- ... + +<> + -- ... +end; +@end example + +@c code-block + +To use a conditional raise construct: + +@example +procedure Foo is +begin + raise Error when Imported_C_Func /= 0; +end; +@end example + +An exception message can also be added: + +@example +procedure Foo is +begin + raise Error with "Unix Error" + when Imported_C_Func /= 0; +end; +@end example + +Link to the original RFC: +@indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-conditional-when-constructs.rst} + +@node Storage Model,Attribute Super,Conditional when constructs,Experimental Language Extensions @anchor{gnat_rm/gnat_language_extensions storage-model}@anchor{44e} @subsection Storage Model diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index dcde9ea705b..27c705e3bbd 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -19,7 +19,7 @@ @copying @quotation -GNAT User's Guide for Native Platforms , Aug 19, 2024 +GNAT User's Guide for Native Platforms , Aug 26, 2024 AdaCore @@ -29695,8 +29695,8 @@ to permit their use in free software. @printindex ge -@anchor{d1}@w{ } @anchor{gnat_ugn/gnat_utility_programs switches-related-to-project-files}@w{ } +@anchor{d1}@w{ } @c %**end of body @bye From patchwork Thu Aug 29 13:07:32 2024 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: 1978428 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=NJnpPYpr; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WvhVB5rYLz1yfn for ; Thu, 29 Aug 2024 23:10:42 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F4099385020B for ; Thu, 29 Aug 2024 13:10:40 +0000 (GMT) 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 7F1993861009 for ; Thu, 29 Aug 2024 13:08:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7F1993861009 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 7F1993861009 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=1724936892; cv=none; b=edysS8arAatgf8n6O0CPvNBLI6/mp5byjgvKVM7pR8UfTDiwYhSbZiBofNUpD7rd51eT16nE+SW2boa+tMylkNUK8h0n37bTWmQS6s+vkQ131aKi5KL+TlOvOwr8DNmRiLBFRE++LTuEz0DGH/oE7yQsRxSPXSBH7hcGmcHJl/Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724936892; c=relaxed/simple; bh=WZ76ntfiuYnO3E/+BoZ3xbaZfbT643pHPW32ipqmOzc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=vhQz8th067doAvgSGzUgsVtbaDg2hTl00IHQtZPYwtSkP/I/5c3iSshn1CyuWsgADpNN0Wx6kKz7Ev99vocQf2x8Vn1qBMVwR0+PFhrhuql/gQLpZXfgwrZjKewLinh9//1rNiJOo+t/du5C8TB3uYB+3hJvouv1uIxpU5662zg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-371aa511609so411833f8f.1 for ; Thu, 29 Aug 2024 06:08:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1724936885; x=1725541685; 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=jZ0F2EKm/wFeZNZ4Z6olACXaCHMiOFTSu2QivNEkGnA=; b=NJnpPYprl1Ke0DKSWM59PKf2Aj/6RArcI4/OBcOT3tVTydM8UxiCdLKAWJk9RugeYK ZzZbRuj7aSiAIC7ZlzNTkZLhlGtcAg58bk4I/JXfDzxcq9ASgd6GJy92HSIWS226XeIA 82cd4ayfXmfynp20iD8wYpkpsBz2G6uM3b+6aV4jzhbSYNcVfsgWkMtggGkqCrS9Oo6S iBn71/bn11yYqwb7MA9ocXW1U0wjPMmB6uqxH4x/7zdnMB1V3rMUGz9dIcxg6XWB+eKz pVwjhjcJdcBWkHnyPp3w9SdOzm0EsgDghb4yDyct1Ed6xgKjPHG0DEdQq4/rfym2xfMW +m/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724936885; x=1725541685; 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=jZ0F2EKm/wFeZNZ4Z6olACXaCHMiOFTSu2QivNEkGnA=; b=wZKZ3V96vC9pEIzLtc2lOce71bbhdyaEQ4q8uzMNHInJ1AfuD5gKppFC8NCRewkQ+b PYGp4AUuVZoOyc8WqlmeWtUx9rDr7AOVHHRTMMEyYIIVw17X+iUHVDx4Dr3nW1Sy6aUk qLMOLm5DgWDGMOKWPw5KK+yqZfwK6HHAjxUhjUxMNfhExLamXNpFQ2Tj6x3qpRLuhGfM qsjhDF31+0/SB9FasA06OS7yuxMnBRaVc9cnG7wLReoCRy4Bm/5oxgiOEgYMM9PUEfiB YwuwzG5p2hRNqguu5lx8D0pVXhto1A3uZ4tQO0A0x6AgOtCsb5KJvszY6gGiAl9oswil Mrqg== X-Gm-Message-State: AOJu0YxYO8osSi23vMeU5LV/Ev0KCzDwx9TGd8YWqGX9vKbUh22uSxxD aEi4tQbcU0cNls5bQ1MiK6sxO/UhiMtkp12u8iR2jXtMaKhIDgadXWFICclUtLWlo2bonZuAd2w = X-Google-Smtp-Source: AGHT+IG1OTJ3hVIIRSMkepepFQDVuHa2KaFS7/h7blveReGVR66qM1seyPvaThCkdzTVL391L5kT1A== X-Received: by 2002:adf:f0cb:0:b0:368:4e4f:cec5 with SMTP id ffacd0b85a97d-3749b5520c5mr1844289f8f.35.1724936884478; Thu, 29 Aug 2024 06:08:04 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:5e2c:51b0:ac4a:92ca]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bb6deb2f5sm17074605e9.2.2024.08.29.06.08.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 06:08:03 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Javier Miranda Subject: [COMMITTED 02/17] ada: First controlling parameter aspect Date: Thu, 29 Aug 2024 15:07:32 +0200 Message-ID: <20240829130750.1651060-2-poulhies@adacore.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829130750.1651060-1-poulhies@adacore.com> References: <20240829130750.1651060-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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org From: Javier Miranda gcc/ada/ * usage.adb (Usage): Document switch -gnatw_j * doc/gnat_rm/gnat_language_extensions.rst: Add documentation. * gnat_rm.texi: Regenerate. Tested on x86_64-pc-linux-gnu, committed on master. --- .../doc/gnat_rm/gnat_language_extensions.rst | 82 +++++++++ gcc/ada/gnat_rm.texi | 166 +++++++++++++----- gcc/ada/usage.adb | 3 + 3 files changed, 211 insertions(+), 40 deletions(-) diff --git a/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst b/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst index af10289b8b1..27be5e0c3d5 100644 --- a/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst +++ b/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst @@ -269,6 +269,88 @@ The Ada 202x ``Static`` aspect can be specified on Intrinsic imported functions and the compiler will evaluate some of these intrinsics statically, in particular the ``Shift_Left`` and ``Shift_Right`` intrinsics. +First Controlling Parameter +--------------------------- + +A new pragma/aspect, ``First_Controlling_Parameter``, is introduced for tagged +types, altering the semantics of primitive/controlling parameters. When a +tagged type is marked with this aspect, only subprograms where the first +parameter is of that type will be considered dispatching primitives. This +pragma/aspect applies to the entire hierarchy, starting from the specified +type, without affecting inherited primitives. + +Here is an example of this feature: + +.. code-block:: ada + + package Example is + type Root is tagged private; + + procedure P (V : Integer; V2 : Root); + -- Primitive + + type Child is tagged private + with First_Controlling_Parameter; + + private + type Root is tagged null record; + type Child is new Root with null record; + + overriding + procedure P (V : Integer; V2 : Child); + -- Primitive + + procedure P2 (V : Integer; V2 : Child); + -- NOT Primitive + + function F return Child; -- NOT Primitive + + function F2 (V : Child) return Child; + -- Primitive, but only controlling on the first parameter + end; + +Note that ``function F2 (V : Child) return Child;`` differs from ``F2 (V : Child) +return Child'Class;`` in that the return type is a specific, definite type. This +is also distinct from the legacy semantics, where further derivations with +added fields would require overriding the function. + +The option ``-gnatw_j``, that you can pass to the compiler directly, enables +warnings related to this new language feature. For instance, compiling the +example above without this switch produces no warnings, but compiling it with +``-gnatw_j`` generates the following warning on the declaration of procedure P2: + +.. code-block:: ada + + warning: not a dispatching primitive of tagged type "Child" + warning: disallowed by First_Controlling_Parameter on "Child" + +For generic formal tagged types, you can specify whether the type has the +First_Controlling_Parameter aspect enabled: + +.. code-block:: ada + + generic + type T is tagged private with First_Controlling_Parameter; + package T is + type U is new T with null record; + function Foo return U; -- Not a primitive + end T; + +For tagged partial views, the value of the aspect must be consistent between +the partial and full views: + +.. code-block:: ada + + package R is + type T is tagged private; + ... + private + type T is tagged null record with First_Controlling_Parameter; -- ILLEGAL + end R; + +Link to the original RFC: +https://github.com/AdaCore/ada-spark-rfcs/blob/master/considered/rfc-oop-first-controlling.rst + .. _Experimental_Language_Extensions: Experimental Language Extensions diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index a2c14e203c3..f901b0e133e 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -901,6 +901,7 @@ Curated Extensions * String interpolation:: * Constrained attribute for generic objects:: * Static aspect on intrinsic functions:: +* First Controlling Parameter:: Experimental Language Extensions @@ -28945,6 +28946,7 @@ for use in playground experiments. * String interpolation:: * Constrained attribute for generic objects:: * Static aspect on intrinsic functions:: +* First Controlling Parameter:: @end menu @@ -29270,7 +29272,7 @@ Link to the original RFC: The @code{Constrained} attribute is permitted for objects of generic types. The result indicates whether the corresponding actual is constrained. -@node Static aspect on intrinsic functions,,Constrained attribute for generic objects,Curated Extensions +@node Static aspect on intrinsic functions,First Controlling Parameter,Constrained attribute for generic objects,Curated Extensions @anchor{gnat_rm/gnat_language_extensions static-aspect-on-intrinsic-functions}@anchor{44b} @subsection @code{Static} aspect on intrinsic functions @@ -29279,8 +29281,92 @@ The Ada 202x @code{Static} aspect can be specified on Intrinsic imported functio and the compiler will evaluate some of these intrinsics statically, in particular the @code{Shift_Left} and @code{Shift_Right} intrinsics. +@node First Controlling Parameter,,Static aspect on intrinsic functions,Curated Extensions +@anchor{gnat_rm/gnat_language_extensions first-controlling-parameter}@anchor{44c} +@subsection First Controlling Parameter + + +A new pragma/aspect, @code{First_Controlling_Parameter}, is introduced for tagged +types, altering the semantics of primitive/controlling parameters. When a +tagged type is marked with this aspect, only subprograms where the first +parameter is of that type will be considered dispatching primitives. This +pragma/aspect applies to the entire hierarchy, starting from the specified +type, without affecting inherited primitives. + +Here is an example of this feature: + +@example +package Example is + type Root is tagged private; + + procedure P (V : Integer; V2 : Root); + -- Primitive + + type Child is tagged private + with First_Controlling_Parameter; + +private + type Root is tagged null record; + type Child is new Root with null record; + + overriding + procedure P (V : Integer; V2 : Child); + -- Primitive + + procedure P2 (V : Integer; V2 : Child); + -- NOT Primitive + + function F return Child; -- NOT Primitive + + function F2 (V : Child) return Child; + -- Primitive, but only controlling on the first parameter +end; +@end example + +Note that @code{function F2 (V : Child) return Child;} differs from @code{F2 (V : Child) +return Child'Class;} in that the return type is a specific, definite type. This +is also distinct from the legacy semantics, where further derivations with +added fields would require overriding the function. + +The option @code{-gnatw_j}, that you can pass to the compiler directly, enables +warnings related to this new language feature. For instance, compiling the +example above without this switch produces no warnings, but compiling it with +@code{-gnatw_j} generates the following warning on the declaration of procedure P2: + +@example +warning: not a dispatching primitive of tagged type "Child" +warning: disallowed by First_Controlling_Parameter on "Child" +@end example + +For generic formal tagged types, you can specify whether the type has the +First_Controlling_Parameter aspect enabled: + +@example +generic + type T is tagged private with First_Controlling_Parameter; +package T is + type U is new T with null record; + function Foo return U; -- Not a primitive +end T; +@end example + +For tagged partial views, the value of the aspect must be consistent between +the partial and full views: + +@example +package R is + type T is tagged private; +... +private + type T is tagged null record with First_Controlling_Parameter; -- ILLEGAL +end R; +@end example + +Link to the original RFC: +@indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/considered/rfc-oop-first-controlling.rst} + @node Experimental Language Extensions,,Curated Extensions,GNAT language extensions -@anchor{gnat_rm/gnat_language_extensions experimental-language-extensions}@anchor{6a}@anchor{gnat_rm/gnat_language_extensions id2}@anchor{44c} +@anchor{gnat_rm/gnat_language_extensions experimental-language-extensions}@anchor{6a}@anchor{gnat_rm/gnat_language_extensions id2}@anchor{44d} @section Experimental Language Extensions @@ -29296,7 +29382,7 @@ particular the @code{Shift_Left} and @code{Shift_Right} intrinsics. @end menu @node Conditional when constructs,Storage Model,,Experimental Language Extensions -@anchor{gnat_rm/gnat_language_extensions conditional-when-constructs}@anchor{44d} +@anchor{gnat_rm/gnat_language_extensions conditional-when-constructs}@anchor{44e} @subsection Conditional when constructs @@ -29368,7 +29454,7 @@ Link to the original RFC: @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-conditional-when-constructs.rst} @node Storage Model,Attribute Super,Conditional when constructs,Experimental Language Extensions -@anchor{gnat_rm/gnat_language_extensions storage-model}@anchor{44e} +@anchor{gnat_rm/gnat_language_extensions storage-model}@anchor{44f} @subsection Storage Model @@ -29383,7 +29469,7 @@ Here is a link to the full RFC: @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-storage-model.rst} @node Attribute Super,Simpler accessibility model,Storage Model,Experimental Language Extensions -@anchor{gnat_rm/gnat_language_extensions attribute-super}@anchor{44f} +@anchor{gnat_rm/gnat_language_extensions attribute-super}@anchor{450} @subsection Attribute Super @@ -29413,7 +29499,7 @@ Here is a link to the full RFC: @indicateurl{https://github.com/QuentinOchem/ada-spark-rfcs/blob/oop/considered/rfc-oop-super.rst} @node Simpler accessibility model,Case pattern matching,Attribute Super,Experimental Language Extensions -@anchor{gnat_rm/gnat_language_extensions simpler-accessibility-model}@anchor{450} +@anchor{gnat_rm/gnat_language_extensions simpler-accessibility-model}@anchor{451} @subsection Simpler accessibility model @@ -29426,7 +29512,7 @@ Here is a link to the full RFC: @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-simpler-accessibility.md} @node Case pattern matching,Mutably Tagged Types with Size’Class Aspect,Simpler accessibility model,Experimental Language Extensions -@anchor{gnat_rm/gnat_language_extensions case-pattern-matching}@anchor{451} +@anchor{gnat_rm/gnat_language_extensions case-pattern-matching}@anchor{452} @subsection Case pattern matching @@ -29558,7 +29644,7 @@ Link to the original RFC: @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/master/prototyped/rfc-pattern-matching.rst} @node Mutably Tagged Types with Size’Class Aspect,Generalized Finalization,Case pattern matching,Experimental Language Extensions -@anchor{gnat_rm/gnat_language_extensions mutably-tagged-types-with-size-class-aspect}@anchor{452} +@anchor{gnat_rm/gnat_language_extensions mutably-tagged-types-with-size-class-aspect}@anchor{453} @subsection Mutably Tagged Types with Size’Class Aspect @@ -29598,7 +29684,7 @@ Link to the original RFC: @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/topic/rfc-finally/considered/rfc-class-size.md} @node Generalized Finalization,,Mutably Tagged Types with Size’Class Aspect,Experimental Language Extensions -@anchor{gnat_rm/gnat_language_extensions generalized-finalization}@anchor{453} +@anchor{gnat_rm/gnat_language_extensions generalized-finalization}@anchor{454} @subsection Generalized Finalization @@ -29630,7 +29716,7 @@ Link to the original RFC: @indicateurl{https://github.com/AdaCore/ada-spark-rfcs/blob/topic/finalization-rehaul/considered/rfc-generalized-finalization.md} @node Security Hardening Features,Obsolescent Features,GNAT language extensions,Top -@anchor{gnat_rm/security_hardening_features doc}@anchor{454}@anchor{gnat_rm/security_hardening_features id1}@anchor{455}@anchor{gnat_rm/security_hardening_features security-hardening-features}@anchor{15} +@anchor{gnat_rm/security_hardening_features doc}@anchor{455}@anchor{gnat_rm/security_hardening_features id1}@anchor{456}@anchor{gnat_rm/security_hardening_features security-hardening-features}@anchor{15} @chapter Security Hardening Features @@ -29652,7 +29738,7 @@ change. @end menu @node Register Scrubbing,Stack Scrubbing,,Security Hardening Features -@anchor{gnat_rm/security_hardening_features register-scrubbing}@anchor{456} +@anchor{gnat_rm/security_hardening_features register-scrubbing}@anchor{457} @section Register Scrubbing @@ -29688,7 +29774,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{457} +@anchor{gnat_rm/security_hardening_features stack-scrubbing}@anchor{458} @section Stack Scrubbing @@ -29832,7 +29918,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{458} +@anchor{gnat_rm/security_hardening_features hardened-conditionals}@anchor{459} @section Hardened Conditionals @@ -29922,7 +30008,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{459} +@anchor{gnat_rm/security_hardening_features hardened-booleans}@anchor{45a} @section Hardened Booleans @@ -29983,7 +30069,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{45a} +@anchor{gnat_rm/security_hardening_features control-flow-redundancy}@anchor{45b} @section Control Flow Redundancy @@ -30151,7 +30237,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{45b}@anchor{gnat_rm/obsolescent_features id1}@anchor{45c}@anchor{gnat_rm/obsolescent_features obsolescent-features}@anchor{16} +@anchor{gnat_rm/obsolescent_features doc}@anchor{45c}@anchor{gnat_rm/obsolescent_features id1}@anchor{45d}@anchor{gnat_rm/obsolescent_features obsolescent-features}@anchor{16} @chapter Obsolescent Features @@ -30170,7 +30256,7 @@ compatibility purposes. @end menu @node pragma No_Run_Time,pragma Ravenscar,,Obsolescent Features -@anchor{gnat_rm/obsolescent_features id2}@anchor{45d}@anchor{gnat_rm/obsolescent_features pragma-no-run-time}@anchor{45e} +@anchor{gnat_rm/obsolescent_features id2}@anchor{45e}@anchor{gnat_rm/obsolescent_features pragma-no-run-time}@anchor{45f} @section pragma No_Run_Time @@ -30183,7 +30269,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{45f}@anchor{gnat_rm/obsolescent_features pragma-ravenscar}@anchor{460} +@anchor{gnat_rm/obsolescent_features id3}@anchor{460}@anchor{gnat_rm/obsolescent_features pragma-ravenscar}@anchor{461} @section pragma Ravenscar @@ -30192,7 +30278,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{461}@anchor{gnat_rm/obsolescent_features pragma-restricted-run-time}@anchor{462} +@anchor{gnat_rm/obsolescent_features id4}@anchor{462}@anchor{gnat_rm/obsolescent_features pragma-restricted-run-time}@anchor{463} @section pragma Restricted_Run_Time @@ -30202,7 +30288,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{463}@anchor{gnat_rm/obsolescent_features pragma-task-info}@anchor{464} +@anchor{gnat_rm/obsolescent_features id5}@anchor{464}@anchor{gnat_rm/obsolescent_features pragma-task-info}@anchor{465} @section pragma Task_Info @@ -30228,7 +30314,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{465}@anchor{gnat_rm/obsolescent_features package-system-task-info-s-tasinf-ads}@anchor{466} +@anchor{gnat_rm/obsolescent_features package-system-task-info}@anchor{466}@anchor{gnat_rm/obsolescent_features package-system-task-info-s-tasinf-ads}@anchor{467} @section package System.Task_Info (@code{s-tasinf.ads}) @@ -30238,7 +30324,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{467}@anchor{gnat_rm/compatibility_and_porting_guide compatibility-and-porting-guide}@anchor{17}@anchor{gnat_rm/compatibility_and_porting_guide id1}@anchor{468} +@anchor{gnat_rm/compatibility_and_porting_guide doc}@anchor{468}@anchor{gnat_rm/compatibility_and_porting_guide compatibility-and-porting-guide}@anchor{17}@anchor{gnat_rm/compatibility_and_porting_guide id1}@anchor{469} @chapter Compatibility and Porting Guide @@ -30260,7 +30346,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{469}@anchor{gnat_rm/compatibility_and_porting_guide writing-portable-fixed-point-declarations}@anchor{46a} +@anchor{gnat_rm/compatibility_and_porting_guide id2}@anchor{46a}@anchor{gnat_rm/compatibility_and_porting_guide writing-portable-fixed-point-declarations}@anchor{46b} @section Writing Portable Fixed-Point Declarations @@ -30382,7 +30468,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{46b}@anchor{gnat_rm/compatibility_and_porting_guide id3}@anchor{46c} +@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-ada-83}@anchor{46c}@anchor{gnat_rm/compatibility_and_porting_guide id3}@anchor{46d} @section Compatibility with Ada 83 @@ -30410,7 +30496,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{46d}@anchor{gnat_rm/compatibility_and_porting_guide legal-ada-83-programs-that-are-illegal-in-ada-95}@anchor{46e} +@anchor{gnat_rm/compatibility_and_porting_guide id4}@anchor{46e}@anchor{gnat_rm/compatibility_and_porting_guide legal-ada-83-programs-that-are-illegal-in-ada-95}@anchor{46f} @subsection Legal Ada 83 programs that are illegal in Ada 95 @@ -30510,7 +30596,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{46f}@anchor{gnat_rm/compatibility_and_porting_guide more-deterministic-semantics}@anchor{470} +@anchor{gnat_rm/compatibility_and_porting_guide id5}@anchor{470}@anchor{gnat_rm/compatibility_and_porting_guide more-deterministic-semantics}@anchor{471} @subsection More deterministic semantics @@ -30538,7 +30624,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{471}@anchor{gnat_rm/compatibility_and_porting_guide id6}@anchor{472} +@anchor{gnat_rm/compatibility_and_porting_guide changed-semantics}@anchor{472}@anchor{gnat_rm/compatibility_and_porting_guide id6}@anchor{473} @subsection Changed semantics @@ -30580,7 +30666,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{473}@anchor{gnat_rm/compatibility_and_porting_guide other-language-compatibility-issues}@anchor{474} +@anchor{gnat_rm/compatibility_and_porting_guide id7}@anchor{474}@anchor{gnat_rm/compatibility_and_porting_guide other-language-compatibility-issues}@anchor{475} @subsection Other language compatibility issues @@ -30613,7 +30699,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{475}@anchor{gnat_rm/compatibility_and_porting_guide id8}@anchor{476} +@anchor{gnat_rm/compatibility_and_porting_guide compatibility-between-ada-95-and-ada-2005}@anchor{476}@anchor{gnat_rm/compatibility_and_porting_guide id8}@anchor{477} @section Compatibility between Ada 95 and Ada 2005 @@ -30685,7 +30771,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{477}@anchor{gnat_rm/compatibility_and_porting_guide implementation-dependent-characteristics}@anchor{478} +@anchor{gnat_rm/compatibility_and_porting_guide id9}@anchor{478}@anchor{gnat_rm/compatibility_and_porting_guide implementation-dependent-characteristics}@anchor{479} @section Implementation-dependent characteristics @@ -30708,7 +30794,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{479}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-pragmas}@anchor{47a} +@anchor{gnat_rm/compatibility_and_porting_guide id10}@anchor{47a}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-pragmas}@anchor{47b} @subsection Implementation-defined pragmas @@ -30730,7 +30816,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{47b}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-attributes}@anchor{47c} +@anchor{gnat_rm/compatibility_and_porting_guide id11}@anchor{47c}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-attributes}@anchor{47d} @subsection Implementation-defined attributes @@ -30744,7 +30830,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{47d}@anchor{gnat_rm/compatibility_and_porting_guide libraries}@anchor{47e} +@anchor{gnat_rm/compatibility_and_porting_guide id12}@anchor{47e}@anchor{gnat_rm/compatibility_and_porting_guide libraries}@anchor{47f} @subsection Libraries @@ -30773,7 +30859,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{47f}@anchor{gnat_rm/compatibility_and_porting_guide id13}@anchor{480} +@anchor{gnat_rm/compatibility_and_porting_guide elaboration-order}@anchor{480}@anchor{gnat_rm/compatibility_and_porting_guide id13}@anchor{481} @subsection Elaboration order @@ -30809,7 +30895,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{481}@anchor{gnat_rm/compatibility_and_porting_guide target-specific-aspects}@anchor{482} +@anchor{gnat_rm/compatibility_and_porting_guide id14}@anchor{482}@anchor{gnat_rm/compatibility_and_porting_guide target-specific-aspects}@anchor{483} @subsection Target-specific aspects @@ -30822,10 +30908,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{483,,Representation Clauses}. +GNAT’s approach to these issues is described in @ref{484,,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{484}@anchor{gnat_rm/compatibility_and_porting_guide id15}@anchor{485} +@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-other-ada-systems}@anchor{485}@anchor{gnat_rm/compatibility_and_porting_guide id15}@anchor{486} @section Compatibility with Other Ada Systems @@ -30868,7 +30954,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{486}@anchor{gnat_rm/compatibility_and_porting_guide representation-clauses}@anchor{483} +@anchor{gnat_rm/compatibility_and_porting_guide id16}@anchor{487}@anchor{gnat_rm/compatibility_and_porting_guide representation-clauses}@anchor{484} @section Representation Clauses @@ -30961,7 +31047,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{487}@anchor{gnat_rm/compatibility_and_porting_guide id17}@anchor{488} +@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-hp-ada-83}@anchor{488}@anchor{gnat_rm/compatibility_and_porting_guide id17}@anchor{489} @section Compatibility with HP Ada 83 @@ -30991,7 +31077,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{489}@anchor{share/gnu_free_documentation_license gnu-fdl}@anchor{1}@anchor{share/gnu_free_documentation_license gnu-free-documentation-license}@anchor{48a} +@anchor{share/gnu_free_documentation_license doc}@anchor{48a}@anchor{share/gnu_free_documentation_license gnu-fdl}@anchor{1}@anchor{share/gnu_free_documentation_license gnu-free-documentation-license}@anchor{48b} @chapter GNU Free Documentation License diff --git a/gcc/ada/usage.adb b/gcc/ada/usage.adb index 59cbd6f4a2f..5b7743703c5 100644 --- a/gcc/ada/usage.adb +++ b/gcc/ada/usage.adb @@ -527,6 +527,9 @@ begin "primitives"); Write_Line (" .J* turn off warnings for late dispatching " & "primitives"); + Write_Line (" _j turn on warnings for First_Controlling_" & + "Parameter aspect"); + Write_Line (" k+ turn on warnings on constant variable"); Write_Line (" K* turn off warnings on constant variable"); Write_Line (" .k turn on warnings for standard redefinition"); From patchwork Thu Aug 29 13:07:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 1978422 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=FE4XHwbn; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WvhRs66WWz1yXd for ; Thu, 29 Aug 2024 23:08:37 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7E9403861829 for ; Thu, 29 Aug 2024 13:08:35 +0000 (GMT) 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 51AB93860776 for ; Thu, 29 Aug 2024 13:08:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 51AB93860776 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 51AB93860776 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=1724936890; cv=none; b=Ym4f4KilbNpU5ft/5RooXiKhLayJrP2k+kjTTQ+4xvGgN+PITar/XWrmEoQZ4ECxSHFznjZMl2izplugTj2/JZp64PwDsDPuFWC4+VFzpIMM4rdGa/XIKPkaeWmcg1/cqOqj+By8vMhzFo946UKjIWxpUayz8nBfapeWMLnmtkM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724936890; c=relaxed/simple; bh=DsKZrYDK6dK0twRIV6TokcEhSxIC+DY+gDNJ8Y7s0lg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Pu9Cwkxmtc4AcQmeWl5msbVlWUuzCK6ltFtHhn1EEOTGpmxaIIV1PU39Sz1WsJB9dT4rvxsLCBbZ1G3wKD7Ojf9ieBBrC7TACEdSrEziV6auOsgQNocU0qemPL7ECnkjTZrC85q55xaHH5TpPJOQ3mN3ukkBfPQYH8WodOiHuZ0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-37182eee02dso395917f8f.1 for ; Thu, 29 Aug 2024 06:08:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1724936886; x=1725541686; 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=F3SEI7cHxqmiR3wVnqGsqGaJG1DZ9nZXwGBn+B5fLBY=; b=FE4XHwbn90JeqGs1xQi4hvgQeXPAugvRnBTQKs5MPE4cutCvYkQLZmNWFPbI2gE3eg Oo9plOfV6upya+pbS7rS5SqCwf878NNE173biOrk7mi6TvlFJ6SCHCaedVcdT6TuoJ9G NhvQSgtkkuVCTmHfkgcDd6dWqBmNFYjzy7VYYv8yROaGXJr9INNpJIF383H45b5vl9Eg Q/YeCMRObO1BzI5oDcmfjnslkZ4vDqgkNH/XX0Ex1Qv+yQGPxpwv9gCGUw9iyc1i2Kyu gFBMVwTw4MQRG4XH3981xzzQT/Ax4QWy38TlLnReKQDsRV5+jd1JhFXJqB7w4Rz8+m7L HaxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724936886; x=1725541686; 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=F3SEI7cHxqmiR3wVnqGsqGaJG1DZ9nZXwGBn+B5fLBY=; b=Xx/i/ea9f0kULjoYpeXXSEYTnfmV/FysjPfU3wwNh2ArDk9oO4YAFs7kS0XV3GEDve hWnObsw8HTAHpMnf3jQNMzEu0NfLNkoPmTLELSnAG+Cij3HmEa5NsZb1tEKuJPzRz9yy TGEWi01rArjpAh9jKq2RZxuKwVCGKtJQz3WT7rFV/u81vnNXCEXs6WgEgRxAXdT2mriK ImnERbwqIfgKZ2l6pd9aHRHy0tkT+UFsKUVuAFoQwGQUqpEjBy6yxxniPl9aTveVumW8 7rfmXNKTjHC3FW/vV0yFlzLZCYQc7KQOE+EJ+HjLd/c7nYHfqnhbryn5WeOFbkojr9fs 9ZzA== X-Gm-Message-State: AOJu0YwPCFUzVF0XAV2CTd6BydtXgMh9x+FJbyjLLYVHWojZ9uiuEih7 u7Cjka4mk4rK1VGrMrXpsHoSbmToJKe3Y6G2K2StcyZ2rZWKXJCyi8/rmUb/39NjhxXG8SYYGDc = X-Google-Smtp-Source: AGHT+IEl3mxyjnPPUmc6Po5Dsoja5+Vf4wkzAN8rfUu2ayO1+cz2Qsp39GVzFhjEFPSajYTHPq+Yxg== X-Received: by 2002:a5d:59a9:0:b0:35f:314a:229c with SMTP id ffacd0b85a97d-374a0232925mr1425630f8f.28.1724936885543; Thu, 29 Aug 2024 06:08:05 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:5e2c:51b0:ac4a:92ca]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bb6deb2f5sm17074605e9.2.2024.08.29.06.08.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 06:08:05 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Gary Dismukes Subject: [COMMITTED 03/17] ada: Proper handling for iterator associations in array aggregates Date: Thu, 29 Aug 2024 15:07:33 +0200 Message-ID: <20240829130750.1651060-3-poulhies@adacore.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829130750.1651060-1-poulhies@adacore.com> References: <20240829130750.1651060-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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org From: Gary Dismukes The compiler was flagging type-mismatch errors on iterated component associations in array aggregates of form "for C in ", improperly requiring the type of the iterator to be the array index type. The parser can't distinguish whether the association is one involving an actual discrete choice vs. an iterator specification, and creates an N_Iterated_Component_Association with a Defining_Identifer and Discrete_Choices, and the analysis phase has to disambiguate this, determining whether to create an N_Iterator_Specification node for the association. A related change is to revise the similar code for iterated associations of container aggregates, to allow forms of iterator objects other than just function calls. gcc/ada/ * sem_aggr.adb (Resolve_Array_Aggregate): Add loop over associations to locate N_Iterated_Component_Associations that do not have an Iterator_Specification, and if their Discrete_Choices list consists of a single choice, analyze it and if it's the name of an iterator object, then create an Iterator_Specification and associate it with the iterated component association. (Resolve_Iterated_Association): Replace test for function call with test of Is_Object_Reference, to handle other forms of iterator objects in container aggregates. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_aggr.adb | 62 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index 087e324b5c1..8319ff5af62 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -2542,6 +2542,66 @@ package body Sem_Aggr is null; elsif Present (Component_Associations (N)) then + Assoc := First (Component_Associations (N)); + + -- Loop over associations to identify any iterated associations that + -- need to be converted from the form with a Defining_Identifer and + -- Discrete_Choices list to the form with an Iterator_Specification. + + if Nkind (Assoc) = N_Iterated_Component_Association then + while Present (Assoc) loop + if Nkind (Assoc) = N_Iterated_Component_Association + and then No (Iterator_Specification (Assoc)) + then + declare + Choice : constant Node_Id := + First (Discrete_Choices (Assoc)); + Copy : Node_Id; + begin + + -- A copy of Choice is made before it's analyzed, + -- to preserve prefixed calls in their original form, + -- because otherwise the analysis of Choice can transform + -- such calls to normal form, and the later analysis of + -- the iterator_specification created below may trigger + -- an error on the call (in the case where the function + -- is not directly visible). + + Copy := Copy_Separate_Tree (Choice); + + -- This is an association with a Defining_Identifier and + -- Discrete_Choice_List, but if the latter has a single + -- choice denoting an object (including a function call) + -- of an iterator type, then it's a stand-in for an + -- Iterator_Specification, and so we transform the + -- association accordingly. + + if No (Next (Choice)) then + Analyze (Choice); + + if Is_Object_Reference (Choice) + and then Is_Iterator (Etype (Choice)) + then + Set_Iterator_Specification + (Assoc, + Make_Iterator_Specification (Sloc (N), + Defining_Identifier => + Relocate_Node (Defining_Identifier (Assoc)), + Name => Copy, + Reverse_Present => Reverse_Present (Assoc), + Iterator_Filter => Empty, + Subtype_Indication => Empty)); + + Set_Defining_Identifier (Assoc, Empty); + Set_Discrete_Choices (Assoc, No_List); + end if; + end if; + end; + end if; + + Next (Assoc); + end loop; + end if; -- Verify that all or none of the component associations -- include an iterator specification. @@ -3814,7 +3874,7 @@ package body Sem_Aggr is then null; - elsif Nkind (Choice) = N_Function_Call then + elsif Is_Object_Reference (Choice) then declare I_Spec : constant Node_Id := Make_Iterator_Specification (Sloc (N), From patchwork Thu Aug 29 13:07:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 1978426 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=ie85ThsA; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WvhTj06ltz1yfn for ; Thu, 29 Aug 2024 23:10:17 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CC79E386180C for ; Thu, 29 Aug 2024 13:10:14 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id 8582F386074B for ; Thu, 29 Aug 2024 13:08:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8582F386074B 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 8582F386074B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::436 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724936891; cv=none; b=crpz/GLB6fjlaNUVemKu2Uq21Y0EFE+eZiR1zwjX6WQLWF8ViNG8U3Dd4ovHsr9P2WC/OdGm0g+54JEpHZ5mepYx5sPq/6+fvE6isLcgS34tD+7O6atAlFRO2UgQdo8f+jNzsJYQxYtCEY52X9lOm3ARJeryE2gph+WBLylr4KQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724936891; c=relaxed/simple; bh=jiiNLR2UdlIPeuNVM5h/3rzFELYR6yd2/uKzAG+Jq5w=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=JbnBZpgTEo5ruOdIdMvpYVGfrRz/vs2s+NA65UUoh0hSmVLOFHPB2PwXLZ/M3yS/3A/zE0N9ghAAHHeIB9UPBCxTZ9QfRaKG68CoOBACvCre6ay8CU/A+q09rher2T1K2qx8+MpX8beXOuRRujzEhGEjvSiETDq2fPaWEWQ60fA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-37196229343so439248f8f.0 for ; Thu, 29 Aug 2024 06:08:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1724936887; x=1725541687; 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=6+XVNj5ksjqOS0Lov+4iOUuHDCFu0LUtzNQdIeElqGA=; b=ie85ThsAkEEAcYl0miXmjZgx0zc4rAKEzf7QlH7LbJAltBrHyCHNaLpDwLlmB4DVif FlGRhW9doOo7R66GKIG4OvKrtTuAj/5I2nUZ9t17rdw1RU1KTH/H+1zCKI7Y3QscZD+X kddgpHPmV7rnOh9zwgxSKMEWeaN0ctg3oAm3pghjzzuxomC1TWNp7PuIwz6cDzJZatIA prSuPcr2isebOVUoTSZsXqFskoL2r9kd7D8rGLBj6ofxKoxis6LAdjwuJigYRK/2Ycwm ElDEaZ1JwU5pnhHwfZahEIfzjaIFmUuSuEmNwvo+RZcpJawr5NxV0TUxWjiy7a/QQWTZ kmiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724936887; x=1725541687; 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=6+XVNj5ksjqOS0Lov+4iOUuHDCFu0LUtzNQdIeElqGA=; b=f0ym9+Ul6RXj/FJv1HyPZgUYKZ619Bwx0/CyQ4uxw1RhmkI3Xmh+3Kttr6CgmefSRq FG2YMLfPnLVOEChauwtmUktRmPAyd+FrTTs6QFoeMTEhmU+awop/apO76qOhpyyNqbKU 6CfDN8lRcZ889mbuu0CjJ14fc7Gi6f6LuBb1iaLFOa1XOXl6H5tjZRG8Bd5E9mmEXKL3 /G0bFFQcXmF/PkiEJFbYYsSymhjtAJgMhlFS+7Zp3D18T23d0kzki92dB7MnBw4Ox8Gd 0p1fZCvigQ22UbxY8F6P2ZAzcNVtMRT/HxYiogkXoaEuSkrShdHH7t1aVqKHM+UUZf9z eUUQ== X-Gm-Message-State: AOJu0Yy861bfgiHKDZzjQyjDosca7aDtfD2KSq/GWWzrMWNbpIpQZrPg KexoywcWTq6n6hCLLfsr8kxaVm7hcpfV3b/aM/f/oEPuT6znym4xOTQCux2R9snqcUHT1F5fC9U = X-Google-Smtp-Source: AGHT+IFPwQS9n4yNvcKo2hwLxgmVryaeI16TWkLn2xewFfSxMgV2ZhXDKxTPOu7oV03VZjAEgj5y3Q== X-Received: by 2002:a5d:6a88:0:b0:367:99fd:d7bb with SMTP id ffacd0b85a97d-3749b594e8cmr1702606f8f.63.1724936886514; Thu, 29 Aug 2024 06:08:06 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:5e2c:51b0:ac4a:92ca]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bb6deb2f5sm17074605e9.2.2024.08.29.06.08.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 06:08:05 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Viljar Indus Subject: [COMMITTED 04/17] ada: Display actual line length in line length check Date: Thu, 29 Aug 2024 15:07:34 +0200 Message-ID: <20240829130750.1651060-4-poulhies@adacore.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829130750.1651060-1-poulhies@adacore.com> References: <20240829130750.1651060-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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org From: Viljar Indus gcc/ada/ * styleg.adb (Check_Line_Max_Length): Add the actual line length to the diagnostic message. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/styleg.adb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gcc/ada/styleg.adb b/gcc/ada/styleg.adb index c405dec2b33..74b629c34b3 100644 --- a/gcc/ada/styleg.adb +++ b/gcc/ada/styleg.adb @@ -38,6 +38,7 @@ with Sinfo; use Sinfo; with Sinfo.Nodes; use Sinfo.Nodes; with Sinput; use Sinput; with Stylesw; use Stylesw; +with Uintp; use Uintp; package body Styleg is @@ -672,8 +673,9 @@ package body Styleg is begin if Style_Check_Max_Line_Length then if Len > Style_Max_Line_Length then + Error_Msg_Uint_1 := UI_From_Int (Len); Error_Msg - ("(style) this line is too long?M?", + ("(style) this line is too long: ^?M?", Current_Line_Start + Source_Ptr (Style_Max_Line_Length)); end if; end if; From patchwork Thu Aug 29 13:07:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 1978424 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=cxrHUW5U; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WvhSR3sCwz1yfy for ; Thu, 29 Aug 2024 23:09:11 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 61E0A3850212 for ; Thu, 29 Aug 2024 13:09:09 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by sourceware.org (Postfix) with ESMTPS id DE0B9385841E for ; Thu, 29 Aug 2024 13:08:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DE0B9385841E 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 DE0B9385841E 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=1724936892; cv=none; b=k9udiCP9cvowHfflAw6IOcs1dAPExuq9E9a9Oio7Ed0eucmeUsg64G1Rpkz6f+uPcP6KTWBKCbjANOCqEcx3oRyxFW2qNBWdty2kASEJ9Kt6c83gw7C7sEuGKsjMZUWLfJV4EcWxbhwu1XnMxhE5DG6x35U6BW5rr/IxpxdPD4Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724936892; c=relaxed/simple; bh=JArYAb3FVYlj1ZZB1kzhfLTWRPmhIrUi45I+A7mXwj4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Z0lxTEFIDpOoJtQQDhIL5yhnSOs0rtJ9bbGqu20775I4LTtoPFkBRkpfgAUyU4FVRzhPt+05bhU7O/mSVOLVinxQadog7Tr/VzSIj7pdy49CGp/E7smKrEY2Ro3cuLsCdrkpPfqMF1ObFzIBWbHPDfqrBwEj6uCgCBrvK4q2qwM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-3718eaf4046so529710f8f.3 for ; Thu, 29 Aug 2024 06:08:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1724936888; x=1725541688; 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=XVEEF8gKXKQ7uedqNj/kzNIjVbiJoi3xPG7UV+wmz9U=; b=cxrHUW5U/wk//OeHg9ls/GycGStX3dP+Qw/+VtACZn9d6CRglhneu0AMk5RcmoYKdh djE53fpeNa53a3p96WV0rOh9hdlrfdU6FaJWVsKQAPPgwzr4tUJXsJOyeeK5RP8SgbCp R7cnhp4KqfRpI4BVxoSwLRUTf/6+/L61zkgFbQy1J1U16mTR2ruBqAOFFaGYFFrtk8tF PghX7ZE96oauY7SHIpuJimhJHfl74QfSWf7od+kfzf/BPh1QPr2e1HjgWnECZV5tPixf 3gZ8wqLyr08Vkj85UOg9lT0kHQgImJbDqQC4z8AAMYyDHwmYQ4lPlR8a7MlTqz6zSZsy 7dIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724936888; x=1725541688; 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=XVEEF8gKXKQ7uedqNj/kzNIjVbiJoi3xPG7UV+wmz9U=; b=AwmdzkBFEZCqcMVBC5bCGjaf/HlCFjYBASHO15UY7witGtEXVa6Hu9L2FUw8d1d2+e +GNRug94AQfsGz8+4CbFAx4502SnEV/jPVjplpbrPclTN186J2R07npvNsa4OBJ2gHju 8XarVyZ5bUkaXVI0/SR9q32XjPqwu12ECNDpLGH78KvmBYX7YmgqpXtHPCLAn0N8ahd+ 5sEDvH8SGFE8nWKZDicvrtgpxXuAJWnazt0005eJJ7oNbNsfs1ybcaZuGqgdP3zckDgx Mb5es7rIW6O+fzdk7ApTggja6HdlmmafhwhD+qJsjkeSNeDZd0nikcXB+Mo1eVOl1hld awoA== X-Gm-Message-State: AOJu0YxwYPVWxe805X87TlJCGVS5/Aq5fEv0xAFelm4+4AfWRw+rFo8X kLcRX0nmniaQufwtq3HvdSWIE3FHpJenz284vnreSHwmf/LSQ6UTxF3VgCB38flwAQztOt/RW+s = X-Google-Smtp-Source: AGHT+IEoO3UjtlUCdqfcdgrKcchddg6fY2SoSU8Y+bFSzKcz8HxLsk8RjHnzTeQ0BsKsmIfP7Imz3Q== X-Received: by 2002:a05:6000:2ab:b0:371:8e24:1191 with SMTP id ffacd0b85a97d-3749b583df1mr3193618f8f.53.1724936887316; Thu, 29 Aug 2024 06:08:07 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:5e2c:51b0:ac4a:92ca]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bb6deb2f5sm17074605e9.2.2024.08.29.06.08.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 06:08:06 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED 05/17] ada: Ensure validity checks for private scalar types Date: Thu, 29 Aug 2024 15:07:35 +0200 Message-ID: <20240829130750.1651060-5-poulhies@adacore.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829130750.1651060-1-poulhies@adacore.com> References: <20240829130750.1651060-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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org From: Piotr Trojanek To check validity of data values, we must strip privacy from their types. gcc/ada/ * checks.adb (Expr_Known_Valid): Use Validated_View, which strips type derivation and privacy. * exp_ch3.adb (Simple_Init_Private_Type): Kill checks inside unchecked conversions, just like in Simple_Init_Scalar_Type. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/checks.adb | 2 +- gcc/ada/exp_ch3.adb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb index 83879a519f7..2fb750c3ba4 100644 --- a/gcc/ada/checks.adb +++ b/gcc/ada/checks.adb @@ -6833,7 +6833,7 @@ package body Checks is ---------------------- function Expr_Known_Valid (Expr : Node_Id) return Boolean is - Typ : constant Entity_Id := Etype (Expr); + Typ : constant Entity_Id := Validated_View (Etype (Expr)); begin -- Non-scalar types are always considered valid, since they never give diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index bf04ea9d70a..4f6fa4cf6b7 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -10248,7 +10248,8 @@ package body Exp_Ch3 is if Nkind (Expr) = N_Unchecked_Type_Conversion and then Is_Scalar_Type (Under_Typ) then - Set_No_Truncation (Expr); + Set_Kill_Range_Check (Expr); + Set_No_Truncation (Expr); end if; return Expr; From patchwork Thu Aug 29 13:07:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 1978430 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=jMOpVum8; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WvhWB6sDkz1yfn for ; Thu, 29 Aug 2024 23:11:34 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2D0B3385020A for ; Thu, 29 Aug 2024 13:11:33 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by sourceware.org (Postfix) with ESMTPS id E408A385F027 for ; Thu, 29 Aug 2024 13:08:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E408A385F027 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 E408A385F027 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::433 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724936892; cv=none; b=cNsGP5r3BtRfDvo7iZiCZv2uYjDPHxTZpUMxvV3O8TttYqmEMgddcnkTiFZeSXLKBU0nQiIYfwSQB1i1kAkSgoiS1kkKrTR94kDT67P6TZaDq1pmF8xe5OU8iWcodLOt+WoIhaPvT4g9I/bUFmLlec71Spk682fLONrDfrMxisg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724936892; c=relaxed/simple; bh=0xQxd76Coz2c7RmsiKoOsFBgf0XPvwNWNWFRy5Bd+jI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=cjyxjSWXP32bqTwV0QPDuS15gc3RvbpyyAJeUSepZJz4BFhPB6kiSXuYmuMN7KxbhXXEnMBnGMp2QgHnisux/wWxvASeA7hLFEWPyVsGDTu8Tfx1ANg4O/XGR6YjlV3Rd9Tz3CNizcWEUOqmDQR6xYV7oS7aHy52O/vzvikb71w= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-3719753d365so470159f8f.2 for ; Thu, 29 Aug 2024 06:08:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1724936888; x=1725541688; 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=Ts4TmM4BQr7quvQG82WrdFnSZttWHOspkV13+lCZse0=; b=jMOpVum8ZjpbJrrMo0QSdCgQfkQttEzH57PlfBbHsmgsz6R9EnNKU2rxjHkBlR/5yH g4iDTJ0QuJ4c/vLz9DdXcH89MWVtUC3Z0Vpm4zxfKwTHUs5tls11DcvQBR05Wh1u9bdW nnfMF0EmY/d2DI51NQNKBcg635bWgC+1mVS5q1V2Qd4V/e3thz+Fw4Ayl6sbh5wX77cn 4YyaqVWq9pQ6Awxc06YCQLJkAKcRioFs860jAqMTcWTd8gG8g2HL86yfQYivXoMpNZEh ig1m9wEqIyDOsqakDzZw9oSI0MCYbiUxI4On9tt//7l4tNMPnKoX54iG8pm90NFKdzCg 8e7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724936888; x=1725541688; 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=Ts4TmM4BQr7quvQG82WrdFnSZttWHOspkV13+lCZse0=; b=Jp2OKU92eCVr8hJOlyPXZNKBb49A03aFfc+CIun5IJh3i8cX9gSRt37XB1c6as4Pzv uRHzLphkPioCwOzDoJ3HcwoI9ZX3J7Wqm9q8rIRyyokgVToyaBZcrxjnA9vlHhutdrbf 29/n3mv3SOUEQE9gbkWUk/QTft5r8xZCKWjckDA7dy7jtLm6ZixRkZv4IQXpWP+HZmkU yupGstiBKwHE9DJLKmSjxB+iywCl2MO6Ofl25z+UCLqnH607oEAAZvaS14Tr57k3fY/i 2VK/+YQM4GyVd9YRAH81WMi3kvNZmvtr5d7Q8i5i1CMntxke75dJnEZUcENq9155th0G AZSA== X-Gm-Message-State: AOJu0YwDUsjtPfBKRnxgpEMtB+a8HSznA9YsBx69NtZhlm4DnLDKV98C 6iUg/Zdz2YFmq8Zik8MBfixwsaEuuEvYkf1978VtKsMOjej2JdcX4Bip3unkuFTyb07G0Ole5oY = X-Google-Smtp-Source: AGHT+IFu7UpSqBWq0EwC/9eJIEVwrrB5PC2AoZXWC8kksHfROdWafxSjpcH+nY6UCcdxfemCVZ2Imw== X-Received: by 2002:a05:6000:400f:b0:369:b838:9155 with SMTP id ffacd0b85a97d-3749b57c4a8mr2470485f8f.40.1724936888178; Thu, 29 Aug 2024 06:08:08 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:5e2c:51b0:ac4a:92ca]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bb6deb2f5sm17074605e9.2.2024.08.29.06.08.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 06:08:07 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Viljar Indus Subject: [COMMITTED 06/17] ada: Extract line fitting algorithm Date: Thu, 29 Aug 2024 15:07:36 +0200 Message-ID: <20240829130750.1651060-6-poulhies@adacore.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829130750.1651060-1-poulhies@adacore.com> References: <20240829130750.1651060-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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org From: Viljar Indus Separate the line fitting algorithm from the general line printing algorithm. gcc/ada/ * erroutc.ads: Add new method Output_Text_Within * erroutc.adb: Move the line fitting code to a new method called Output_Text_Within Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/erroutc.adb | 177 +++++++++++++++++++++++--------------------- gcc/ada/erroutc.ads | 4 + 2 files changed, 96 insertions(+), 85 deletions(-) diff --git a/gcc/ada/erroutc.adb b/gcc/ada/erroutc.adb index 7a823cefe56..2ce3505959f 100644 --- a/gcc/ada/erroutc.adb +++ b/gcc/ada/erroutc.adb @@ -683,28 +683,106 @@ package body Erroutc is end if; end Output_Line_Number; - --------------------- - -- Output_Msg_Text -- - --------------------- + ------------------------ + -- Output_Text_Within -- + ------------------------ - procedure Output_Msg_Text (E : Error_Msg_Id) is + procedure Output_Text_Within (Txt : String_Ptr; Line_Length : Nat) is Offs : constant Nat := Column - 1; -- Offset to start of message, used for continuations - Max : Integer; + Ptr : Natural; + + Split : Natural; + -- Position where a new line was inserted in the original message + + Start : Natural; + -- Start of the current line + + Max : Integer := Integer (Line_Length - Column + 1); -- Maximum characters to output on next line - Length : Nat; - -- Maximum total length of lines + Text_Length : constant Natural := Txt'Length; + -- Length of the message + + begin + -- Here we have to split the message up into multiple lines + + Ptr := 1; + loop + -- Make sure we do not have ludicrously small line + + Max := Integer'Max (Max, 20); + + -- If remaining text fits, output it respecting LF and we are done + + if Text_Length - Ptr < Max then + for J in Ptr .. Text_Length loop + if Txt (J) = ASCII.LF then + Write_Eol; + Write_Spaces (Offs); + else + Write_Char (Txt (J)); + end if; + end loop; + + return; + + -- Line does not fit + + else + Start := Ptr; + + -- First scan forward looking for a hard end of line + + for Scan in Ptr .. Ptr + Max - 1 loop + if Txt (Scan) = ASCII.LF then + Split := Scan - 1; + Ptr := Scan + 1; + goto Continue; + end if; + end loop; + + -- Otherwise scan backwards looking for a space + + for Scan in reverse Ptr .. Ptr + Max - 1 loop + if Txt (Scan) = ' ' then + Split := Scan - 1; + Ptr := Scan + 1; + goto Continue; + end if; + end loop; + + -- If we fall through, no space, so split line arbitrarily + + Split := Ptr + Max - 1; + Ptr := Split + 1; + end if; + + <> + if Start <= Split then + Write_Line (Txt (Start .. Split)); + Write_Spaces (Offs); + end if; + + Max := Integer (Line_Length - Column + 1); + end loop; + end Output_Text_Within; + + --------------------- + -- Output_Msg_Text -- + --------------------- + + procedure Output_Msg_Text (E : Error_Msg_Id) is E_Msg : Error_Msg_Object renames Errors.Table (E); Text : constant String_Ptr := E_Msg.Text; - Ptr : Natural; - Split : Natural; - Start : Natural; - Tag : constant String := Get_Warning_Tag (E); - Txt : String_Ptr; - Len : Natural; + Tag : constant String := Get_Warning_Tag (E); + Txt : String_Ptr; + + Line_Length : constant Nat := + (if Error_Msg_Line_Length = 0 then Nat'Last + else Error_Msg_Line_Length); begin -- Postfix warning tag to message if needed @@ -788,78 +866,7 @@ package body Erroutc is Txt := new String'(SGR_Error & "error: " & SGR_Reset & Txt.all); end if; - -- Set error message line length and length of message - - if Error_Msg_Line_Length = 0 then - Length := Nat'Last; - else - Length := Error_Msg_Line_Length; - end if; - - Max := Integer (Length - Column + 1); - Len := Txt'Length; - - -- Here we have to split the message up into multiple lines - - Ptr := 1; - loop - -- Make sure we do not have ludicrously small line - - Max := Integer'Max (Max, 20); - - -- If remaining text fits, output it respecting LF and we are done - - if Len - Ptr < Max then - for J in Ptr .. Len loop - if Txt (J) = ASCII.LF then - Write_Eol; - Write_Spaces (Offs); - else - Write_Char (Txt (J)); - end if; - end loop; - - return; - - -- Line does not fit - - else - Start := Ptr; - - -- First scan forward looking for a hard end of line - - for Scan in Ptr .. Ptr + Max - 1 loop - if Txt (Scan) = ASCII.LF then - Split := Scan - 1; - Ptr := Scan + 1; - goto Continue; - end if; - end loop; - - -- Otherwise scan backwards looking for a space - - for Scan in reverse Ptr .. Ptr + Max - 1 loop - if Txt (Scan) = ' ' then - Split := Scan - 1; - Ptr := Scan + 1; - goto Continue; - end if; - end loop; - - -- If we fall through, no space, so split line arbitrarily - - Split := Ptr + Max - 1; - Ptr := Split + 1; - end if; - - <> - if Start <= Split then - Write_Line (Txt (Start .. Split)); - Write_Spaces (Offs); - end if; - - Max := Integer (Length - Column + 1); - end loop; + Output_Text_Within (Txt, Line_Length); end Output_Msg_Text; --------------------- diff --git a/gcc/ada/erroutc.ads b/gcc/ada/erroutc.ads index 5d48d5b899f..effc667bb5d 100644 --- a/gcc/ada/erroutc.ads +++ b/gcc/ada/erroutc.ads @@ -519,6 +519,10 @@ package Erroutc is -- splits the line generating multiple lines of output, and in this case -- the last line has no terminating end of line character. + procedure Output_Text_Within (Txt : String_Ptr; Line_Length : Nat); + -- Output the text in Txt, splitting it into lines of at most the size of + -- Line_Length. + procedure Prescan_Message (Msg : String); -- Scans message text and sets the following variables: -- From patchwork Thu Aug 29 13:07:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 1978434 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=SPpRlxAF; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WvhXT5pWBz1yfn for ; Thu, 29 Aug 2024 23:12:41 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0AA7E3861828 for ; Thu, 29 Aug 2024 13:12:40 +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 C46B0386077D for ; Thu, 29 Aug 2024 13:08:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C46B0386077D 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 C46B0386077D 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=1724936893; cv=none; b=WNqUa59g+qrIZBfufVbybv5EFgOnGh0wghVK3yTHRfxD8NELV0zpOXWhj5UzZLcrbfB2PNIxpHZflw9rW+6wepTIEj+ewBMd6zg1Cd5F4pJSrNRRImb68Ac4c12vGjjBSDng1BZt88ntlRM1G6JtEpQUUluTJK3JGTB/R8xMWjg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724936893; c=relaxed/simple; bh=WRg8g6DKHgI6CwGmc6XsqwP/hk/C+Q6C2kr7Ue7sJBA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=d0W2Bdr1rIv4HsZKSTecrdx5W/UkWoUgJzYlAFxXY00kP01MgBTq4cnqXp7FrJaNlLLqBf++qTXicwjW1OwuG5Y96ZiSYqO9gwNJHGyujLLXMnrfbobSTgMblyi8LJ8uTyckuCMMco2qAVVnuBzgDMlAaQnlL3g2mEMYPVgepiw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-42bb4f8a4bfso4272985e9.1 for ; Thu, 29 Aug 2024 06:08:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1724936889; x=1725541689; 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=T6PD5iFzCk9PLouaxqlPBrIxwJZX6OFFTO67gL0CLv4=; b=SPpRlxAFXSW+kbJxU5atPbzjTtkqtDDqBSHaufsXJ7gJZmjNiz7FQE+DZhNJPGd5BE ZFYM6WT8gMWwUqpymFuELgST0QCyEaS6gDXH0k9HSj0BnHOpAVpGAZEKTy7UlvO4t3j7 VOTkcQr1Z+2JmEgLJc9WBPXXrQj5kj14+OO/e8uZV/t0KuTm45Ad3MzcPM5rn+zbk3u6 wfjkh2KK7khCISgIaB7RQ5ihyYnCH0GZX6vhUQKQOnmIpMOiLVyq4W+wlmKStQ/yDgdi sIDuR4Qo+fDAf30wDPdiYmTlAX4dYzbzimBkxXZVKyVyPu/duPsDKT6fYAdw5dTNqbMD ODww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724936889; x=1725541689; 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=T6PD5iFzCk9PLouaxqlPBrIxwJZX6OFFTO67gL0CLv4=; b=UWRvcQw6Rfq98C7Pm2kyFdaClCKYzven9Y1e4J2+z70mg3DEStb0GoES9dq5Ib8gar 9L2hMQ5QAqIG/JEHS/DoZHMB8Rr43vfE+NG+9gEPqNVdaWA5VnC0q7TT6rcexldkGta7 qn/ROmepPSN8zuG9NNUmRJEcH/+rygWHv/BzjWLt5qrwZg4YzFCd9w0QM/EeudnTYCiI GekLQvL5slR79V7pi9Tp/qnJh2Mvdrlx/vOVIare2mzsCEwcLKtAa6jHviCD6PaZl93W gQcTCDgXpH1tLfQLuJdpS+JkaZmWP3IN9QUpwG409I9uKctOgQ8sczirYtGUbEK2IC0H CT5Q== X-Gm-Message-State: AOJu0Yyo0UtNH8RfrjClIiBadviqTwfgqBVURdeZgGTYxasRhpgQpQmB ilnF4MUgCTgZUxIz7mWzhLGBeHxSr5dpgNophzJu0ceJ1QIf6DvrEWDhOldariW2qAWMkpXdyQE = X-Google-Smtp-Source: AGHT+IEQuoT0l33gRTAcyrnyettLo61PCE2vwgDfKdoTSoLqfOscH8wkZXvaFAF3gX8u0l5XtUZL9Q== X-Received: by 2002:a5d:668d:0:b0:36b:ea2d:fd5a with SMTP id ffacd0b85a97d-3749c22131fmr1480913f8f.22.1724936889150; Thu, 29 Aug 2024 06:08:09 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:5e2c:51b0:ac4a:92ca]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bb6deb2f5sm17074605e9.2.2024.08.29.06.08.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 06:08:08 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Viljar Indus Subject: [COMMITTED 07/17] ada: Use consistent type continuations messages Date: Thu, 29 Aug 2024 15:07:37 +0200 Message-ID: <20240829130750.1651060-7-poulhies@adacore.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829130750.1651060-1-poulhies@adacore.com> References: <20240829130750.1651060-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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org From: Viljar Indus Avoid cases where the main message is an error and the continuation is a warning. gcc/ada/ * freeze.adb: Remove warning insertion characters from a continuation message. * sem_util.adb: Remove warning insertion characters from a continuation message. * sem_warn.adb: Use same warning character as the main message. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/freeze.adb | 8 ++++---- gcc/ada/sem_util.adb | 2 +- gcc/ada/sem_warn.adb | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index f8e8cf38bb6..f7fc895055a 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -3287,7 +3287,7 @@ package body Freeze is ("aspect % applied to task type &", Typ); Error_Msg_N ("\replace task components with access-to-task-type " - & "components??", Typ); + & "components", Typ); end if; else @@ -7617,16 +7617,16 @@ package body Freeze is if Ada_Version >= Ada_2005 then Error_Msg_N - ("\would be legal if Storage_Size of 0 given??", E); + ("\would be legal if Storage_Size of 0 given", E); elsif No_Pool_Assigned (E) then Error_Msg_N - ("\would be legal in Ada 2005??", E); + ("\would be legal in Ada 2005", E); else Error_Msg_N ("\would be legal in Ada 2005 if " - & "Storage_Size of 0 given??", E); + & "Storage_Size of 0 given", E); end if; end if; end if; diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index b423f87d969..ac64b1ca549 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -5938,7 +5938,7 @@ package body Sem_Util is else Error_Msg ("\Constraint_Error will be raised" - & " for objects of this type??", Eloc, N); + & " for objects of this type", Eloc, N); end if; end if; end; diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb index ca385154cb4..49e9d90b478 100644 --- a/gcc/ada/sem_warn.adb +++ b/gcc/ada/sem_warn.adb @@ -3511,15 +3511,15 @@ package body Sem_Warn is Error_Msg_Sloc := Sloc (CV); if Nkind (CV) not in N_Subexpr then - Error_Msg_N ("\\??(see test #)", N); + Error_Msg_N ("\\?c?(see test #)", N); elsif Nkind (Parent (CV)) = N_Case_Statement_Alternative then - Error_Msg_N ("\\??(see case alternative #)", N); + Error_Msg_N ("\\?c?(see case alternative #)", N); else - Error_Msg_N ("\\??(see assignment #)", N); + Error_Msg_N ("\\?c?(see assignment #)", N); end if; end if; end; From patchwork Thu Aug 29 13:07:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 1978443 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=fQgrjuZ5; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WvhYh5nzYz1yfn for ; Thu, 29 Aug 2024 23:13:44 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8FF7C3861029 for ; Thu, 29 Aug 2024 13:13:42 +0000 (GMT) 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 D17473860745 for ; Thu, 29 Aug 2024 13:08:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D17473860745 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 D17473860745 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=1724936894; cv=none; b=LpyHJMQJU43UbIYSGdAo2kFRjn8Z5uROvAAgVb0MwvyGbODiVEBcA09MQQNKOi3+113I7vQL3AeVxgqDvPr9CuLMYQrGjSAWXQPWwiafT+0Zc8u0OVhVu5o8cPI8CVY3ivoLYo2EjMgc49T2pskJ2AzXKY71ooHoCi84XmRjb2k= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724936894; c=relaxed/simple; bh=VBGM9ZjhU4WeoLUqKj2UZ6Falc8cGzrgoN3WQc4ShjI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=dMUrUmEAV5LJrII7RkcdlLamef61enamsx/bHCnrPfnyGVhuOlZIhsPIIQkRy7Xq5xo53RXQxuVKP2LKqBknur2C46V5SC1JNVOkNZzoxBCxR5/RpYf3b8TfTKBp3LGpLsMyHXSUM0ZbMgMKBOmmOAByuUQlS8p77Kcce27CmSg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-428243f928fso7438045e9.0 for ; Thu, 29 Aug 2024 06:08:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1724936890; x=1725541690; 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=+jZ6sXXY3ruYgukQSFf93l5MM9Nloj31hS+qkqjlhPc=; b=fQgrjuZ5qg8G4/H59FFPh760dr3KhV+I3XyyKGV8+PVHjmTGTUmpaj9MxdaTs+wTdK Xk1xtw/InQ3Bp10gDIvZgXiW/mIhiUaHB8dszqdUloem5g/Z0JhJFLLe3ySRVlN9orMq BvDSadGJQBjsSCRD4UG5SDW188nXZNd+MPRI0Z5dLhs9NTo6LQlXUCMa+4PzieBW5SsQ hFAAnKbwTvATJo39tLgkyvx6/TjY+w6hTbLbJNpI+uTdsNHKnb/oJM21TtdLQQIxi0UU DkPCAFTTzFHexXbEHc1UAKWVjLgDvL6ix6UgYvJL67q9l0GDJQbYia7jhE2zhyqqa1as RPeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724936890; x=1725541690; 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=+jZ6sXXY3ruYgukQSFf93l5MM9Nloj31hS+qkqjlhPc=; b=HsrtdYa5c+4PwswbkYE3oSl8jupc64skKXv/aDzNxBq05oj6RGSfckQ88Ed/TmumVX OVjm7jdiUxlp9VuL0SNzosn7r2TcY1X5jyyLK7fiTERL+lYEnP+9xu5HkWCMB3dW022M a5tR49IETiAAF78v6YQ4cC8hu368kATMJ+OoyHmMOl9toOvHQ35gkrjhVWz6CFwq/zE7 NVKeKqVHvCOb0hrS+IG+3ahUh6m0fxvXYDGkdnCkq3CX/i+mqGrV/qsTv6Yj/gIO0xZX nVMNRW/BjrzxYSKoTRTG0K+dSH9HLQSRvyYTNTUjjrzm7neb2x2VgRB6rDSGZCtiHQna wuew== X-Gm-Message-State: AOJu0YwNyOgW8dOCYTKTIDtDoEeuFO37/XBtQp3Z561damjOO+uOFzSM 8V19v6Y2FTZLG7Zm/NdFbV83cS3bPo4CyCTm4ttD4W9O6diAvFZYVqadKa20CYo2YMq3ykWxWLo = X-Google-Smtp-Source: AGHT+IEU7G/jHnNA4duQbb6u0Xxa/iddR1ciYsDO5d/ixqYHZr41PylXdlPiUHJ8JZOvFS00849k+Q== X-Received: by 2002:a05:600c:1914:b0:428:e820:37b6 with SMTP id 5b1f17b1804b1-42bb020b3e6mr29271105e9.31.1724936890192; Thu, 29 Aug 2024 06:08:10 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:5e2c:51b0:ac4a:92ca]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bb6deb2f5sm17074605e9.2.2024.08.29.06.08.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 06:08:09 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Viljar Indus Subject: [COMMITTED 08/17] ada: Parse the attributes of continuation messages correctly Date: Thu, 29 Aug 2024 15:07:38 +0200 Message-ID: <20240829130750.1651060-8-poulhies@adacore.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829130750.1651060-1-poulhies@adacore.com> References: <20240829130750.1651060-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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org From: Viljar Indus Currently unless pretty printing is enabled we avoid parsing the message strings for continuation messages. This leads to inconsistent state for the Error_Msg_Object-s that are being created. gcc/ada/ * erroutc.adb (Prescan_Message): Avoid not parsing all of the message attributes. * erroutc.ads: Update the documentation. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/erroutc.adb | 27 ++++++++++++++++++++++++--- gcc/ada/erroutc.ads | 3 +-- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/gcc/ada/erroutc.adb b/gcc/ada/erroutc.adb index 2ce3505959f..4e0a9f26e0d 100644 --- a/gcc/ada/erroutc.adb +++ b/gcc/ada/erroutc.adb @@ -922,15 +922,36 @@ package body Erroutc is -- Start of processing for Prescan_Message begin - -- Nothing to do for continuation line, unless -gnatdF is set + -- Continuation lines need to check only for insertion sequences. + -- Other attributes should be inherited from the main message. + + if Msg (Msg'First) = '\' then + Has_Insertion_Line := False; + + J := Msg'First; + + -- If we have a quote, don't look at following character + + while J <= Msg'Last loop + if Msg (J) = ''' then + J := J + 2; + + -- Insertion line (# insertion) + + elsif Msg (J) = '#' then + Has_Insertion_Line := True; + J := J + 1; + else + J := J + 1; + end if; + end loop; - if not Debug_Flag_FF and then Msg (Msg'First) = '\' then return; -- Some global variables are not set for continuation messages, as they -- only make sense for the initial message. - elsif Msg (Msg'First) /= '\' then + else -- Set initial values of globals (may be changed during scan) diff --git a/gcc/ada/erroutc.ads b/gcc/ada/erroutc.ads index effc667bb5d..0a52af5033c 100644 --- a/gcc/ada/erroutc.ads +++ b/gcc/ada/erroutc.ads @@ -555,8 +555,7 @@ package Erroutc is -- test these values before doing the full error scan. -- -- Note that the call has no effect for continuation messages (those whose - -- first character is '\'), and all variables are left unchanged, unless - -- -gnatdF is set. + -- first character is '\') except for the Has_Insertion_Line setting. procedure Purge_Messages (From : Source_Ptr; To : Source_Ptr); -- All error messages whose location is in the range From .. To (not From patchwork Thu Aug 29 13:07:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 1978425 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=E5wFi6Rc; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WvhT2321tz1yXd for ; Thu, 29 Aug 2024 23:09:42 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9C27D385F025 for ; Thu, 29 Aug 2024 13:09:40 +0000 (GMT) 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 383C7385F01D for ; Thu, 29 Aug 2024 13:08:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 383C7385F01D 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 383C7385F01D 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=1724936896; cv=none; b=LMsMmE8Pl1YJxeCVeEI14sx1ArAnL404LqnZ67bLDdGqoL/0rC6YI6LSKCuujZ8/8AejaU9951SE/4GiApJOBxDvmpZFt198n4nZHVmcJynB4Fk1TTYMpsuH/HE3/al9D74FNlqkTBrEwzRK4Wb5CimFNaGRv45ohxeYHhlGBDQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724936896; c=relaxed/simple; bh=csymKdHX8i4uT8hKAdwMJSvAagv3u/dtqJagax3T0Rc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=x3eeegQL61ZtojMtaLx2uuidjBwddMSOZ5ctYqOQ8EwQrE7mGS6d+5N6hOTGLsTT43Elr5w7yOTy8+hoAVv096aq+BR+Wf0KuOLtP4FAJnTkytB9ehAthz7QKK6QFcpKh3FNKi6EMlUunEDI9n0l5tQAIYT9JhqmmZYBGpHUjo4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-42bb8cf8abeso2404035e9.2 for ; Thu, 29 Aug 2024 06:08:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1724936892; x=1725541692; 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=5SjIVFBAHxwj7uIhuVp6fd0w8NTKR7NHubtT09cu+fc=; b=E5wFi6RcLwZGSkdQBR+XljR+9u4jEB6QeMkTxjCw3Ig+u4rr88ye9L4lKjPBTITc6R 2hHi9q8XW+idE5bpoAVCUoq6X/Lsul/3zI0u5quWjS373yjkEMMnpxZ7OiTBcjqYkL+4 xP1JC7ZMewPTr7d9SY/25AbvAM7QnjawR+R1jCtbFqho2lK8ae0E0J5hIMdqEsASst5Z QhNgQ2/bQ1Mq2au+MN6MOn4dtCSqVmI5BAD0a825+MONhBLeKD94Huv1TQUoYEJrEGHs L5VNugFQiE5qpWNc0b+yicRyOlSmKKCJv+42tRBeizQt4lRwOEUR2X5gVAJSmUO9UZi4 4hcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724936892; x=1725541692; 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=5SjIVFBAHxwj7uIhuVp6fd0w8NTKR7NHubtT09cu+fc=; b=UjF/1DlFqKNEclDE5xx7E1cIhoYHUGK0XCBeNkvs8l5QP9ARGW6y7f67iswWH6FWUM zhXdyfTvpnacv7yZplnTsdBFyyXpTqe7HedLfxmkurekQAB13vrZRY51+sX8UJ/AON5M LxAJQwwlcaL67u+8b6i1AgfAdRaSe9Gs/Z2kTw3f2yQeI9350r7hZhH7jTNCXC9Iqv5p sumVQL6YJ3zrPPw1qX3Q4DnpXFKwP7g5YwAe7ZojTaEQKSjBe8ZxsDng8Prqt9RsmKFF pPQM7/+YoRyNjHizY1zH26gFVNn4qadf2JXZNs0RshomJeCNwJydG1tMwCvjvGBz/+10 E3CA== X-Gm-Message-State: AOJu0YzNWeh/cr9o80qgSXDk60reEmOyY7RZrAWM5WSebjlIo6dF/FYT 5oUAIsQOswF20A9xP94kNPn4zYkwlYzYHck8PHDtzldILGnIxVpPNxnukkAJxaSfj73Fly7uhB0 = X-Google-Smtp-Source: AGHT+IG9Wl3YseGVdY2Rw+KnI8oSTl7NLTPCSRj+G23zGAFiPLrB2QTZscmUaHSkOUlECLZr469wrg== X-Received: by 2002:a05:600c:4f42:b0:427:9a8f:9717 with SMTP id 5b1f17b1804b1-42bb0137641mr25012765e9.0.1724936890994; Thu, 29 Aug 2024 06:08:10 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:5e2c:51b0:ac4a:92ca]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bb6deb2f5sm17074605e9.2.2024.08.29.06.08.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 06:08:10 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Viljar Indus Subject: [COMMITTED 09/17] ada: Avoid creating continuation messages without an intended parent Date: Thu, 29 Aug 2024 15:07:39 +0200 Message-ID: <20240829130750.1651060-9-poulhies@adacore.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829130750.1651060-1-poulhies@adacore.com> References: <20240829130750.1651060-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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org From: Viljar Indus The messages modified in this patch do not have a clear intended parent. This causes a lot of issues when grouping continuation messages together with their parent. This can be confusing as it is not obvious what was the parent message that caused this problem or in worst case scenarios the message not being printed alltogether. These modified messages do not seem to be related to any concrete error message and thus should be treated as independent messages. gcc/ada/ * sem_ch12.adb (Abandon_Instantiation): Remove continuation characters from the error message. * sem_ch13.adb (Check_False_Aspect_For_Derived_Type): Remove continuation characters from the error message. * sem_ch6.adb (Assert_False): Avoid creating a continuation message without a parent. If no primary message is created then the message is considered as primary. gcc/testsuite/ChangeLog: * gnat.dg/interface6.adb: Adjust test. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch12.adb | 2 +- gcc/ada/sem_ch13.adb | 2 +- gcc/ada/sem_ch6.adb | 12 +++++++++--- gcc/testsuite/gnat.dg/interface6.adb | 1 + 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 686aa3208fb..b406cfce3b3 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -2295,7 +2295,7 @@ package body Sem_Ch12 is procedure Abandon_Instantiation (N : Node_Id) is begin - Error_Msg_N ("\instantiation abandoned!", N); + Error_Msg_N ("instantiation abandoned!", N); raise Instantiation_Error; end Abandon_Instantiation; diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index a55ba3c7bd9..5cea155dc1e 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -1247,7 +1247,7 @@ package body Sem_Ch13 is if Etype (Expression (ASN)) = Any_Type then Error_Msg_NE - ("\aspect must be fully defined before & is frozen", + ("aspect must be fully defined before & is frozen", ASN, E); end if; diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 461bdfcbe4b..86d784543f3 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -7361,6 +7361,8 @@ package body Sem_Ch6 is Error_Msg_N ("implied return after this statement would have raised " & "Program_Error", Last_Stm); + Error_Msg_NE + ("\procedure & is marked as No_Return!", Last_Stm, Proc); -- In normal compilation mode, do not warn on a generated call -- (e.g. in the body of a renaming as completion). @@ -7369,11 +7371,15 @@ package body Sem_Ch6 is Error_Msg_N ("implied return after this statement will raise " & "Program_Error??", Last_Stm); + + Error_Msg_NE + ("\procedure & is marked as No_Return??!", Last_Stm, Proc); + else + + Error_Msg_NE + ("procedure & is marked as No_Return!", Last_Stm, Proc); end if; - Error_Msg_Warn := SPARK_Mode /= On; - Error_Msg_NE - ("\procedure & is marked as No_Return< Rec_Type); -- { dg-error "actual must implement all interfaces of formal \"T\"" } procedure Test_Instance1 is new Test (T => Rec_Type1); -- { dg-error "actual \"Rec_Type1\" must implement interface \"TI2\"" } + -- { dg-error "instantiation abandoned" "" { target *-*-* } 37 } procedure Test_Instance2 is new Test (T => Rec_Type2); procedure Test_Instance12 is new Test (T => Rec_Type12); From patchwork Thu Aug 29 13:07:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 1978433 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=IwHPXdE9; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WvhWX6p9bz1yfn for ; Thu, 29 Aug 2024 23:11:52 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C79783865464 for ; Thu, 29 Aug 2024 13:11:50 +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 9D1B1386102D for ; Thu, 29 Aug 2024 13:08:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9D1B1386102D 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 9D1B1386102D 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=1724936898; cv=none; b=bHeSr4Lqv9zNOyg02LcneV/sTCisMukMc6co1DV4t49jPo1l/g1SF1NB1PcacOgCdkNimsmGQFClLd8SrrWSODXwxspbaOb7riUUpuvrRgWjQdCx6exnZJqTdZJ417DHbJO0I4/prFdCIRzKp1SaWErk4YpOOaEp+YckSHaqTtQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724936898; c=relaxed/simple; bh=vQvOok5kXhcQefvtoelNs5YtqTGPdY8KNxVJF0CMys4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=nMrrFIZ/A96PCkLlLMEmsmlg1rDEM2YQCDFPCsZ+B8LhH88Jq864QFyK6Z62goGQHiYEHsw7vaTcyzt9wZoxcQ8kBp36AYAG6tzZzytAbc/r67bet06f5O1NrD+PJZeL6L5NWfJ6oUaOj8fyY6UOXwnLz9w4xvS2dGvDtSXtgGI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-428e0d184b4so5423765e9.2 for ; Thu, 29 Aug 2024 06:08:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1724936892; x=1725541692; 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=0DO4fedVxoOvfNFuQHDsmryJ0YIc/4W1kaGfIkzxunc=; b=IwHPXdE9nPOMxyKKM0vePOKikDhnAPsWhG1E1tFxdXx4tWCfxXJm+HBE84OAR0gfbW atNHzxRBZ1gwN4w6okB5UyFG+R79ajtS1zM6Elhbd3jpp1SvT8KxBdPtODWzKMex/XqU XUmWUC4SJclMtNdxT/puOkDk6odrHW4OeiYknWpvwcZfA7rGh62jvmlGDueNhI8x/UEO oIPZyqsAOr2ylnd2/3p4XcC4LDgwRaFz8yktOdA7f8imKoLhBRsCC38sT0SOndc8palk JH+dZPWbBlMrSBmJM7+OvYszuV50G0l1MZ3X5REk4t7LkOwEAT2TwkqDCcH9xoD/B5MH D1Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724936892; x=1725541692; 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=0DO4fedVxoOvfNFuQHDsmryJ0YIc/4W1kaGfIkzxunc=; b=iGw5ymlvlL0Emss+Fa2xyk+XLx1PR1zzkK0UkwjzdWfIZBoes2VnUU3Z8V6DRvQoSU pR3da7Hmt+Zg0E6+150efPthv2XRTka9KZNsrbNwj6s/xMktIn2i9kFd7cLDT+vTxp9s oeYjS8WCbd/KdaNuG7L5Ii8rHGcGztYM3zLWDS2DUAipPAWb3hTZfAyg4J29C6lhUFhS IB9rnlvus4QieCRhTBLG7xYi6EpeiYUibIru0Lbe7dQMXVXCB8pF90o0ZuQk6/i6tCRF hinBmXTOiKZRh6hvLRJp5A2i/GzBQKzBVHGa3ILIAkggATZpi/cgThM4oBfxPTTop2H1 YaRQ== X-Gm-Message-State: AOJu0Yx7X0fNhXt626DN2Z2cCw1QYPjdrauRCmBTC/jQxq/U6Jv1sxmc 1gf71u0FeJU9bGaWvvjUjjuT0214XAIB/FgK+YqsQqM5LrCQzl8iPtFcpGzn88/qCbhf+a+AGdE = X-Google-Smtp-Source: AGHT+IFFOx2RYJmESiMugz4zBbBsjI17axT6ExoqxHyFuGap8kz18CNM8bQfTHoT6F+6wEOzq4bUBw== X-Received: by 2002:a05:600c:1c9c:b0:428:314:f08e with SMTP id 5b1f17b1804b1-42bb02c1dc4mr23029145e9.5.1724936891878; Thu, 29 Aug 2024 06:08:11 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:5e2c:51b0:ac4a:92ca]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bb6deb2f5sm17074605e9.2.2024.08.29.06.08.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 06:08:11 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Viljar Indus Subject: [COMMITTED 10/17] ada: Improve Inspection_Point warning Date: Thu, 29 Aug 2024 15:07:40 +0200 Message-ID: <20240829130750.1651060-10-poulhies@adacore.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829130750.1651060-1-poulhies@adacore.com> References: <20240829130750.1651060-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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org From: Viljar Indus Ensure that the primary and sub message point to the same location in order to assure that the submessages get pretty printed in the correct order. gcc/ada/ * exp_prag.adb (Expand_Pragma_Inspection_Point): Improve sub diagnostic generation. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_prag.adb | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/gcc/ada/exp_prag.adb b/gcc/ada/exp_prag.adb index 2c054d1b967..6c328ef36ce 100644 --- a/gcc/ada/exp_prag.adb +++ b/gcc/ada/exp_prag.adb @@ -2519,11 +2519,11 @@ package body Exp_Prag is procedure Expand_Pragma_Inspection_Point (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); - A : List_Id; - Assoc : Node_Id; - E : Entity_Id; - Rip : Boolean; - S : Entity_Id; + A : List_Id; + Assoc : Node_Id; + Faulty_Arg : Node_Id := Empty; + E : Entity_Id; + S : Entity_Id; begin if No (Pragma_Argument_Associations (N)) then @@ -2556,7 +2556,6 @@ package body Exp_Prag is -- Process the arguments of the pragma - Rip := False; Assoc := First (Pragma_Argument_Associations (N)); while Present (Assoc) loop -- The back end may need to take the address of the object @@ -2574,7 +2573,7 @@ package body Exp_Prag is ("??inspection point references unfrozen object &", Assoc, Entity (Expression (Assoc))); - Rip := True; + Faulty_Arg := Assoc; end if; Next (Assoc); @@ -2582,8 +2581,10 @@ package body Exp_Prag is -- When the above requirement isn't met, turn the pragma into a no-op - if Rip then - Error_Msg_N ("\pragma will be ignored", N); + if Present (Faulty_Arg) then + Error_Msg_Sloc := Sloc (Faulty_Arg); + Error_Msg_N ("\pragma Inspection_Point # will be ignored", + Faulty_Arg); -- We can't just remove the pragma from the tree as it might be -- iterated over by the caller. Turn it into a null statement From patchwork Thu Aug 29 13:07:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 1978444 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=Hv2WfS3k; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WvhZr5Z2Bz1yfn for ; Thu, 29 Aug 2024 23:14:44 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9B9E0386102D for ; Thu, 29 Aug 2024 13:14:42 +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 488543861005 for ; Thu, 29 Aug 2024 13:08:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 488543861005 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 488543861005 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=1724936899; cv=none; b=JIyBWpjYoQBLkZhrpyN5MSREY7e7ZOWHnK/fvXWkl945bL+znoWAlfs/bmAW3JgyKCGWziPdQHU7wXNaGJbxeOpm/UyEVZvIdZ42w/se0hUb4mZ4UsWlrCfuu/5bwT3nbbOTHSR4vGZ4NeaR15P2Z+NcfiChmMofNiB+6QTwT5w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724936899; c=relaxed/simple; bh=8wy/oaT1gBTWczlItW10ugq+X7h4KSiVLLLXNrmggMk=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ptZvo5fOOvrQKtY6L5IpeZfbW3yPmRo3M9IVA5gOgYrpypSjfp1jrCt8AM80MO7F4AqmAdjFioWJmHoFydD07AVxZuA7tEeT3qKpu+/O+gkyH+QaOvgoFj73aPxAn29CvlcuO+7Ws+geTloUZLgFeoKQxwWl874CRjAbXhuWUGo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-42bb885f97eso1876565e9.0 for ; Thu, 29 Aug 2024 06:08:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1724936894; x=1725541694; 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=kjk2xbOg13a/x59jleep/ue9CJYunaIRVEIepwY5NzA=; b=Hv2WfS3kdCUbfG9qax4t1sZ2V+Kt7ZdW3zuqFe/f0QY0tlhJZvKAsDPYCIUC9BEBva XSjCHMbRv9c2T0RIRPzylb5TpM+v4uUHYW6KbNVQ22YES2LKQV8M6Z4B1qON86wIL4KY TVPEpnN/FIa5BUHO68sGa1pyen9W8g09t5l7YVshRF1yJ34yxfZQFKwL++bFf2AfFCfH RcsX7rHxEwVtp0tS6Stnful/ChIco5q5rX3cWAHo544FlcFbU+H11Qgcuu/U541FdMAM EkRDxUSe9ckzJM2vFhMjOHA6ZC0rB+AYXpwOGo3l9HtYIo1Q5oe6eijJV5b1p0X/ZNj0 W25g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724936894; x=1725541694; 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=kjk2xbOg13a/x59jleep/ue9CJYunaIRVEIepwY5NzA=; b=jJIlhiL19QfdGZR3GhYXDwgzvtIbhPJm4oFyQd75i6O2uPtenqGG99IA5Ji0QkIg8B PGfgxMJLejUZ+mw4/tlWHdUuqPMOojBE43I17jU/ruW2qRMV/7/amHq35uFkWI17jnvk YotWGgT507EK3ksYgd3X9swTcHK9OzgMODzWCptO/9+VAC/kUn0vnibkj6I/sxcYAxvy rZ0UPmMh/u1DVApQPJ9YU29d5Hj6cseGjEIOvH4UmDUB6g/b8kbjK6M706IWM8eS8/S9 lVTvKooyd85KBW1AFhxzk2H1sWAsPutQHVxFW3dw7atibJ93US236IyTpoCLoo6bsb1x 0ocQ== X-Gm-Message-State: AOJu0YwNXAENfTQ0P+fD+g9xX0j6bUreYtQMh7MVNoHo2msOlCBTNNda nssEdSDrI+KaF4lPEmUbAUCwHGhDzLjfDeDuhj1mU5rFcPGynbF5ZrNE6m7ZHiHuC47uOIPGt+c = X-Google-Smtp-Source: AGHT+IFOLhO/pT9Gap3MHtz7ZUkXikKd2Fph4rLuesw6SG2tdstklO1WUrKqw8Gs43KHEe9l8OjVrQ== X-Received: by 2002:a05:600c:4f44:b0:426:63bc:f031 with SMTP id 5b1f17b1804b1-42bb74112femr14409065e9.1.1724936893782; Thu, 29 Aug 2024 06:08:13 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:5e2c:51b0:ac4a:92ca]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bb6deb2f5sm17074605e9.2.2024.08.29.06.08.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 06:08:13 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Viljar Indus Subject: [COMMITTED 11/17] ada: Restructure continuation message for pretty printing Date: Thu, 29 Aug 2024 15:07:41 +0200 Message-ID: <20240829130750.1651060-11-poulhies@adacore.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829130750.1651060-1-poulhies@adacore.com> References: <20240829130750.1651060-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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org From: Viljar Indus Continuation messages should have the same location as the main message. If the goal is to point to a different location then Error_Msg_Sloc should be used to change the location of the continuation message. gcc/ada/ * par-ch4.adb (P_Name): Use Error_Msg_Sloc for the location of the continuation message. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/par-ch4.adb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/ada/par-ch4.adb b/gcc/ada/par-ch4.adb index 8b491c2cfd7..e76b0d8bea6 100644 --- a/gcc/ada/par-ch4.adb +++ b/gcc/ada/par-ch4.adb @@ -218,6 +218,8 @@ package body Ch4 is Arg_List : List_Id := No_List; -- kill junk warning Attr_Name : Name_Id := No_Name; -- kill junk warning + Error_Loc : Source_Ptr; + begin -- Case of not a name @@ -889,13 +891,16 @@ package body Ch4 is ("positional parameter association " & "not allowed after named one"); + Error_Loc := Token_Ptr; + Expr_Node := P_Expression_If_OK; -- Leaving the '>' in an association is not unusual, so suggest -- a possible fix. if Nkind (Expr_Node) = N_Op_Eq then - Error_Msg_N ("\maybe `='>` was intended", Expr_Node); + Error_Msg_Sloc := Sloc (Expr_Node); + Error_Msg ("\maybe `='>` was intended #", Error_Loc); end if; -- We go back to scanning out expressions, so that we do not get From patchwork Thu Aug 29 13:07:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 1978427 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=hI33TIoo; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WvhTy23CQz1yfn for ; Thu, 29 Aug 2024 23:10:30 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 138E73861034 for ; Thu, 29 Aug 2024 13:10:28 +0000 (GMT) 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 A57D03860C3B for ; Thu, 29 Aug 2024 13:08:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A57D03860C3B 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 A57D03860C3B 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=1724936899; cv=none; b=l+grrADfuTKX7ms8dGH9Nrgmw1ClhPnWXrP2KdZxox2YWAWnJkjm0+O4oCfnz3DK20ObG5lHR3yW72++QtPVkhESRr6kiYyOrPg+7FWiOA1YhY76Kygy/xsLo4FESh4MIphOpoN9bVxxEfi01j8sDX38EM4MAR1RBAS6ndrlum8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724936899; c=relaxed/simple; bh=jwAF9pAz0vQ+t4aWCZnTU9IRaIpoXv8Z5sDKb+nOmHs=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=pyL5YILUAsKIAqAU7dZP3cuAwz/Iq01EkrdAc409pADoW9FonaoZXgxv0fBNvwlFMmL5JBXuD/mYEX5PDDg7clv+ym48YBbAqZaMmYgDZP4UzzFfWjTVfE3ahB3SGHU677ry6zMFkG86d4pLuYsaL9zl4cPeVkFhPMNgS8gDkCI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-428178fc07eso5411735e9.3 for ; Thu, 29 Aug 2024 06:08:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1724936895; x=1725541695; 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=RL91gles5PRgc7Dc/r0dp8sg74OvRvxvUycKdV8Kchc=; b=hI33TIooK2/5k95yk7Y6drS1z+TR9bj/EMRoc8ZPv6veiB8Urbo+zDPArHtDzVCx1W vPxhFUqQlP7zAExE9VsQV5Bg47Tcd+S67PkknI7U2W4vCXPYG8vGejZ7HrNdNM/ACdFW DDSnJg/Mt6NN5fj/RMp8oNtIxk9OIrEbPcAyqqMJCp7yqEnbdkppro/kKJSkL67c+lNH sDGXf4XyGTplXoJMBlCOgJQyqrU/PweQ7yHrB0BYcxe/HlhAkLmmyXwWbOqBC6kmEC3G gfNuvPE8W06LEa5Xoem4wcHk3tlAur84rlxo3WPb4juIkdlbyg8sVYK9Avsz1uYXdLsT 8ZNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724936895; x=1725541695; 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=RL91gles5PRgc7Dc/r0dp8sg74OvRvxvUycKdV8Kchc=; b=oIYqievKhvSrAY0duw1w0HUWDWErti8/AJx0MYtG6rIAVnTVu7hUeeqIK4CJfYVZbp EiLk7Htg1YMYQt2iVzL/PPYmggqU7H6XnFDSG2tTB9dUjqYjPKCEc2Q2msmPwG9ArLrL AdZgvDp7b6KRIvxN3r/rDQFs+lSxivGKGKPwt18w50NZq3yB9Ok1GkwuAsLCo2Wz6k8b QqtfV+9y/yG5pcPlCOSffm+RjAlsm7NzZaQXEj16hKcxSOSW7IaRdmryPdzdIn+ijYDA D37ENVugGleRg1qKn9pgIvKQx5dmIvxaRPELRV1fDlr9iinFjiEdnzQ5zj8Z2fCgPS2x 0QCA== X-Gm-Message-State: AOJu0Yzm8+VZQ8SKl1kaNZ+sNsKJQQlTt7weac9H/Dt/5pHkUXntihAb 8wwfjdD8pGrvQ+xvCpRowC1+6UmegrUOaC0O3Q+/tFM1oW7Px1szmEJWPAxtf6L8THLqvR3wDJk = X-Google-Smtp-Source: AGHT+IELQ+JYkLDtAJjLlhLHa8cNCgyPv6qw6f4o1qYT20qb6v26xlDTSNUoeHDqp+53RrASXBDrlg== X-Received: by 2002:a05:600c:6d8c:b0:426:5dd0:a1ea with SMTP id 5b1f17b1804b1-42bb27a1015mr21835905e9.28.1724936894614; Thu, 29 Aug 2024 06:08:14 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:5e2c:51b0:ac4a:92ca]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bb6deb2f5sm17074605e9.2.2024.08.29.06.08.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 06:08:14 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Viljar Indus Subject: [COMMITTED 12/17] ada: Use the same warning character in continuation messages Date: Thu, 29 Aug 2024 15:07:42 +0200 Message-ID: <20240829130750.1651060-12-poulhies@adacore.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829130750.1651060-1-poulhies@adacore.com> References: <20240829130750.1651060-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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org From: Viljar Indus For consitency sake the main and continuation messages should use the same warning characters. gcc/ada/ * exp_aggr.adb (Expand_Range_Component): Remove extra warning character. Use same conditional warning char. * freeze.adb (Warn_Overlay): Use named warning character. * restrict.adb (Id_Case): Use named warning character. * sem_prag.adb (Rewrite_Assertion_Kind): Use default warning character. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_aggr.adb | 4 ++-- gcc/ada/freeze.adb | 4 ++-- gcc/ada/restrict.adb | 2 +- gcc/ada/sem_prag.adb | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index 83b88e7cf73..846665eae20 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -7276,9 +7276,9 @@ package body Exp_Aggr is Error_Msg_Warn := SPARK_Mode /= On; Error_Msg_N ("!empty aggregate returned by the empty function of a container" - & " aggregate<<<", Parent (N)); + & " aggregate<<", Parent (N)); Error_Msg_N - ("\this will result in infinite recursion??", Parent (N)); + ("\this will result in infinite recursion<<", Parent (N)); end if; --------------------------- diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index f7fc895055a..882c026455e 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -11100,7 +11100,7 @@ package body Freeze is then Error_Msg_NE ("\packed array component& " & - "will be initialized to zero??", + "will be initialized to zero?o?", Nam, Comp); exit; else @@ -11112,7 +11112,7 @@ package body Freeze is Error_Msg_N ("\use pragma Import for & to " & - "suppress initialization (RM B.1(24))??", + "suppress initialization (RM B.1(24))?o?", Nam); end if; end Warn_Overlay; diff --git a/gcc/ada/restrict.adb b/gcc/ada/restrict.adb index bda35d8f441..2e3cdde3d6e 100644 --- a/gcc/ada/restrict.adb +++ b/gcc/ada/restrict.adb @@ -1262,7 +1262,7 @@ package body Restrict is -- Set as warning if warning case if Restriction_Warnings (R) then - Add_Str ("??"); + Add_Str ("?*?"); end if; -- Set main message diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 87922816a9a..b139bd4cf4e 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -33719,7 +33719,7 @@ package body Sem_Prag is Error_Msg_N ("Check_Policy is a non-standard pragma??", N); Error_Msg_N ("\use Assertion_Policy and aspect names Pre/Post for " - & "Ada2012 conformance?", N); + & "Ada2012 conformance??", N); end if; return; From patchwork Thu Aug 29 13:07:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 1978445 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=QAY+ZmIw; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wvhbw5hx5z1yZ9 for ; Thu, 29 Aug 2024 23:15:40 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 80B3E3861029 for ; Thu, 29 Aug 2024 13:15:38 +0000 (GMT) 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 826143861029 for ; Thu, 29 Aug 2024 13:08:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 826143861029 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 826143861029 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=1724936899; cv=none; b=fdRq01ne39tSB+TymOiNY9pbA+WuU0gN3EPVVza3wNU+yh6J7usSEyzXLuxPmBnh6t2PEtg/UTt7CpXr7NwFmzxaB4U9s47XYkMvaz0vgcP51i6oW89kqhEcgSaa0PWvIbcEhYd7vTZJdjCgASTlEKx7PXiWDa2xbyBDasONZpw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724936899; c=relaxed/simple; bh=WwPnVfGGs8wFcCT+37C0RzGbRNqWGdOEM3gnuZpTigI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=gYMCejuk5EzE0Z+hPROiM32/tFXkp0I6uQi/nu6a+A+45rwHZdUamXp5OCEqwRQBGC8Doht/CLZRL3HQUyZLOLaihJdl9wsdwGTcRa5K1fER7Wr7wxROnzFaKr/iMr/mFY5/iYKIl7r5tW+ZQCqi3DsTyDQ4B0ZwsMe/b038afU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-42bb8cf8abeso2404955e9.2 for ; Thu, 29 Aug 2024 06:08:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1724936896; x=1725541696; 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=hVeK1/nh9f/QytC7OHq+BBJzHKhDo0igHt50ygc+wAc=; b=QAY+ZmIwYAhhtilA8QJu005ns+mgmfR5gCTPh5IpEIitNX1GLqIoHB3itOCQpvdX3e crQCRflT2umkCdaPkX8/H3ulJZZqor4KXGzMqWI15PoK6ml0n1skYgcu3U1BEpLRyfC3 BXUagXTy8UK3IFT9kGn48u2dawS1DcWje06R2PfnKTSE2IyQDWklMRIlFnOHKxbHCwFB ECRtorYoOzM7WRbEh+B3y9wlccmcmhQcvqTDA4OaOsL2/tL8ECI+RXE/eCE7FW170NjN JvnaFKcumq+fuSrj72UNsA9bXtavJo/MhSG5cv6XGVthSK3SLsw45Xe+RXIdnUwl5udG zKmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724936896; x=1725541696; 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=hVeK1/nh9f/QytC7OHq+BBJzHKhDo0igHt50ygc+wAc=; b=H1YjAccLtrNnZ/p4jKFMRQhdXZ/qQo9KMSv0u65gO15eiFdBdz5WqUkcNMEz5uooWC 7/Un7qk6GfLY+MEKPL8shVgqr91rzFmtqePGo18CjenfYiV4zGedn/R/Km0Pph7PPN/m 0xLzJSnQXTP49NEChz88T2nLWWSUIIxbj2f0WItDx+skzR8M4KKr/5BSHtKZkRNdjj28 so+ZK0/Q8SkcE921qVq7nlWo0Z2v+4DIht6VgHPX4u8moYzTfVEWcAqlHemfSzzPl02P kjwj1C9+dXByRG8AJdrDK3Azt4q5aPlHq8GSSA+9zziyunDJwU+h2+z5moYvQPLrXOuH Wj/Q== X-Gm-Message-State: AOJu0Yw0AmDtMl2k1DPG616PA8SaRqKCzCPxg1WLz948gTj30fZ5ffI6 EaJmLnUhUgg+W72c7OjvJy4pjUsrbH8vvuL8MOwcp0aH0lbkGJTrRcJYH6KjmusJI2YNClAGvhw = X-Google-Smtp-Source: AGHT+IH1BPWrIDRbdo4viKHbdkBVS8UkUGpD07WECx7x8hG9p+nRJzYHZsLKSku4YuEDw2iHUckS6A== X-Received: by 2002:a05:600c:3109:b0:426:62c5:473e with SMTP id 5b1f17b1804b1-42bb01e57ddmr22514425e9.26.1724936895813; Thu, 29 Aug 2024 06:08:15 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:5e2c:51b0:ac4a:92ca]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bb6deb2f5sm17074605e9.2.2024.08.29.06.08.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 06:08:15 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Viljar Indus Subject: [COMMITTED 13/17] ada: Print Insertion_Sloc in dmsg Date: Thu, 29 Aug 2024 15:07:43 +0200 Message-ID: <20240829130750.1651060-13-poulhies@adacore.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829130750.1651060-1-poulhies@adacore.com> References: <20240829130750.1651060-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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org From: Viljar Indus gcc/ada/ * erroutc.adb (dmsg): Print Insertion_Sloc. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/erroutc.adb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gcc/ada/erroutc.adb b/gcc/ada/erroutc.adb index 4e0a9f26e0d..db1c0923e90 100644 --- a/gcc/ada/erroutc.adb +++ b/gcc/ada/erroutc.adb @@ -327,6 +327,11 @@ package body Erroutc is Write_Location (E.Optr.Ptr); Write_Eol; + Write_Str + (" Insertion_Sloc = "); + Write_Location (E.Insertion_Sloc); + Write_Eol; + w (" Line = ", Int (E.Line)); w (" Col = ", Int (E.Col)); w (" Info = ", E.Info); From patchwork Thu Aug 29 13:07:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 1978431 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=CJS2d2O3; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WvhWF5QcMz1yfn for ; Thu, 29 Aug 2024 23:11:37 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 910043861016 for ; Thu, 29 Aug 2024 13:11:35 +0000 (GMT) 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 B6DF43861032 for ; Thu, 29 Aug 2024 13:08:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B6DF43861032 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 B6DF43861032 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=1724936900; cv=none; b=kj2OtM2Vi4jq7+rlPG3kvwNaj8fLZNu3PKXF6tA01NFU8HWT4iYxx7yK70R4s4999LJL/81hJffdEeDm1mg3yjgOLgsyWKDAilnY7E0QMb9EjoL9DaoX05FVJ01g11sJ7pnevBeCSaebYLhwNMS0mASfgZdkUn1Zn5hx1JlXOM8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724936900; c=relaxed/simple; bh=rlxxa4JFhel+JHQdMfbkGGapWsMcZcwiKXAy4YLcxCw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=P7tTnSQemDVb118G/0BuD3LPrt/YwSvPGNwuHabb18pZv8Q9CiCPOAIxM0SPzNcNMRy+AE2+nXrCDadax9hoAjAb1q3ocEPskmaOwWqLdT8Y3xJqeOoeaWSnTfDYnSNXAuTimZdW6SEWOiW38qj9sYOTWS7H+7gPmi98aLVdA9g= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-42bb8cf8abeso2405135e9.2 for ; Thu, 29 Aug 2024 06:08:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1724936897; x=1725541697; 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=MtlrOdNuxMGmUPBp+E0jwxW1qKlfZ8NpmySR2yQp6gE=; b=CJS2d2O3CLd1EqqTbZBBsyEOuqU81TS9NXRqbEpiisUQ40fnB0ebAcbuqW2FEyMWFT AgYdXt5peuBkRjhk7GDRmhMseBf9RlWayfqnvpOunzi/J6KRaSY5r6CtzhYO0dtTcKiY ip2UVO4vRM+sMun5/TfnHsfz9tU3kJKg81pZacvMrdd9ZrHAvJi1Hf6zhAeP1OoWHhJt WaTomc5+x/Sab5rydo8X2tvqQlth+wsgAHDWr4+M8bebc4RytXH0N2W47d06Dcfav0NG leUdOefgq35ogDvtL16df7OSgjc5q13/wxKHAaQyMo2PfR3xhSwc2zq9Ng2wqBX638ki 3TdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724936897; x=1725541697; 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=MtlrOdNuxMGmUPBp+E0jwxW1qKlfZ8NpmySR2yQp6gE=; b=bQ8XlM6MSkraWqFc0FgQtxxMtT/2BuinqhYZQE/gIg3iJ6eFmLcFn7394m2fD8w/7C /YQy7wNDKmFgJVaUUGJhsX/LZF4pnk0lY7BpGIelb4HwZam5h2W1rfwpBUiEwxZDgs4P 1tvmZBzldag6T/byuUauD9ZLX9Wdwl5Z2KLlkG2NGDhx6jOdXwUdCj60uO565RvJ+Y/K SZyAIQQgjloYcWIOV8SX6syN/nJXnOYrsyRjyVAAc4LfkIUV37Qn2ogoNGWkScxHWvlV 8kH6SwLkc4s1nfMhD/FL3iJHgq1RDOGN0hqE3xdylNU05UK2JvD4dVthgCY+AGOPR/BT UqrA== X-Gm-Message-State: AOJu0YyDgYQpewu6RBeh9Hm2cgmnZHiW9n4nLSZsazpkhMByI0iyGdLy OccFhEBwu9Obn10LBJLd2OpQnARx66M/mhjiRyfplQnbjuMJzOUAb8choSOtklouCywAsVDGZSM = X-Google-Smtp-Source: AGHT+IFGXxWTOjM9dboaIZTNDfC7bXRa9qRTrgwddd0ndQsqMqOGRXLAjMgUQUJtni50NBWWoBmP3A== X-Received: by 2002:a05:600c:4586:b0:427:9922:4526 with SMTP id 5b1f17b1804b1-42bb01ae423mr20431225e9.7.1724936896583; Thu, 29 Aug 2024 06:08:16 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:5e2c:51b0:ac4a:92ca]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bb6deb2f5sm17074605e9.2.2024.08.29.06.08.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 06:08:16 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 14/17] ada: Fix missing finalization for call to function returning limited view Date: Thu, 29 Aug 2024 15:07:44 +0200 Message-ID: <20240829130750.1651060-14-poulhies@adacore.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829130750.1651060-1-poulhies@adacore.com> References: <20240829130750.1651060-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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org From: Eric Botcazou The call is legal because it is made from the body, which has visibility on the nonlimited view, so this changes the code in Expand_Call_Helper to look at the Etype of the call node instead of the Etype of the function. gcc/ada/ * exp_ch6.adb (Expand_Call_Helper): In the case of a function call, look at the Etype of the call node to determine whether finalization actions need to be performed. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_ch6.adb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index 420d5f44a69..3c87c0e8220 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -5262,7 +5262,9 @@ package body Exp_Ch6 is -- function call is transformed into a reference to the result that has -- been built either on the primary or the secondary stack. - if Needs_Finalization (Etype (Subp)) then + if Nkind (Call_Node) = N_Function_Call + and then Needs_Finalization (Etype (Call_Node)) + then if not Is_Build_In_Place_Function_Call (Call_Node) and then (No (First_Formal (Subp)) @@ -5270,7 +5272,7 @@ package body Exp_Ch6 is not Is_Concurrent_Record_Type (Etype (First_Formal (Subp)))) then Expand_Ctrl_Function_Call - (Call_Node, Needs_Secondary_Stack (Etype (Subp))); + (Call_Node, Needs_Secondary_Stack (Etype (Call_Node))); -- Build-in-place function calls which appear in anonymous contexts -- need a transient scope to ensure the proper finalization of the @@ -5292,7 +5294,7 @@ package body Exp_Ch6 is Is_Build_In_Place_Function_Call (Parent (Call_Node))) then Establish_Transient_Scope - (Call_Node, Needs_Secondary_Stack (Etype (Subp))); + (Call_Node, Needs_Secondary_Stack (Etype (Call_Node))); end if; end if; end Expand_Call_Helper; From patchwork Thu Aug 29 13:07:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 1978432 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=efyKSnal; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WvhWG5Y8qz1yfn for ; Thu, 29 Aug 2024 23:11:38 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 922443861005 for ; Thu, 29 Aug 2024 13:11:36 +0000 (GMT) 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 1CE02386102F for ; Thu, 29 Aug 2024 13:08:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1CE02386102F 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 1CE02386102F 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=1724936903; cv=none; b=J9aOxlO/JjdoAcWrjufQnnOwdA8edOVdm08aO2Uo3wNgtGEXBN/M4dtm66AJrvE1RgiASPLtNr4ylMBOCFAkHVCaQQjzLgtLE2TfdfZFSZzVMJzFUnB14iPrtG/q3pYyO8LEi+AKyrkGpHOrztL+ReauQkTVPc7nfLcEQR7cjRE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724936903; c=relaxed/simple; bh=cyKh/81NSDNkY4hBd2u575Nu0QgbQVZsVAsZs0T0O2U=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=WmbRjUyFBCsgroX9pNB68k7lASWfm2ri1cpw/W6ZHta0tsLjd+x4YKten8/UdhOE80aWI9qhKP1KN2NLHLNgdinW/m/+D0M6t58HegeiY+Lcu/pD0KNW7N95iuB2UoGmo1Ar4bkpVTE1FESv+RwAPeJ6XyWTN+m/mu0vmiiTZNg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-429e29933aaso5515225e9.0 for ; Thu, 29 Aug 2024 06:08:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1724936898; x=1725541698; 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=k3ktjsOBZOnBbiCo4uBm9PI/1wsaKN2f13I/QAFCfyo=; b=efyKSnalaFjOY9T9nDpT0wrkRLim7O1BinBT0Z1SArIP+sj1dJu5o/ooEej7f1qLO1 PrbyWoMEQ76hI/aB4u8jBWQ+PgjAqcwmv8NxX6k+88Lpd+RCV2pJCDxE5Hh7XpsX/Zfd bGF9w49vgYm/OKnAcdbWjfFdl/4u52U5gNhGMOFbBlSdweChwxeJ2e4R0WL8Qp6TAVuF QOq6/MepftHYF7jZVZrsYQuVhQOSyMg6Xa5uqkkAWUKorN2po81fgbKuNAkeVHG+LvZw rF7abtmO5PEo6CaPk2GR7fzDAlud3oLDIOyrRgW7FfgJi6pGPywIzDrYEtIE9UQoI7o1 DX1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724936898; x=1725541698; 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=k3ktjsOBZOnBbiCo4uBm9PI/1wsaKN2f13I/QAFCfyo=; b=KFALlfKDUUetmXItZJbeoClAL3yTQ3j+rE0RSfdgN6ncPjYR642LRu8UBZj0yaBwsD tT8A6LmL2B/v3xy3DtMFEJAOtZplmi0lFKhlLWNT4b2uTCaKBntFqpqhUeimaiw4ddA3 ZXpmgf4M0UjL7kWTIzKLOldXmE2gCHFg4jyn5XCRij3eikawdHQywJ6iQZOjGi9/favV Rl1CBWxYrQbdS+FCHblEvj3bBwZrAkmka7jgxYVN9NGyPa+hOY2ss/F7t6Wo7SIURyDv oshzg2E0BWenqxpSdRlD0ADGw1rQvjq3omM09M/i/8k6Wr+rnKUMDo2+3PIIhLkok9JR poVA== X-Gm-Message-State: AOJu0Yx2JG+ZeBB/BpvhmcdXYmCa/yao5ICjHtQ8PRBsYgE9QgY8033n TglCJ+Mh/t7lAOF51cHfLXvHtwOvHlfczf3ds8x78XRNlX1n/41onyW1U7J364NV8aP4Cf3oMCg = X-Google-Smtp-Source: AGHT+IFCggbTgsObFZs9aQQxhCuYhbPcJSAG6BJJzYzSS4rHLK372krpDAJVsOTJvUw3owfJt9c83A== X-Received: by 2002:a05:600c:1e10:b0:426:6822:855 with SMTP id 5b1f17b1804b1-42bb27b33c7mr19451225e9.36.1724936897561; Thu, 29 Aug 2024 06:08:17 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:5e2c:51b0:ac4a:92ca]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bb6deb2f5sm17074605e9.2.2024.08.29.06.08.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 06:08:16 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Steve Baird Subject: [COMMITTED 15/17] ada: Missing legality check when type completed Date: Thu, 29 Aug 2024 15:07:45 +0200 Message-ID: <20240829130750.1651060-15-poulhies@adacore.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829130750.1651060-1-poulhies@adacore.com> References: <20240829130750.1651060-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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org From: Steve Baird Refine previous fix to better handle tagged cases. gcc/ada/ * sem_ch6.adb (Check_Discriminant_Conformance): Immediately after calling Is_Immutably_Limited_Type, perform an additional test that one might reasonably imagine would instead have been part of Is_Immutably_Limited_Type. The new test is a call to a new function Has_Tagged_Limited_Partial_View whose implementation includes a call to Incomplete_Or_Partial_View, which cannot be easily be called from Is_Immutably_Limited_Type (because sem_aux, which is in the closure of the binder, cannot easily "with" sem_util). * sem_aux.adb (Is_Immutably_Limited): Include N_Derived_Type_Definition case when testing Limited_Present flag. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_aux.adb | 8 ++++---- gcc/ada/sem_ch6.adb | 26 ++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/gcc/ada/sem_aux.adb b/gcc/ada/sem_aux.adb index 9903a2b6a16..5edf6675474 100644 --- a/gcc/ada/sem_aux.adb +++ b/gcc/ada/sem_aux.adb @@ -1118,12 +1118,12 @@ package body Sem_Aux is elsif Is_Private_Type (Btype) then - -- If Ent occurs in the completion of a limited private type, then - -- look for the word "limited" in the full view. + -- If Ent occurs in the completion of a private type, then + -- look for the word "limited" in the full view. if Nkind (Parent (Ent)) = N_Full_Type_Declaration - and then Nkind (Type_Definition (Parent (Ent))) = - N_Record_Definition + and then Nkind (Type_Definition (Parent (Ent))) in + N_Record_Definition | N_Derived_Type_Definition and then Limited_Present (Type_Definition (Parent (Ent))) then return True; diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 86d784543f3..076fb89c7b5 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -6432,6 +6432,25 @@ package body Sem_Ch6 is OldD : constant Boolean := Present (Expression (Parent (Old_Discr))); + function Has_Tagged_Limited_Partial_View + (Typ : Entity_Id) return Boolean; + -- Returns True iff Typ has a tagged limited partial view. + + ------------------------------------- + -- Has_Tagged_Limited_Partial_View -- + ------------------------------------- + + function Has_Tagged_Limited_Partial_View + (Typ : Entity_Id) return Boolean + is + Priv : constant Entity_Id := Incomplete_Or_Partial_View (Typ); + begin + return Present (Priv) + and then not Is_Incomplete_Type (Priv) + and then Is_Tagged_Type (Priv) + and then Limited_Present (Parent (Priv)); + end Has_Tagged_Limited_Partial_View; + begin if NewD or OldD then @@ -6463,6 +6482,13 @@ package body Sem_Ch6 is N_Access_Definition and then not Is_Immutably_Limited_Type (Defining_Identifier (N)) + + -- Check for a case that would be awkward to handle in + -- Is_Immutably_Limited_Type (because sem_aux can't + -- "with" sem_util). + + and then not Has_Tagged_Limited_Partial_View + (Defining_Identifier (N)) then Error_Msg_N ("(Ada 2005) default value for access discriminant " From patchwork Thu Aug 29 13:07:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 1978436 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=k4o8fjZX; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WvhXb6hZhz1yfy for ; Thu, 29 Aug 2024 23:12:47 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C2B383860C2D for ; Thu, 29 Aug 2024 13:12:45 +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 4FF123860C2D for ; Thu, 29 Aug 2024 13:08:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4FF123860C2D 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 4FF123860C2D 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=1724936904; cv=none; b=NVlrCUuxjnB64RiSAa4v/lak50fSSMmUyN2ojOVMfoJnMkvS4vJIf8hzX2jOucbf10p87nuDFDbyudNXDu5/KXrzcsnQxrgcrHA+j5zZY3pJyHyPIOtPZ2iDDJgFeDtwlx0uK7U5h8ouF69X07/lN84QyXf0f6pST2yUfxt6zG0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724936904; c=relaxed/simple; bh=3yjAWW2eocGbajofkdM/fAIopYgXCax1z0cRg6o6yjU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=bPNQqoaINYVxYkO2wupKE8p5aVkuFlZp3HMHoX200TSaBSJOU7QHEovp416sHKbVEkw6w3zCjL4XOSbg2BUzW1himh9hMXsBev2eixdJrFMXWdBRkobEss6cMoVaWGo6II6riQYv+Gd2C0Xa+V1dsR7jQlyfcTZkVdtalIEzSGE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-428e0d18666so5692925e9.3 for ; Thu, 29 Aug 2024 06:08:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1724936899; x=1725541699; 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=iT0F+lul6aJM7481txcmgNwwzdCFadNxzRbgHfspAUM=; b=k4o8fjZXwd2CeKvpEmG8MhH0WMEEDa9vL/2gW5f9LBX39WC3jiuF3k8MJPDflp3GFn 40s+YT9XBY1Et9KYR+jh7g4rsBv4WwcA+cYlaXzHTjXrTcJ3plZ3EpafHV+62Wo2wQFK /CbZkjeSN9fPdCZPI8mLfPHpq6ozmN7EkevPB95dI/tqOLNLKEvNELcHLvu8KiAuN0oZ YWDpBjdgsjbHooZMPbMYFqxW40EhBQRtXc5r1QKUyU4J9JVpLTxwLOccKuyCQzT/js11 2YFxrc9U7V7eM5F88vJcDVESbnlXudjIo1twtkfCur/A4HhrHSYPKK6eJojwi6hbhm2L N0uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724936899; x=1725541699; 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=iT0F+lul6aJM7481txcmgNwwzdCFadNxzRbgHfspAUM=; b=kTgF2Esz4ApnpKcZo9UZ08S2g9ssd1C1vfHCvZfCAnDF5R2EH8Mpu2DsSLb+erbQG7 +3nZ3qXgxVbPCIUMAlHjA01TAHOQo3Hp5wwQlgzUzmDLbkILqhdN5/dWbbw+LHpDUTG6 FYe1+JBXWMWv0P/uLV/P3HSZsBNsndw68yReb5WNLSbDxU/1ovrRj2FySREOcLFnThgY lSDACiR3JQdEw+lMV+dREhTFVi7UzXS+IUd2dqZqMDwYySyc/l9n8j9mQIBcYhIybOzc EngJX8OO/S9dqn+QV9aQLhqn3s1/zTFJziCpHeQ+uFW6VzvspuXDv85F6CZrc1RgFJOy fQxw== X-Gm-Message-State: AOJu0Yyv/eARb7njKgxGrS5JDyJEWj+6zbVIP4lV0IxPLyPHHbl4D4vK FfvVmvVoc+VmlNCh1TBvYsMy273SYUSpMVY+vZlfLsF1QZDEKcFnQtuPX1ySAa0DLgSZwVvPCTY = X-Google-Smtp-Source: AGHT+IHt2cddhuiPZ0rpH3CoHCSJXQv0uQUqf+AqaS78NOUBOJ4FcRwqdrXJqD2UW2vQ48NRCI01ZA== X-Received: by 2002:a05:600c:4f07:b0:428:1fa1:7b92 with SMTP id 5b1f17b1804b1-42bb01c1584mr23350325e9.19.1724936898331; Thu, 29 Aug 2024 06:08:18 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:5e2c:51b0:ac4a:92ca]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bb6deb2f5sm17074605e9.2.2024.08.29.06.08.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 06:08:17 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 16/17] ada: Fix internal error on concatenation of discriminant-dependent component Date: Thu, 29 Aug 2024 15:07:46 +0200 Message-ID: <20240829130750.1651060-16-poulhies@adacore.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829130750.1651060-1-poulhies@adacore.com> References: <20240829130750.1651060-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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org From: Eric Botcazou This only occurs with optimization enabled, but the expanded code is always wrong because it reuses the formal parameter of an initialization procedure associated with a discriminant (a discriminal in GNAT parlance) outside of the initialization procedure. gcc/ada/ * checks.adb (Selected_Length_Checks.Get_E_Length): For a component of a record with discriminants and if the expression is a selected component, try to build an actual subtype from its prefix instead of from the discriminal. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/checks.adb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb index 2fb750c3ba4..5d7f4cca70a 100644 --- a/gcc/ada/checks.adb +++ b/gcc/ada/checks.adb @@ -9861,7 +9861,15 @@ package body Checks is if Ekind (Scope (E)) = E_Record_Type and then Has_Discriminants (Scope (E)) then - N := Build_Discriminal_Subtype_Of_Component (E); + -- If the expression is a selected component, in other words, + -- has a prefix, then build an actual subtype from the prefix. + -- Otherwise, build an actual subtype from the discriminal. + + if Nkind (Expr) = N_Selected_Component then + N := Build_Actual_Subtype_Of_Component (E, Expr); + else + N := Build_Discriminal_Subtype_Of_Component (E); + end if; if Present (N) then Insert_Action (Expr, N); From patchwork Thu Aug 29 13:07:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 1978435 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=PA8lZ1gM; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WvhXW5ZWTz1yfn for ; Thu, 29 Aug 2024 23:12:43 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0C90B386074B for ; Thu, 29 Aug 2024 13:12:42 +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 BDBFE3861024 for ; Thu, 29 Aug 2024 13:08:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BDBFE3861024 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 BDBFE3861024 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=1724936904; cv=none; b=rY7f/AOd0vTZdvr6XE2GhjVgF4ofKVRyx55iMhgU6MG0/61pPiEjPkHesn7AbGpDkUF+bYLu5HGBSSN+AlqaowAKzpr1NUGBkFfHrCAWUXpWGL1y7trzTaKur6+E+L3pD/knmHAsCRc75sKuOESV97N9rukW3+ksUG/CE9Y/6P8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724936904; c=relaxed/simple; bh=+Gze0q4UIxzsBKTP4XO8RtsOVmBuGkKI3iSk1k4H+Mc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Btaqd1RErb4tgeB7lCB37soGTt80JSOS5Ec3/ohHqc+fYwVQ7Akqe1OjxTr83+SrUl/b2S6H+7I+43zbUkHf3kTZhpAy+02CEvqJlMKt50ud1TtwHZkp3KQqtpoCJA9Io6+PYoHLXs5+X53jclznSjQURxSjwvGFoPIyOV+8z5U= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-42bb72a5e0bso4953975e9.1 for ; Thu, 29 Aug 2024 06:08:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1724936899; x=1725541699; 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=IfVHWtOoFFoq1S5hHlr2DL6NvTDeIFeHMo+IRcp75zI=; b=PA8lZ1gMMuIr1fNfImM6zxMqGlQVxi8wlBOB037GgsyPigJnZjqyEpbBPRwPMu1/yq qWrtQkv8Zrdj/D24yN87atRv+jLdJvmJuVwcff6JfxlPdTms6wWud4p9JvlVwn+ynzF3 uwKv80pOkftc/HdAU4S6N2N0oGvX0j0jrvJVs+lu4ywGcC58FMwHymkZiNwbefGifPah tmHoojnDRoHFmEL9t8vyUHYRlgXTDY+4Lk/HbFmPMDqRyTnluAclRQWSHRRwBpR40aBi vDKmm755T8xw+MC8Hiq98vs1UiXDiT2kiHyTvqMEKb8me1fpKxX3sPYybtGH6pH/zxfE ZbUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724936899; x=1725541699; 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=IfVHWtOoFFoq1S5hHlr2DL6NvTDeIFeHMo+IRcp75zI=; b=oKGorR8koAvenCc0ONo6Nsu30aFWOLUH6tJ/9RBCHt8u2aWD7gl1ZKvCF1lpONcOhc mvEmeMBQiUWhA6oufvrMlhtr6YjzUxs5Hiak30ORsBJpqp5lkNoxBWCsUQSv0/ZpVVls VdtLlkPPKD4x/7yh+Sv/3Yu1SBtyT6GykAH/qkWrXMIULctGp3AtD3UhNdKg2pGuEPiY ZyaH3J1Hx5eWnVqS5Ucpx/CF81P4TF5M9vjmzYRTPEbgFGeGmVb50PxziwTqSSjVWWdM BIKYPCLVQ5M/Jrz5M5U25NY/OFLROykE/HJtaRAsDdnqeEvKY+JLL8hQSU6ldhZEI09d Jh5g== X-Gm-Message-State: AOJu0YzfNk1QLxXAnse5JRNdjXrDtgnwrkE3/Tgjj9sJWy9XIejmX9IB 6SGOc5fmVEFZDLQ6eWlJn2hLImsqblEFuyx/RuscAcMWh2+FFLQrIha0lJSwBjv5r1cQ3w+z5jo = X-Google-Smtp-Source: AGHT+IFW5zmVar4fFFDkiGMBDvlmt4BfDYnYamQ2eA47cVN2+1NbMIdegEmpPu0EOTcm57z97+7O3g== X-Received: by 2002:a05:600c:5102:b0:425:80d5:b8b2 with SMTP id 5b1f17b1804b1-42bb01bd7f2mr20580735e9.16.1724936899080; Thu, 29 Aug 2024 06:08:19 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:5e2c:51b0:ac4a:92ca]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bb6deb2f5sm17074605e9.2.2024.08.29.06.08.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 06:08:18 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 17/17] ada: Fix assertion failure on private limited with clause Date: Thu, 29 Aug 2024 15:07:47 +0200 Message-ID: <20240829130750.1651060-17-poulhies@adacore.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829130750.1651060-1-poulhies@adacore.com> References: <20240829130750.1651060-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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org From: Eric Botcazou This checks that the name is of an entity before accessing its Entity field. gcc/ada/ * sem_ch8.adb (Has_Private_With): Add test on Is_Entity_Name. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch8.adb | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index 99060061471..13c44c5e302 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -8980,6 +8980,7 @@ package body Sem_Ch8 is while Present (Item) loop if Nkind (Item) = N_With_Clause and then Private_Present (Item) + and then Is_Entity_Name (Name (Item)) and then Entity (Name (Item)) = E then return True;