OSDN Git Service

PR preprocessor/30805:
[pf3gnuchains/gcc-fork.git] / gcc / ada / ali-util.adb
index 37cd6c0..322ec5c 100644 (file)
@@ -6,18 +6,17 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2005 Free Software Foundation, Inc.          --
+--          Copyright (C) 1992-2007, 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,  59 Temple Place - Suite 330,  Boston, --
--- MA 02111-1307, 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.      --
@@ -26,8 +25,6 @@
 
 with Debug;   use Debug;
 with Binderr; use Binderr;
-with Lib;     use Lib;
-with Namet;   use Namet;
 with Opt;     use Opt;
 with Output;  use Output;
 with Osint;   use Osint;
@@ -134,9 +131,10 @@ package body ALI.Util is
    -- Get_File_Checksum --
    -----------------------
 
-   function Get_File_Checksum (Fname : Name_Id) return Word is
-      Full_Name    : Name_Id;
+   function Get_File_Checksum (Fname : File_Name_Type) return Word is
+      Full_Name    : File_Name_Type;
       Source_Index : Source_File_Index;
+
    begin
       Full_Name := Find_File (Fname, Osint.Source);
 
@@ -154,7 +152,7 @@ package body ALI.Util is
          return Checksum_Error;
       end if;
 
-      Scanner.Initialize_Scanner (Types.No_Unit, Source_Index);
+      Scanner.Initialize_Scanner (Source_Index);
 
       --  Make sure that the project language reserved words are not
       --  recognized as reserved words, but as identifiers. The byte info for
@@ -248,21 +246,17 @@ package body ALI.Util is
             then
                Text := Read_Library_Info (Afile);
 
-               --  Return with an error if source cannot be found and if this
-               --  is not a library generic (now we can, but does not have to
-               --  compile library generics)
+               --  Return with an error if source cannot be found. We used to
+               --  skip this check when we did not compile library generics
+               --  separately, but we now always do, so there is no special
+               --  case here anymore.
 
                if Text = null then
-                  if Generic_Separately_Compiled (Withs.Table (W).Sfile) then
-                     Error_Msg_Name_1 := Afile;
-                     Error_Msg_Name_2 := Withs.Table (W).Sfile;
-                     Error_Msg ("% not found, % must be compiled");
-                     Set_Name_Table_Info (Afile, Int (No_Unit_Id));
-                     return;
-
-                  else
-                     goto Skip_Library_Generics;
-                  end if;
+                  Error_Msg_File_1 := Afile;
+                  Error_Msg_File_2 := Withs.Table (W).Sfile;
+                  Error_Msg ("{ not found, { must be compiled");
+                  Set_Name_Table_Info (Afile, Int (No_Unit_Id));
+                  return;
                end if;
 
                --  Enter in ALIs table
@@ -277,13 +271,13 @@ package body ALI.Util is
                Free (Text);
 
                if ALIs.Table (Idread).Compile_Errors then
-                  Error_Msg_Name_1 := Withs.Table (W).Sfile;
-                  Error_Msg ("% had errors, must be fixed, and recompiled");
+                  Error_Msg_File_1 := Withs.Table (W).Sfile;
+                  Error_Msg ("{ had errors, must be fixed, and recompiled");
                   Set_Name_Table_Info (Afile, Int (No_Unit_Id));
 
                elsif ALIs.Table (Idread).No_Object then
-                  Error_Msg_Name_1 := Withs.Table (W).Sfile;
-                  Error_Msg ("% must be recompiled");
+                  Error_Msg_File_1 := Withs.Table (W).Sfile;
+                  Error_Msg ("{ must be recompiled");
                   Set_Name_Table_Info (Afile, Int (No_Unit_Id));
                end if;
 
@@ -307,8 +301,6 @@ package body ALI.Util is
                   Read_ALI (Idread);
                end if;
 
-               <<Skip_Library_Generics>> null;
-
             --  If the ALI file has already been processed and is an interface,
             --  set the flag in the entry of the Withs table.
 
@@ -334,7 +326,7 @@ package body ALI.Util is
       loop
          F := Sdep.Table (D).Sfile;
 
-         if F /= No_Name then
+         if F /= No_File then
 
             --  If this is the first time we are seeing this source file,
             --  then make a new entry in the source table.
@@ -375,8 +367,8 @@ package body ALI.Util is
                      --  In All_Sources mode, flag error of file not found
 
                      if Opt.All_Sources then
-                        Error_Msg_Name_1 := F;
-                        Error_Msg ("cannot locate %");
+                        Error_Msg_File_1 := F;
+                        Error_Msg ("cannot locate {");
                      end if;
                   end if;
 
@@ -467,8 +459,7 @@ package body ALI.Util is
 
    function Time_Stamp_Mismatch
      (A         : ALI_Id;
-      Read_Only : Boolean := False)
-      return      File_Name_Type
+      Read_Only : Boolean := False) return File_Name_Type
    is
       Src : Source_Id;
       --  Source file Id for the current Sdep entry