diff options
author | Vincent Celier <celier@adacore.com> | 2010-10-04 13:27:57 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2010-10-04 15:27:57 +0200 |
commit | ea4ce0f7775af81231269f9c39206db30b7cb775 (patch) | |
tree | 762cf5586088eb7449e204245ad71d64685bca32 /gcc/ada/sinput-l.adb | |
parent | 1366997bf20c36a7d0701a4f4e09b7d8b523e828 (diff) | |
download | gcc-ea4ce0f7775af81231269f9c39206db30b7cb775.zip gcc-ea4ce0f7775af81231269f9c39206db30b7cb775.tar.gz gcc-ea4ce0f7775af81231269f9c39206db30b7cb775.tar.bz2 |
frontend.adb: Set Lib.Parsing_Main_Extended_Source to True before loading the main source...
2010-10-04 Vincent Celier <celier@adacore.com>
* frontend.adb: Set Lib.Parsing_Main_Extended_Source to True before
loading the main source, so that if it is preprocessed and -gnateG is
used, the preprocessed file is written.
* lib.ads (Analysing_Subunit_Of_Main): New global variable to indicate
if a subunit is from the main unit when it is loaded.
* sem_ch10.adb (Analyze_Proper_Body): Set Lib.Analysing_Subunit_Of_Main
to True before loading a subunit.
* sem_ch12.adb (Copy_Generic_Node): Set Lib.Analysing_Subunit_Of_Main
to True when the main is a generic unit before loading one of its
subunits.
* sinput-l.adb (Load_File): If -gnateG is used, write the preprocessed
file only for the main unit (spec, body and subunits).
From-SVN: r164934
Diffstat (limited to 'gcc/ada/sinput-l.adb')
-rw-r--r-- | gcc/ada/sinput-l.adb | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/gcc/ada/sinput-l.adb b/gcc/ada/sinput-l.adb index 98ad104..8d952b2 100644 --- a/gcc/ada/sinput-l.adb +++ b/gcc/ada/sinput-l.adb @@ -30,6 +30,7 @@ with Einfo; use Einfo; with Errout; use Errout; with Fname; use Fname; with Hostparm; +with Lib; use Lib; with Opt; use Opt; with Osint; use Osint; with Output; use Output; @@ -552,9 +553,17 @@ package body Sinput.L is else -- Output the result of the preprocessing, if requested and - -- the source has been modified by the preprocessing. - - if Generate_Processed_File and then Modified then + -- the source has been modified by the preprocessing. Only + -- do that for the main unit (spec, body and subunits). + + if Generate_Processed_File and then + Modified and then + ((Compiler_State = Parsing + and then Parsing_Main_Extended_Source) + or else + (Compiler_State = Analyzing + and then Analysing_Subunit_Of_Main)) + then declare FD : File_Descriptor; NB : Integer; |