diff options
author | Steve Baird <baird@adacore.com> | 2021-03-29 17:09:31 -0700 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2021-06-21 06:45:17 -0400 |
commit | 20922782976048592eb9240ad2ab8690b207dc24 (patch) | |
tree | 748250705a37e2de4446058ca5a8e2bf0cf2c5d4 /gcc/ada/gen_il.ads | |
parent | 88bed4e088a197e89051b520da8bb3631a10f9c0 (diff) | |
download | gcc-20922782976048592eb9240ad2ab8690b207dc24.tar.gz |
[Ada] Add Ada.Strings.Text_Buffers and replace uses of Ada.Strings.Text_Output
gcc/ada/
* Make-generated.in (GEN_IL_FLAGS): Keep only GNAT flags.
(ada/stamp-gen_il): Remove dependencies on libgnat/ sources. Do not
copy libgnat/ sources locally and tidy up.
* Makefile.rtl: Include object files for new Text_Buffer units
in the GNATRTL_NONTASKING_OBJS list.
* exp_put_image.ads, exp_put_image.adb: Update Rtsfind calls to
match new specs. For example, calls to RE_Sink are replaced with
calls to RE_Root_Buffer_Type. Update comments and change
subprogram names accordingly (e.g., Preload_Sink is changed to
Preload_Root_Buffer_Type).
* impunit.adb: Add 6 new predefined units (Text_Buffers and 5
child units thereof).
* rtsfind.ads, rtsfind.adb: Add interfaces for accessing the
Ada.Strings.Text_Buffers package and declarations
therein (including the Unbounded child unit). Do not (yet)
delete interfaces for accessing the old Text_Output package.
* sem_attr.adb (Check_Put_Image_Attribute): Replace RE_Sink uses
with RE_Root_Buffer_Type and update comments accordingly.
* sem_ch10.adb (Analyze_Compilation_Unit): Update call to
reflect name change of callee (that is, the former Preload_Sink
is now Preload_Root_Buffer_Type).
* sem_ch13.adb (Has_Good_Profile): Replace RE_Sink use with
RE_Root_Buffer_Type.
(Build_Spec): Update comment describing a parameter type.
* gen_il.ads: Remove clauses for the old Text_Output package and
add them for Ada.Streams.Stream_IO.
(Sink): Declare.
(Create_File): Likewise.
(Increase_Indent): Likewise.
(Decrease_Indent): Likewise.
(Put): Likewise.
(LF): Likewise.
* gen_il.adb: Add clauses for Ada.Streams.Stream_IO.
(Create_File): New procedure.
(Increase_Indent): Likewise.
(Decrease_Indent): Likewise.
(Put): New procedures.
* gen_il-gen.adb: Add clauses for Ada.Text_IO. Replace
Sink'Class with Sink throughout. Use string concatenation and
LF marker instead of formatted strings and "\n" marker. Update
Indent/Outdent calls to use new Increase_Indent/Decrease_Indent
names.
(Put_Membership_Query_Decl): Remove.
* gen_il-internals.ads: Replace Sink'Class with Sink throughout.
(Ptypes): Remove.
(Pfields): Likewise.
* gen_il-internals.adb: Remove clauses for GNAT.OS_Lib and
Ada.Strings.Text_Buffers.Files. Replace Sink'Class with Sink
throughout. Use string concatenation and LF marker instead of
formatted strings and "\n" marker.
(Stdout): Remove.
(Ptypes): Likewise.
(Pfields): Likewise.
* libgnarl/s-putaim.ads: Modify context clause, update
declaration of subtype Sink to refer to
Text_Buffers.Root_Buffer_Type instead of the old
Text_Output.Sink type.
* libgnarl/s-putaim.adb: Modify context clause and add use
clause to refer to Text_Buffers package.
* libgnat/a-cbdlli.ads, libgnat/a-cbdlli.adb,
libgnat/a-cbhama.ads, libgnat/a-cbhama.adb,
libgnat/a-cbhase.ads, libgnat/a-cbhase.adb,
libgnat/a-cbmutr.ads, libgnat/a-cbmutr.adb,
libgnat/a-cborma.ads, libgnat/a-cborma.adb,
libgnat/a-cborse.ads, libgnat/a-cborse.adb,
libgnat/a-cdlili.ads, libgnat/a-cdlili.adb,
libgnat/a-cidlli.ads, libgnat/a-cidlli.adb,
libgnat/a-cihama.ads, libgnat/a-cihama.adb,
libgnat/a-cihase.ads, libgnat/a-cihase.adb,
libgnat/a-cimutr.ads, libgnat/a-cimutr.adb,
libgnat/a-ciorma.ads, libgnat/a-ciorma.adb,
libgnat/a-ciormu.ads, libgnat/a-ciormu.adb,
libgnat/a-ciorse.ads, libgnat/a-ciorse.adb,
libgnat/a-coboho.ads, libgnat/a-coboho.adb,
libgnat/a-cobove.ads, libgnat/a-cobove.adb,
libgnat/a-cohama.ads, libgnat/a-cohama.adb,
libgnat/a-cohase.ads, libgnat/a-cohase.adb,
libgnat/a-coinho.ads, libgnat/a-coinho.adb,
libgnat/a-coinho__shared.ads, libgnat/a-coinho__shared.adb,
libgnat/a-coinve.ads, libgnat/a-coinve.adb,
libgnat/a-comutr.ads, libgnat/a-comutr.adb,
libgnat/a-convec.ads, libgnat/a-convec.adb,
libgnat/a-coorma.ads, libgnat/a-coorma.adb,
libgnat/a-coormu.ads, libgnat/a-coormu.adb,
libgnat/a-coorse.ads, libgnat/a-coorse.adb,
libgnat/a-nbnbin.ads, libgnat/a-nbnbin.adb,
libgnat/a-nbnbin__gmp.adb, libgnat/a-nbnbre.ads,
libgnat/a-nbnbre.adb, libgnat/a-strunb.ads,
libgnat/a-strunb.adb, libgnat/a-strunb__shared.ads,
libgnat/a-strunb__shared.adb, libgnat/s-rannum.ads,
libgnat/s-rannum.adb: Modify Put_Image procedure used in
Put_Image aspect specification to conform to Ada profile
rules (in particular, the first parameter shall be of type
Ada.Strings.Text_Buffers.Root_Buffer_Type'Class).
* libgnat/a-sttebu.ads, libgnat/a-sttebu.adb,
libgnat/a-stbubo.ads, libgnat/a-stbubo.adb,
libgnat/a-stbufi.ads, libgnat/a-stbufi.adb,
libgnat/a-stbufo.ads, libgnat/a-stbufo.adb,
libgnat/a-stbuun.ads, libgnat/a-stbuun.adb,
libgnat/a-stbuut.ads, libgnat/a-stbuut.adb: A new predefined
unit, Ada.Strings.Text_Buffers, and five child units. Two of
the five are RM-defined: Bounded and Unbounded. The remaining
three are GNAT-defined: Files, Utils, and Formatting. The buffer
type corresponding to an output file, type Files.File_Buffer, is
simpler (and perhaps therefore slower) than its predecessor.
Caching similar to what was being done before could be added
later if that seems appropriate.
* libgnat/s-putima.ads: Modify context clause, update
declaration of subtype Sink to refer to
Text_Buffers.Root_Buffer_Type instead of the old
Text_Output.Sink type.
* libgnat/s-putima.adb: Modify context clause. Update
Indent/Outdent calls to use new Increase_Indent/Decrease_Indent
names; ditto for "Put_String => Put" name change.
* libgnat/a-stteou__bootstrap.ads: Delete.
Diffstat (limited to 'gcc/ada/gen_il.ads')
-rw-r--r-- | gcc/ada/gen_il.ads | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/gcc/ada/gen_il.ads b/gcc/ada/gen_il.ads index 6a86ed6d610..5f307fe7c50 100644 --- a/gcc/ada/gen_il.ads +++ b/gcc/ada/gen_il.ads @@ -24,11 +24,8 @@ ------------------------------------------------------------------------------ pragma Warnings (Off); -- with clauses for children -with Ada.Strings.Text_Output.Formatting; -use Ada.Strings.Text_Output, Ada.Strings.Text_Output.Formatting; -with Ada.Strings.Text_Output.Files; use Ada.Strings.Text_Output.Files; -with Ada.Strings.Text_Output.Utils; use Ada.Strings.Text_Output.Utils; -with Ada.Characters.Handling; use Ada.Characters.Handling; +with Ada.Characters.Handling; use Ada.Characters.Handling; +with Ada.Streams.Stream_IO; pragma Warnings (On); package Gen_IL is -- generate intermediate language @@ -76,4 +73,24 @@ package Gen_IL is -- generate intermediate language procedure Capitalize (S : in out String); -- Turns an identifier into Mixed_Case + -- The following declares a minimal implementation of formatted output + -- that is piggybacked on Ada.Streams.Stream_IO for bootstrap reasons. + -- It uses LF as universal line terminator to make it host independent. + + type Sink is record + File : Ada.Streams.Stream_IO.File_Type; + Indent : Natural; + New_Line : Boolean; + end record; + + procedure Create_File (Buffer : in out Sink; Name : String); + + procedure Increase_Indent (Buffer : in out Sink; Amount : Natural); + + procedure Decrease_Indent (Buffer : in out Sink; Amount : Natural); + + procedure Put (Buffer : in out Sink; Item : String); + + LF : constant String := "" & ASCII.LF; + end Gen_IL; |