From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rock.gnat.com (rock.gnat.com [205.232.38.15]) by sourceware.org (Postfix) with ESMTP id 8F4493957055 for ; Tue, 4 May 2021 09:52:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8F4493957055 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=derodat@adacore.com Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 467F256134; Tue, 4 May 2021 05:52:23 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 9aWlvGBUeFFx; Tue, 4 May 2021 05:52:23 -0400 (EDT) Received: from tron.gnat.com (tron.gnat.com [IPv6:2620:20:4000:0:46a8:42ff:fe0e:e294]) by rock.gnat.com (Postfix) with ESMTP id 250EE5613E; Tue, 4 May 2021 05:52:23 -0400 (EDT) Received: by tron.gnat.com (Postfix, from userid 4862) id 213C816E; Tue, 4 May 2021 05:52:23 -0400 (EDT) Date: Tue, 4 May 2021 05:52:23 -0400 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [Ada] Reuse existing To_Mixed routine in pretty-printer Message-ID: <20210504095223.GA90556@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="zYM0uCDKw75PZbzx" Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Tue, 04 May 2021 09:52:28 -0000 --zYM0uCDKw75PZbzx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Unit Pprint, which implements pretty-printing of the AST, defined routine To_Mixed_Case, which was identical to System.Case_Util.To_Mixed. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * pprint.adb (To_Mixed): Removed. --zYM0uCDKw75PZbzx Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="patch.diff" diff --git a/gcc/ada/pprint.adb b/gcc/ada/pprint.adb --- a/gcc/ada/pprint.adb +++ b/gcc/ada/pprint.adb @@ -24,7 +24,6 @@ ------------------------------------------------------------------------------ with Atree; use Atree; -with Csets; use Csets; with Einfo; use Einfo; with Namet; use Namet; with Nlists; use Nlists; @@ -34,6 +33,8 @@ with Sinput; use Sinput; with Snames; use Snames; with Uintp; use Uintp; +with System.Case_Util; + package body Pprint is List_Name_Count : Natural := 0; @@ -272,32 +273,6 @@ package body Pprint is when N_Attribute_Reference => if Take_Prefix then declare - function To_Mixed_Case (S : String) return String; - -- Transform given string into the corresponding one in - -- mixed case form. - - ------------------- - -- To_Mixed_Case -- - ------------------- - - function To_Mixed_Case (S : String) return String is - Result : String (S'Range); - Ucase : Boolean := True; - - begin - for J in S'Range loop - if Ucase then - Result (J) := Fold_Upper (S (J)); - else - Result (J) := Fold_Lower (S (J)); - end if; - - Ucase := (S (J) = '_'); - end loop; - - return Result; - end To_Mixed_Case; - Id : constant Attribute_Id := Get_Attribute_Id (Attribute_Name (Expr)); @@ -306,7 +281,7 @@ package body Pprint is Str : constant String := Expr_Name (Prefix (Expr)) & "'" - & To_Mixed_Case + & System.Case_Util.To_Mixed (Get_Name_String (Attribute_Name (Expr))); N : Node_Id; --zYM0uCDKw75PZbzx--