]> gcc.gnu.org Git - gcc.git/commit - gcc/ada/exp_put_image.adb
[Ada] Add Ada 2022 Image and Put_Image support for tagged types
authorSteve Baird <baird@adacore.com>
Fri, 16 Apr 2021 23:07:31 +0000 (16:07 -0700)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 5 Jul 2021 13:09:09 +0000 (13:09 +0000)
commitb4b023c4267801dce118923421124e0d9f65075f
treed090c11ee08f2d652f4bbbc7ba82a24aff438478
parentb9713be32ba408b1d8002d92c589c6c3ed8f8831
[Ada] Add Ada 2022 Image and Put_Image support for tagged types

gcc/ada/

* debug.adb: Remove comments about -gnatd_z switch.
* exp_ch3.adb (Make_Predefined_Primitive_Specs): A one-line fix
for a subtle bug that took some effort to debug. Append a new
Put_Image procedure for a type extension even if it seems to
already have one, just as is done for (for example) the
streaming-related Read procedure.
* exp_put_image.adb:
(Build_Record_Put_Image_Procedure.Make_Component_Attributes): Do
not treat _Parent component like just another component, for two
reasons.  1. If the _parent component's type has a
user-specified Put_Image procedure, then we want to generate a
call to that procedure and then generate extension aggregate
syntax.  2. Otherwise, we still don't want to see any mention of
"_parent" in the generated image text.
(Build_Record_Put_Image_Procedure.Make_Component_Name): Add
assertion that we are not generating a reference to an "_parent"
component.
(Build_Record_Put_Image_Procedure): Add special treatment for
null records.  Add call to Duplicate_Subexpr for image attribute
prefix in order to help with expansion needed in the class-wide
case (where the prefix is also referenced in the call to
Wide_Wide_Expanded_Name) if evaluation of the prefix has side
effects. Add new local helper function, Put_String_Exp.  Add
support for case where prefix type is class-wide.
(Enable_Put_Image, Preload_Root_Buffer_Type): Query Ada_Version
> Ada_2022 instead of (indirectly) querying -gnatd_z switch.
* freeze.adb (In_Expanded_Body): A one-line change to add
TSS_Put_Image to the list of subprograms that have
expander-created bodies.
* rtsfind.ads: Add support for accessing
Ada.Tags.Wide_Wide_Expanded_Name.
* sem_ch3.ads, sem_ch3.adb: Delete Is_Null_Extension function,
as part of moving it to Sem_Util.
* sem_ch13.adb
(Analyze_Put_Image_TSS_Definition.Has_Good_Profile): Improve
diagnostic messages in cases where the result is going to be
False and the Report parameter is True. Relax overly-restrictive
checks in order to implement mode conformance.
(Analyze_Stream_TSS_Definition.Has_Good_Profile): Add similar
relaxation of parameter subtype checking for the Stream
parameter of user-defined streaming subprograms.
* sem_disp.adb (Check_Dispatching_Operation): A one-line
change (and an accompanying comment change) to add TSS_Put_Image
to the list of compiler-generated dispatching primitive
operations.
* sem_util.ads, sem_util.adb: Add Ignore_Privacy Boolean
parameter to Is_Null_Record_Type function (typically the
parameter will be False when the function is being used in the
implementation of static semantics and True for dynamic
semantics; the parameter might make a difference in the case of,
for example, a private type that is implemented as a null record
type).  Add related new routines Is_Null_Extension (formerly
declared in Sem_Ch3), Is_Null_Extension_Of, and
Is_Null_Record_Definition.
gcc/ada/debug.adb
gcc/ada/exp_ch3.adb
gcc/ada/exp_put_image.adb
gcc/ada/freeze.adb
gcc/ada/rtsfind.ads
gcc/ada/sem_ch13.adb
gcc/ada/sem_ch3.adb
gcc/ada/sem_ch3.ads
gcc/ada/sem_disp.adb
gcc/ada/sem_util.adb
gcc/ada/sem_util.ads
This page took 0.062178 seconds and 5 git commands to generate.