This patch forces expansion on (but not actual code generation) for configurable run time mode or no run time mode in -gnatc mode. This means that we get error messages about unsupported features even in -gnatc mode, which was not true before. The following is compiled in -gnatc mode with a gnat.adc file containing pragma No_Run_Time:
1. function CRT_GNATC (X : Integer) return Integer is 2. begin 3. return X ** X; | >>> construct not allowed in no run time mode >>> entity "System.Exp_Int.Exp_Integer" not defined 4. end; prior to this patch, no message was given in -gnatc mode. A debug flag -gnatd.Z can be used to disable this behavior in case we run into any trouble from doing the expansion in the future. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-08-01 Robert Dewar <de...@adacore.com> * debug.adb: Document debug switch -gnatd.Z. * sem.adb (Semantics): Force expansion on in no or configurable run time mode.
Index: debug.adb =================================================================== --- debug.adb (revision 213453) +++ debug.adb (working copy) @@ -143,7 +143,7 @@ -- 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 @@ -- 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 Index: sem.adb =================================================================== --- sem.adb (revision 213437) +++ sem.adb (working copy) @@ -1410,11 +1410,33 @@ 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;