From 511c5197c7964009f989f7a6d03ef2858d0fe6c0 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Fri, 1 Aug 2014 15:23:00 +0200 Subject: [PATCH] [multiple changes] 2014-08-01 Robert Dewar * 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 * 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 --- gcc/ada/ChangeLog | 13 +++++++++++++ gcc/ada/debug.adb | 8 +++++++- gcc/ada/sem.adb | 24 +++++++++++++++++++++++- gcc/ada/sem_ch5.adb | 7 ++++++- 4 files changed, 49 insertions(+), 3 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 811742cfc32..de5593239c6 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,16 @@ +2014-08-01 Robert Dewar + + * 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 + + * 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 * make.adb, makeutl.ads: Minor reformatting. diff --git a/gcc/ada/debug.adb b/gcc/ada/debug.adb index 0896c85f7d6..715e44ad748 100644 --- a/gcc/ada/debug.adb +++ b/gcc/ada/debug.adb @@ -143,7 +143,7 @@ package body Debug is -- d.W Print out debugging information for Walk_Library_Items -- d.X Old treatment of indexing aspects -- d.Y - -- d.Z + -- d.Z Do not enable expansion in configurable run-time mode -- d1 Error msgs have node numbers where possible -- 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 -- 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 -- messages have only source locations. This option is useful when -- debugging errors caused by expanded code, where the source location diff --git a/gcc/ada/sem.adb b/gcc/ada/sem.adb index eb3501ed3a6..73f345e9989 100644 --- a/gcc/ada/sem.adb +++ b/gcc/ada/sem.adb @@ -1410,11 +1410,33 @@ package body Sem is GNAT_Mode := True; end if; + -- For generic main, never do expansion + if Generic_Main then Expander_Mode_Save_And_Set (False); + + -- Non generic case + else 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; Full_Analysis := True; diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb index 3d8d3f60b14..ffdf8814e52 100644 --- a/gcc/ada/sem_ch5.adb +++ b/gcc/ada/sem_ch5.adb @@ -2510,16 +2510,21 @@ package body Sem_Ch5 is -- a) a function call, -- b) an identifier that is not a type, -- c) an attribute reference 'Old (within a postcondition) + -- d) an unchecked conversion -- then it is an iteration over a container. It was classified as -- 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 or else (Is_Entity_Name (DS_Copy) and then not Is_Type (Entity (DS_Copy))) or else (Nkind (DS_Copy) = N_Attribute_Reference and then Attribute_Name (DS_Copy) = Name_Old) + or else Nkind (DS_Copy) = N_Unchecked_Type_Conversion then -- This is an iterator specification. Rewrite it as such and -- analyze it to capture function calls that may require