diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2024-02-06 19:31:09 +0100 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2024-05-14 10:19:51 +0200 |
commit | cad2744cb385413d4762057a19f972fcb74233d6 (patch) | |
tree | a99e48ef03ea58b3432f5a460cc9bc25ce15af33 /gcc/expr.cc | |
parent | 821772478bdc8cb52249aa561975e4ff6aa7792f (diff) | |
download | gcc-cad2744cb385413d4762057a19f972fcb74233d6.zip gcc-cad2744cb385413d4762057a19f972fcb74233d6.tar.gz gcc-cad2744cb385413d4762057a19f972fcb74233d6.tar.bz2 |
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.
Diffstat (limited to 'gcc/expr.cc')
0 files changed, 0 insertions, 0 deletions