Skip to content
Snippets Groups Projects
Commit 360cd354 authored by Javier Miranda's avatar Javier Miranda Committed by Marc Poulhiès
Browse files

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.
parent d0f0f9fb
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment