From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1914) id 139DC38AA4E2; Tue, 12 Jul 2022 12:26:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 139DC38AA4E2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Pierre-Marie de Rodat To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-1638] [Ada] Fix confusing error expression on an unknown restriction X-Act-Checkin: gcc X-Git-Author: Piotr Trojanek X-Git-Refname: refs/heads/master X-Git-Oldrev: 3a7a02f4355bb81f7cb253fc900ad57c9503f5c7 X-Git-Newrev: 7e5a0317adbf1c9bc2ee5f6446bd161854c03373 Message-Id: <20220712122643.139DC38AA4E2@sourceware.org> Date: Tue, 12 Jul 2022 12:26:43 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2022 12:26:43 -0000 https://gcc.gnu.org/g:7e5a0317adbf1c9bc2ee5f6446bd161854c03373 commit r13-1638-g7e5a0317adbf1c9bc2ee5f6446bd161854c03373 Author: Piotr Trojanek Date: Thu Jun 23 13:09:51 2022 +0200 [Ada] Fix confusing error expression on an unknown restriction When pragma Restriction is used with an unknown restriction identifier, it is better to not process the restriction expression, as it will likely produce confusing error message. In particular, an odd message appeared when there was a typo in the restriction identifier whose expression requires special processing (e.g. No_Dependence_On instead of No_Dependence). gcc/ada/ * sem_prag.adb (Process_Restrictions_Or_Restriction_Warnings): Do not process expression of unknown restrictions. Diff: --- gcc/ada/sem_prag.adb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index a24d19eacbb..35910400cf9 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -10792,13 +10792,15 @@ package body Sem_Prag is else R_Id := Get_Restriction_Id (Process_Restriction_Synonyms (Arg)); - Analyze_And_Resolve (Expr, Any_Integer); if R_Id not in All_Parameter_Restrictions then Error_Pragma_Arg ("invalid restriction parameter identifier", Arg); + end if; + + Analyze_And_Resolve (Expr, Any_Integer); - elsif not Is_OK_Static_Expression (Expr) then + if not Is_OK_Static_Expression (Expr) then Flag_Non_Static_Expr ("value must be static expression!", Expr); raise Pragma_Exit;