]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Default Put_Image for composite derived types is missing information
authorPascal Obry <obry@adacore.com>
Thu, 13 Jul 2023 16:03:23 +0000 (16:03 +0000)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 1 Aug 2023 08:06:45 +0000 (10:06 +0200)
commit46640bafbbe69fbd6960b21ed5a8ed635f99afa5
tree47773d94611edde7cf39f30037ece421485878c5
parentf9b03ef769578fe9388c32b9364f21d0dc1fb6fa
ada: Default Put_Image for composite derived types is missing information

The output generated by a call to Some_Derived_Composite_Type'Put_Image
(in Ada2022 code) is incomplete in some cases, notably for a type derived
from a container type (i.e., from the Set/Map/List/Vector type declared in
an instance of one of Ada's predefined container generics) with no
user-specified Put_Image procedure.

gcc/ada/

* aspects.ads (Find_Aspect): Add Boolean parameter Or_Rep_Item
(defaulted to False).
* aspects.adb (Find_Aspect): If new Boolean parameter Or_Rep_Item
is True, then instead of returning an empty result if no
appropriate N_Aspect_Specification node is found, return an
appropriate N_Attribute_Definition_Clause if one is found.
* exp_put_image.ads: Change name of Enable_Put_Image function to
Put_Image_Enabled.
* exp_put_image.adb (Build_Record_Put_Image_Procedure): Detect the
case where a call to the Put_Image procedure of a derived type can
be transformed into a call to the parent type's Put_Image
procedure (with a type conversion to the parent type as the actual
parameter).
(Put_Image_Enabled): Change name of function (previously
Enable_Put_Image). Return True in more cases. In particular,
return True for a type with an explicitly specified Put_Image
aspect even if the type is declared in a predefined unit (or in an
instance of a predefined generic unit).
* exp_attr.adb: Changes due to Put_Image_Enabled function name
change.
gcc/ada/aspects.adb
gcc/ada/aspects.ads
gcc/ada/exp_attr.adb
gcc/ada/exp_put_image.adb
gcc/ada/exp_put_image.ads