[multiple changes]

2014-08-01  Robert Dewar  <dewar@adacore.com>

	* debug.adb: Document debug switch -gnatd.Z.
	* sem.adb (Semantics): Force expansion on in no or configurable
	run time mode.

2014-08-01  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch5.adb (Analyze_Loop_Parameter_Specification): An
	unchecked conversion denotes an iterator specification. Such a
	conversion will be inserted in the context of an inlined call
	when needed, and its argument is always an object.

From-SVN: r213456
This commit is contained in:
Arnaud Charlet 2014-08-01 15:23:00 +02:00
parent 9741d942c2
commit 511c5197c7
4 changed files with 49 additions and 3 deletions

View File

@ -1,3 +1,16 @@
2014-08-01 Robert Dewar <dewar@adacore.com>
* debug.adb: Document debug switch -gnatd.Z.
* sem.adb (Semantics): Force expansion on in no or configurable
run time mode.
2014-08-01 Ed Schonberg <schonberg@adacore.com>
* sem_ch5.adb (Analyze_Loop_Parameter_Specification): An
unchecked conversion denotes an iterator specification. Such a
conversion will be inserted in the context of an inlined call
when needed, and its argument is always an object.
2014-08-01 Robert Dewar <dewar@adacore.com> 2014-08-01 Robert Dewar <dewar@adacore.com>
* make.adb, makeutl.ads: Minor reformatting. * make.adb, makeutl.ads: Minor reformatting.

View File

@ -143,7 +143,7 @@ package body Debug is
-- d.W Print out debugging information for Walk_Library_Items -- d.W Print out debugging information for Walk_Library_Items
-- d.X Old treatment of indexing aspects -- d.X Old treatment of indexing aspects
-- d.Y -- d.Y
-- d.Z -- d.Z Do not enable expansion in configurable run-time mode
-- d1 Error msgs have node numbers where possible -- d1 Error msgs have node numbers where possible
-- d2 Eliminate error flags in verbose form error messages -- d2 Eliminate error flags in verbose form error messages
@ -686,6 +686,12 @@ package body Debug is
-- is preserved temporarily for use by the modelling project under -- is preserved temporarily for use by the modelling project under
-- debug flag d.X. -- debug flag d.X.
-- d.Z Normally we always enable expansion in configurable run-time mode
-- to make sure we get error messages about unsupported features even
-- when compiling in -gnatc mode. But expansion is turned off in this
-- case if debug flag -gnatd.Z is used. This is to deal with the case
-- where we discover difficulties in this new processing.
-- d1 Error messages have node numbers where possible. Normally error -- d1 Error messages have node numbers where possible. Normally error
-- messages have only source locations. This option is useful when -- messages have only source locations. This option is useful when
-- debugging errors caused by expanded code, where the source location -- debugging errors caused by expanded code, where the source location

View File

@ -1410,11 +1410,33 @@ package body Sem is
GNAT_Mode := True; GNAT_Mode := True;
end if; end if;
-- For generic main, never do expansion
if Generic_Main then if Generic_Main then
Expander_Mode_Save_And_Set (False); Expander_Mode_Save_And_Set (False);
-- Non generic case
else else
Expander_Mode_Save_And_Set Expander_Mode_Save_And_Set
(Operating_Mode = Generate_Code or Debug_Flag_X);
-- Turn on expansion if generating code
(Operating_Mode = Generate_Code
-- or if special debug flag -gnatdx is set
or else Debug_Flag_X
-- Or if in configuration run-time mode. We do this so we get
-- error messages about missing entities in the run-time even
-- if we are compiling in -gnatc (no code generation) mode.
-- Similar processing applies to No_Run_Time_Mode. However,
-- don't do this if debug flag -gnatd.Z is set (this is to handle
-- a situation where this new processing causes trouble).
or else ((Configurable_Run_Time_Mode or No_Run_Time_Mode)
and not Debug_Flag_Dot_ZZ));
end if; end if;
Full_Analysis := True; Full_Analysis := True;

View File

@ -2510,16 +2510,21 @@ package body Sem_Ch5 is
-- a) a function call, -- a) a function call,
-- b) an identifier that is not a type, -- b) an identifier that is not a type,
-- c) an attribute reference 'Old (within a postcondition) -- c) an attribute reference 'Old (within a postcondition)
-- d) an unchecked conversion
-- then it is an iteration over a container. It was classified as -- then it is an iteration over a container. It was classified as
-- a loop specification by the parser, and must be rewritten now -- a loop specification by the parser, and must be rewritten now
-- to activate container iteration. -- to activate container iteration. The last case will occur within
-- an expanded inlined call, where the expansion wraps an actual in
-- an unchecked conversion when needed. The expression of the
-- conversion is always an object.
if Nkind (DS_Copy) = N_Function_Call if Nkind (DS_Copy) = N_Function_Call
or else (Is_Entity_Name (DS_Copy) or else (Is_Entity_Name (DS_Copy)
and then not Is_Type (Entity (DS_Copy))) and then not Is_Type (Entity (DS_Copy)))
or else (Nkind (DS_Copy) = N_Attribute_Reference or else (Nkind (DS_Copy) = N_Attribute_Reference
and then Attribute_Name (DS_Copy) = Name_Old) and then Attribute_Name (DS_Copy) = Name_Old)
or else Nkind (DS_Copy) = N_Unchecked_Type_Conversion
then then
-- This is an iterator specification. Rewrite it as such and -- This is an iterator specification. Rewrite it as such and
-- analyze it to capture function calls that may require -- analyze it to capture function calls that may require