ada: Cleanup preanalysis of static expressions (part 2)
According to RM 13.14(8/4), a static expression in an aspect specification does not cause freezing; however, the frontend performs many calls to Preanalyze_Spec_Expression made during the analysis of aspects. This patch, suggested by Eric Botcazou, takes care of this additional code cleanup which requires also replacing many occurrences of the global variable In_Spec_Expression by calls to Preanalysis_Active. gcc/ada/ChangeLog: * exp_util.adb (Insert_Actions): Document behavior under strict preanalysis. * sem.ads (In_Strict_Preanalysis): New subprogram. (Preanalysis_Active): Replace 'and' operator by 'and then'. * sem.adb (In_Strict_Preanalysis): Ditto. * sem_attr.adb (Check_Dereference): Replace In_Spec_Expression occurrence by call to Preanalysis_Active, and document it. (Resolve_Attribute [Atribute_Access]): Ditto. (Eval_Attribute): No evaluation under strict preanalysis. (Validate_Static_Object_Name): No action under strict preanalysis. * sem_ch13.adb (Check_Aspect_At_End_Of_Declarations): Replace calls to Preanalyze_Spec_Expression by calls to Preanalyze_And_Resolve. (Check_Aspect_At_Freeze_Point): Ditto. (Resolve_Aspect_Expressions [Dynamic/Static/Predicate aspects]): Code cleanup adjusting the code to emulate Preanalyze_And_Resolve, instead of Preanalyze_Spec_Expression. (Resolve_Aspect_Expressions [CPU/Interrupt_Priority/Priority/ Storage_Size aspects]): Replace calls to Preanalyze_Spec_Expression by call to Preanalyze_And _Resolve. * sem_ch3.adb (Analyze_Object_Declaration): Replace In_Spec_Expression occurrence by call to Preanalysis_Active. (Find_Type_Of_Object): Add documentation. * sem_ch4.adb (Analyze_Case_Expression): Replace In_Spec_Expression occurrence by call to Preanalysis_Active. * sem_ch6.adb (Analyze_Expression_Function): Minor code reorganization moving the code preanalyzing the expression after the new body has been inserted in the tree to ensure that its Parent attribute is available for preanalysis. * sem_cat.adb (Validate_Static_Object_Name): No action under strict preanalysis. * sem_elab.adb (Check_For_Eliminated_Subprogram): Replace In_Spec_Expression occurrence by call to Preanalysis_Active. * sem_eval.adb (Eval_Intrinsic_Call [Name_Enclosing_Entity]): Ditto. * sem_elim.adb (Check_For_Eliminated_Subprogram): Ditto. * sem_res.adb (Resolve_Entity_Name): Ditto.
Showing
- gcc/ada/exp_util.adb 8 additions, 8 deletionsgcc/ada/exp_util.adb
- gcc/ada/sem.adb 10 additions, 1 deletiongcc/ada/sem.adb
- gcc/ada/sem.ads 5 additions, 0 deletionsgcc/ada/sem.ads
- gcc/ada/sem_attr.adb 17 additions, 8 deletionsgcc/ada/sem_attr.adb
- gcc/ada/sem_cat.adb 1 addition, 0 deletionsgcc/ada/sem_cat.adb
- gcc/ada/sem_ch13.adb 11 additions, 14 deletionsgcc/ada/sem_ch13.adb
- gcc/ada/sem_ch3.adb 5 additions, 2 deletionsgcc/ada/sem_ch3.adb
- gcc/ada/sem_ch4.adb 1 addition, 1 deletiongcc/ada/sem_ch4.adb
- gcc/ada/sem_ch6.adb 23 additions, 23 deletionsgcc/ada/sem_ch6.adb
- gcc/ada/sem_elab.adb 1 addition, 1 deletiongcc/ada/sem_elab.adb
- gcc/ada/sem_elim.adb 3 additions, 2 deletionsgcc/ada/sem_elim.adb
- gcc/ada/sem_eval.adb 1 addition, 1 deletiongcc/ada/sem_eval.adb
- gcc/ada/sem_res.adb 1 addition, 1 deletiongcc/ada/sem_res.adb
Loading
Please register or sign in to comment