From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by sourceware.org (Postfix) with ESMTPS id 2B41C385742F for ; Mon, 9 May 2022 09:30:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2B41C385742F Received: by mail-wm1-x332.google.com with SMTP id n126-20020a1c2784000000b0038e8af3e788so7902718wmn.1 for ; Mon, 09 May 2022 02:30:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=0TZJSJoQo6VkMul2TP2dkBfwV9mPrB0RHWY5rpb/QlM=; b=NZdYK/juuXDEK8+4QNWfy6lJ0+z4n2k+Fchwzz5kuMbH/ek7dmebIRCAlgYAguBDk4 4LkHPi5/UfR9h3f0eaXdtxUgTK7MgV2sOPhcRcSrmFFFpmAGdxtY8WZ4MTuvCKlIOqMM qaY1coSjwLd6GUCxeFtYt9q6g66B2OYE0AaNrz1qrXq6xqKa8AwFJxpQHc1ixkWHN4uj QnAfimpoZMExjIj8jUsW20GOQGPsA/rs79uZYSgBqam2HSTQ8AfacV39x6In84DSsn5z 1r0lPUKzEno0ye6Yz6FI+Q1lh6VqNKhEUqUtaTAXx/aRHFQYGHTrYD+TDijc6ufQGjqk umeQ== X-Gm-Message-State: AOAM530ad6h0Fhrm6YAygOrMWlit6YIOzHvhS/XOOO+z2rhxXLIRsk3p y6N9PZrxHgqlF+E/ohFC7sA3Ypwd+Dmp9g== X-Google-Smtp-Source: ABdhPJzZATSdJMNRN1VHKooIyQml0eLDnvGMAn/JJxpdU9zhCcq8VQFI+tlS77eYYsukIwdapT053Q== X-Received: by 2002:a1c:4b03:0:b0:394:6640:7a78 with SMTP id y3-20020a1c4b03000000b0039466407a78mr20955525wma.65.1652088638745; Mon, 09 May 2022 02:30:38 -0700 (PDT) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id o1-20020a5d6701000000b0020c9520a940sm12240804wru.54.2022.05.09.02.30.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 02:30:38 -0700 (PDT) Date: Mon, 9 May 2022 09:30:37 +0000 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [Ada] Simplify conversions from Uint to Char_Code Message-ID: <20220509093037.GA3184605@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="qDbXVdCdHGoSgWSk" Content-Disposition: inline X-Spam-Status: No, score=-13.2 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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2022 09:30:40 -0000 --qDbXVdCdHGoSgWSk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Replace "Char_Code (UI_To_Int (...))" with "UI_To_CC (...). Cleanup related to handling characters in GNATprove counterexamples; semantics is unaffected. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * par-prag.adb (Prag): Simplify conversion of character codes. * sem_case.adb (Choice_Image): Likewise. (Lit_Of): Likewise. --qDbXVdCdHGoSgWSk Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="patch.diff" diff --git a/gcc/ada/par-prag.adb b/gcc/ada/par-prag.adb --- a/gcc/ada/par-prag.adb +++ b/gcc/ada/par-prag.adb @@ -1266,8 +1266,7 @@ begin elsif Nkind (A) = N_Character_Literal then declare - R : constant Char_Code := - Char_Code (UI_To_Int (Char_Literal_Value (A))); + R : constant Char_Code := UI_To_CC (Char_Literal_Value (A)); begin if In_Character_Range (R) then Wide_Character_Encoding_Method := diff --git a/gcc/ada/sem_case.adb b/gcc/ada/sem_case.adb --- a/gcc/ada/sem_case.adb +++ b/gcc/ada/sem_case.adb @@ -1104,7 +1104,7 @@ package body Sem_Case is C := UI_To_Int (Value); if C in 16#20# .. 16#7E# then - Set_Character_Literal_Name (Char_Code (UI_To_Int (Value))); + Set_Character_Literal_Name (UI_To_CC (Value)); return Name_Find; end if; @@ -2925,7 +2925,7 @@ package body Sem_Case is -- is created with the appropriate Char_Code and Chars fields. if Is_Standard_Character_Type (Choice_Type) then - Set_Character_Literal_Name (Char_Code (UI_To_Int (Value))); + Set_Character_Literal_Name (UI_To_CC (Value)); Lit := Make_Character_Literal (Loc, Chars => Name_Find, --qDbXVdCdHGoSgWSk--