Default initialization of a record object is required to initialize any components that "require late initialization" after other components. This includes the case of a type extension; "late initialization" components of the parent type are required to be initialized after non-late-init extension components. This is implemented by generalizing the use of an existing init proc parameter. Previously, the init proc for a tagged type took a Boolean parameter indicating whether or not to initialize the Tag component. With this change, this parameter can now take on any of four values indicating whether to perform
1) Full initialization (including the tag component). 2) Full initialization except for the tag component. 3) Early (non-tag) initialization only. 4) Late (non-tag) initialization only. With this change, the init proc for a type extension has the option of performing the early and late portions of the parent's initialization via two separate calls to the parent type's init proc. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch3.ads (Build_Intialization_Call): Add new formal parameter, Init_Control_Actual, with default value. Clients outside of package Exp_Ch3 are unaffected. * exp_ch3.adb (Initialization_Control): new package; support for this 4-valued parameter. The existing Requires_Late_Init function is moved into this new package. (Build_Initialization_Call): Add new formal parameter for subprogram body, use this new formal parameter in generating an init proc call. (Build_Record_Init_Proc): Replace Set_Tag Boolean formal parameter with 4-valued Init_Control_Formal. Wrap if-statements with appropriate conditions around tag initialization, early initialization, and late initialization statements. * exp_util.adb (Build_Task_Image_Decl): Avoid problem with duplicate declarations when an init proc for a type extension calls the parent type's init proc twice.
patch.diff.gz
Description: application/gzip