[gcc r12-6297] [Ada] Remove duplicates of empty strings
Pierre-Marie de Rodat
pmderodat@gcc.gnu.org
Thu Jan 6 17:13:27 GMT 2022
https://gcc.gnu.org/g:337417795afd624c479c49529a935ee096700457
commit r12-6297-g337417795afd624c479c49529a935ee096700457
Author: Piotr Trojanek <trojanek@adacore.com>
Date: Thu Dec 2 15:30:36 2021 +0100
[Ada] Remove duplicates of empty strings
gcc/ada/
* par-ch4.adb (P_Simple_Expression): Reuse Null_String_Id.
* prep.adb (Parse_Def_File): Likewise; remove Empty_String.
Diff:
---
gcc/ada/par-ch4.adb | 7 +------
gcc/ada/prep.adb | 8 +-------
2 files changed, 2 insertions(+), 13 deletions(-)
diff --git a/gcc/ada/par-ch4.adb b/gcc/ada/par-ch4.adb
index d985003751f..4b021e7a932 100644
--- a/gcc/ada/par-ch4.adb
+++ b/gcc/ada/par-ch4.adb
@@ -2471,9 +2471,6 @@ package body Ch4 is
and then Num_Concats >= Num_Concats_Threshold
then
declare
- Empty_String_Val : String_Id;
- -- String_Id for ""
-
Strlit_Concat_Val : String_Id;
-- Contains the folded value (which will be correct if the
-- "&" operators are the predefined ones).
@@ -2509,11 +2506,9 @@ package body Ch4 is
-- Create new folded node, and rewrite result with a concat-
-- enation of an empty string literal and the folded node.
- Start_String;
- Empty_String_Val := End_String;
New_Node :=
Make_Op_Concat (Loc,
- Make_String_Literal (Loc, Empty_String_Val),
+ Make_String_Literal (Loc, Null_String_Id),
Make_String_Literal (Loc, Strlit_Concat_Val,
Is_Folded_In_Parser => True));
Rewrite (Node1, New_Node);
diff --git a/gcc/ada/prep.adb b/gcc/ada/prep.adb
index e01161c7289..2ced0829c86 100644
--- a/gcc/ada/prep.adb
+++ b/gcc/ada/prep.adb
@@ -114,9 +114,6 @@ package body Prep is
-- Used to avoid repetition of the part of the initialisation that needs
-- to be done only once.
- Empty_String : String_Id;
- -- "", as a string_id
-
String_False : String_Id;
-- "false", as a string_id
@@ -809,9 +806,6 @@ package body Prep is
Store_String_Chars ("True");
True_Value.Value := End_String;
- Start_String;
- Empty_String := End_String;
-
Start_String;
Store_String_Chars ("False");
String_False := End_String;
@@ -1072,7 +1066,7 @@ package body Prep is
Original => Original_Name,
On_The_Command_Line => False,
Is_A_String => False,
- Value => Empty_String);
+ Value => Null_String_Id);
else
Value_Start := Token_Ptr;
More information about the Gcc-cvs
mailing list