* [Ada] Reuse existing To_Mixed routine in pretty-printer
@ 2021-05-04 9:52 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-05-04 9:52 UTC (permalink / raw)
To: gcc-patches; +Cc: Piotr Trojanek
[-- Attachment #1: Type: text/plain, Size: 235 bytes --]
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.
[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 2206 bytes --]
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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-04 9:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-04 9:52 [Ada] Reuse existing To_Mixed routine in pretty-printer Pierre-Marie de Rodat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).