public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Add Ada.Strings.Text_Buffers and replace uses of Ada.Strings.Text_Output
@ 2021-06-21 11:05 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-06-21 11:05 UTC (permalink / raw)
  To: gcc-patches; +Cc: Steve Baird

[-- Attachment #1: Type: text/plain, Size: 6498 bytes --]

GNAT's initial implementation of Ada 2022's Image attributes for
non-scalar types referenced (in user-visible ways) a GNAT-defined
package Ada.Strings.Text_Output and child units thereof. The Ada RM
specifies that a similar-but-different package,
Ada.Strings.Text_Buffers, is to be provided (RM A.4.12) and used in the
definition of the Put_Image attribute (RM 4.10). Step 1 is to provide a
spec and implementation for this new package and its language-defined
child units. Step 2 is to modify the compiler and the run-time library
to use this new package instead of the old-one for all image-related
matters. Having done this, we want to get rid of the old Text_Output
package. It has one other client, the Gen_IL package and its child
units.  Using such bleeding-edge I/O units is problematic during the
bootstrap process. So step 3 is modifying Gen_IL to use only
Ada.Streams.Stream_IO instead. Step 4 will be finally deleting the
Text_Output package. Steps 1-3 are included in this commit; step 4 is
not.

Tested on x86_64-pc-linux-gnu, committed on trunk

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.

[-- Attachment #2: patch.diff.gz --]
[-- Type: application/gzip, Size: 33457 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-21 11:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-21 11:05 [Ada] Add Ada.Strings.Text_Buffers and replace uses of Ada.Strings.Text_Output 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).