-
- Downloads
ada: Factor out implementation of default initialization for objects
As written down in a comment, "There is a *huge* amount of code duplication" in the implementation of default initializaion for objects in the front-end, between the (static) declaration case and the dynamic allocation case. This change factors out the implementation of the (static) declaration case and uses it for the dynamic allocation case, with the following benefits: 1. getting rid of the duplication and reducing total line count, 2. bringing optimizations implemented for the (static) declaration case to the dynamic allocation case, 3. performing the missing abort deferral prescribed by RM 9.8(9) in the dynamic allocation case. gcc/ada/ * exp_aggr.adb (Build_Record_Aggr_Code): Replace reference to Build_Task_Allocate_Block_With_Init_Stmts in comment with reference to Build_Task_Allocate_Block. (Convert_Aggr_In_Allocator): Likewise for the call in the code. * exp_ch6.adb (Make_Build_In_Place_Call_In_Allocator): Likewise. * exp_ch3.ads: Alphabetize clauses. (Build_Default_Initialization): New function declaration. (Build_Default_Simple_Initialization): Likewise. (Build_Initialization_Call): Add Target_Ref parameter with default. * exp_ch3.adb (Build_Default_Initialization): New function extracted from... (Build_Default_Simple_Initialization): Likewise. (Build_Initialization_Call): Add Target_Ref parameter with default. (Expand_N_Object_Declaration): ...here. (Default_Initialize_Object): Call Build_Default_Initialization and Build_Default_Simple_Initialization. * exp_ch4.adb (Expand_Allocator_Expression): Minor comment tweaks. (Expand_N_Allocator): Call Build_Default_Initialization and Build_Default_Simple_Initialization to implement the default initialization of the allocated object. * exp_ch9.ads (Build_Task_Allocate_Block): Delete. (Build_Task_Allocate_Block_With_Init_Stmts): Rename into... (Build_Task_Allocate_Block): ...this. * exp_ch9.adb: Remove clauses for Exp_Tss. (Build_Task_Allocate_Block): Delete. (Build_Task_Allocate_Block_With_Init_Stmts): Rename into... (Build_Task_Allocate_Block): ...this. * exp_util.adb (Build_Allocate_Deallocate_Proc): Remove unnecessary initialization expression, adjust commentary and replace early exit with assertion. * sem_ch4.adb (Analyze_Allocator): In the null-exclusion case, call Apply_Compile_Time_Constraint_Error to insert the raise.
Showing
- gcc/ada/exp_aggr.adb 2 additions, 2 deletionsgcc/ada/exp_aggr.adb
- gcc/ada/exp_ch3.adb 558 additions, 457 deletionsgcc/ada/exp_ch3.adb
- gcc/ada/exp_ch3.ads 43 additions, 10 deletionsgcc/ada/exp_ch3.ads
- gcc/ada/exp_ch4.adb 167 additions, 438 deletionsgcc/ada/exp_ch4.adb
- gcc/ada/exp_ch6.adb 1 addition, 1 deletiongcc/ada/exp_ch6.adb
- gcc/ada/exp_ch9.adb 1 addition, 66 deletionsgcc/ada/exp_ch9.adb
- gcc/ada/exp_ch9.ads 4 additions, 15 deletionsgcc/ada/exp_ch9.ads
- gcc/ada/exp_util.adb 12 additions, 16 deletionsgcc/ada/exp_util.adb
- gcc/ada/sem_ch4.adb 7 additions, 14 deletionsgcc/ada/sem_ch4.adb
Loading
Please register or sign in to comment