X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Fada%2Fprepcomp.adb;h=ad14fc5e16422dbc6c5b65e8e59bd89a243fc842;hb=6fd6922116b3b302cdb11694075fad2daec85184;hp=7fd1984cc55e2c49e2341356446113cb0a1c3b44;hpb=ec677a6c3a40284ccffa6de052697c0f56bc92d3;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/ada/prepcomp.adb b/gcc/ada/prepcomp.adb index 7fd1984cc55..ad14fc5e164 100644 --- a/gcc/ada/prepcomp.adb +++ b/gcc/ada/prepcomp.adb @@ -6,18 +6,17 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2003-2006, Free Software Foundation, Inc. -- +-- Copyright (C) 2003-2009, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- --- ware Foundation; either version 2, or (at your option) any later ver- -- +-- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- --- Public License distributed with GNAT; see file COPYING. If not, write -- --- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- --- Boston, MA 02110-1301, USA. -- +-- Public License distributed with GNAT; see file COPYING3. If not, go to -- +-- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- @@ -27,7 +26,6 @@ with Ada.Unchecked_Deallocation; with Errout; use Errout; -with Namet; use Namet; with Lib.Writ; use Lib.Writ; with Opt; use Opt; with Osint; use Osint; @@ -37,17 +35,21 @@ with Scn; use Scn; with Sinput.L; use Sinput.L; with Stringt; use Stringt; with Table; +with Types; use Types; package body Prepcomp is No_Preprocessing : Boolean := True; - -- Set to True if there is at least one source that needs to be + -- Set to False if there is at least one source that needs to be -- preprocessed. Source_Index_Of_Preproc_Data_File : Source_File_Index := No_Source_File; - -- The following variable should be a constant, but this is not - -- possible. Warnings are Off because it is never assigned a value. + -- The following variable should be a constant, but this is not possible + -- because its type GNAT.Dynamic_Tables.Instance has a component P of + -- unitialized private type GNAT.Dynamic_Tables.Table_Private and there + -- are no exported values for this private type. Warnings are Off because + -- it is never assigned a value. pragma Warnings (Off); No_Mapping : Prep.Symbol_Table.Instance; @@ -69,20 +71,20 @@ package body Prepcomp is type Preproc_Data is record Mapping : Symbol_Table.Instance; - File_Name : Name_Id := No_Name; - Deffile : String_Id := No_String; - Undef_False : Boolean := False; - Always_Blank : Boolean := False; - Comments : Boolean := False; - List_Symbols : Boolean := False; - Processed : Boolean := False; + File_Name : File_Name_Type := No_File; + Deffile : String_Id := No_String; + Undef_False : Boolean := False; + Always_Blank : Boolean := False; + Comments : Boolean := False; + List_Symbols : Boolean := False; + Processed : Boolean := False; end record; -- Structure to keep the preprocessing data for a file name or for the -- default (when Name_Id = No_Name). No_Preproc_Data : constant Preproc_Data := (Mapping => No_Mapping, - File_Name => No_Name, + File_Name => No_File, Deffile => No_String, Undef_False => False, Always_Blank => False, @@ -105,7 +107,7 @@ package body Prepcomp is Table_Index_Type => Int, Table_Low_Bound => 1, Table_Initial => 5, - Table_Increment => 5, + Table_Increment => 100, Table_Name => "Prepcomp.Preproc_Data_Table"); -- Table to store the specific preprocessing data @@ -117,14 +119,13 @@ package body Prepcomp is (Table_Component_Type => Source_File_Index, Table_Index_Type => Int, Table_Low_Bound => 1, - Table_Initial => 5, - Table_Increment => 5, + Table_Initial => 10, + Table_Increment => 100, Table_Name => "Prepcomp.Dependencies"); -- Table to store the dependencies on preprocessing files procedure Add_Command_Line_Symbols; - -- Add the command line symbol definitions, if any, to the - -- Prep.Mapping table. + -- Add the command line symbol definitions, if any, to Prep.Mapping table procedure Skip_To_End_Of_Line; -- Ignore errors and scan up to the next end of line or the end of file @@ -241,12 +242,12 @@ package body Prepcomp is if Source_Index_Of_Preproc_Data_File = No_Source_File then Get_Name_String (N); - Fail ("preprocessing data file """, - Name_Buffer (1 .. Name_Len), - """ not found"); + Fail ("preprocessing data file """ + & Name_Buffer (1 .. Name_Len) + & """ not found"); end if; - -- Initialize the sanner and set its behavior for a processing data file + -- Initialize scanner and set its behavior for processing a data file Scn.Scanner.Initialize_Scanner (Source_Index_Of_Preproc_Data_File); Scn.Scanner.Set_End_Of_Line_As_Token (True); @@ -295,7 +296,7 @@ package body Prepcomp is if Current_Data.File_Name = Preproc_Data_Table.Table (Index).File_Name then - Error_Msg_Name_1 := Current_Data.File_Name; + Error_Msg_File_1 := Current_Data.File_Name; Error_Msg ("multiple preprocessing data for{", Token_Ptr); OK := False; @@ -417,7 +418,7 @@ package body Prepcomp is -- with an underline or a digit. if Name_Buffer (2) = '_' - or Name_Buffer (2) in '0' .. '9' + or else Name_Buffer (2) in '0' .. '9' then Error_Msg ("symbol expected", Token_Ptr + 1); Skip_To_End_Of_Line; @@ -544,7 +545,7 @@ package body Prepcomp is -- Record Current_Data - if Current_Data.File_Name = No_Name then + if Current_Data.File_Name = No_File then Default_Data := Current_Data; else @@ -560,10 +561,10 @@ package body Prepcomp is -- Fail if there were errors in the preprocessing data file if Total_Errors_Detected > T then - Errout.Finalize; - Fail ("errors found in preprocessing data file """, - Get_Name_String (N), - """"); + Errout.Finalize (Last_Call => True); + Errout.Output_Messages; + Fail ("errors found in preprocessing data file """ + & Get_Name_String (N) & """"); end if; -- Record the dependency on the preprocessor data file @@ -648,22 +649,23 @@ package body Prepcomp is String_To_Name_Buffer (Current_Data.Deffile); declare - N : constant Name_Id := Name_Find; - Deffile : constant Source_File_Index := Load_Definition_File (N); - Add_Deffile : Boolean := True; - T : constant Nat := Total_Errors_Detected; + N : constant File_Name_Type := Name_Find; + Deffile : constant Source_File_Index := + Load_Definition_File (N); + Add_Deffile : Boolean := True; + T : constant Nat := Total_Errors_Detected; begin if Deffile = No_Source_File then - Fail ("definition file """, - Get_Name_String (N), - """ cannot be found"); + Fail ("definition file """ + & Get_Name_String (N) + & """ not found"); end if; -- Initialize the preprocessor and set the characteristics of the -- scanner for a definition file. - Prep.Initialize + Prep.Setup_Hooks (Error_Msg => Errout.Error_Msg'Access, Scan => Scn.Scanner.Scan'Access, Set_Ignore_Errors => Errout.Set_Ignore_Errors'Access, @@ -685,10 +687,11 @@ package body Prepcomp is -- Fail if errors were found while processing the definition file if T /= Total_Errors_Detected then - Errout.Finalize; - Fail ("errors found in definition file """, - Get_Name_String (N), - """"); + Errout.Finalize (Last_Call => True); + Errout.Output_Messages; + Fail ("errors found in definition file """ + & Get_Name_String (N) + & """"); end if; for Index in 1 .. Dependencies.Last loop @@ -741,7 +744,7 @@ package body Prepcomp is Check_Command_Line_Symbol_Definition (Definition => Symbol_Definitions (Index).all, - Data => Symbol_Data); + Data => Symbol_Data); Found := False; -- If there is already a definition for this symbol, replace the old