Skip to content
Snippets Groups Projects
  • Pascal Obry's avatar
    46640baf
    ada: Default Put_Image for composite derived types is missing information · 46640baf
    Pascal Obry authored
    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.
    46640baf
    History
    ada: Default Put_Image for composite derived types is missing information
    Pascal Obry authored
    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.