The verification back-end may need to work in a mode in which not all ALI files
are available. Update Read_Withed_ALIs to work in that mode. This does not
impact the compiler.
Tested on x86_64-pc-linux-gnu, committed on trunk
2011-09-01 Yannick Moy <[email protected]>
* ali-util.adb, ali-util.ads (Read_Withed_ALIs): Add parameter
Ignore_Errors to ignore failures to read ALI files when True.
Index: ali-util.adb
===================================================================
--- ali-util.adb (revision 178381)
+++ ali-util.adb (working copy)
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2011, 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- --
@@ -212,7 +212,10 @@
-- Read_Withed_ALIs --
----------------------
- procedure Read_Withed_ALIs (Id : ALI_Id) is
+ procedure Read_Withed_ALIs
+ (Id : ALI_Id;
+ Ignore_Errors : Boolean := False)
+ is
Afile : File_Name_Type;
Text : Text_Buffer_Ptr;
Idread : ALI_Id;
@@ -234,59 +237,67 @@
then
Text := Read_Library_Info (Afile);
- -- 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.
+ -- Unless Ignore_Errors is true, 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
- 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
+ if not Ignore_Errors then
+ 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;
- Idread :=
- Scan_ALI
- (F => Afile,
- T => Text,
- Ignore_ED => False,
- Err => False);
+ else
+ -- Enter in ALIs table
- Free (Text);
+ Idread :=
+ Scan_ALI
+ (F => Afile,
+ T => Text,
+ Ignore_ED => False,
+ Err => False);
- if ALIs.Table (Idread).Compile_Errors then
- 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));
+ Free (Text);
- elsif ALIs.Table (Idread).No_Object then
- Error_Msg_File_1 := Withs.Table (W).Sfile;
- Error_Msg ("{ must be recompiled");
- Set_Name_Table_Info (Afile, Int (No_Unit_Id));
- end if;
+ if ALIs.Table (Idread).Compile_Errors
+ and then not Ignore_Errors
+ then
+ 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));
- -- If the Unit is an Interface to a Stand-Alone Library,
- -- set the Interface flag in the Withs table, so that its
- -- dependant are not considered for elaboration order.
+ elsif ALIs.Table (Idread).No_Object
+ and then not Ignore_Errors
+ then
+ Error_Msg_File_1 := Withs.Table (W).Sfile;
+ Error_Msg ("{ must be recompiled");
+ Set_Name_Table_Info (Afile, Int (No_Unit_Id));
+ end if;
- if ALIs.Table (Idread).SAL_Interface then
- Withs.Table (W).SAL_Interface := True;
- Interface_Library_Unit := True;
+ -- If the Unit is an Interface to a Stand-Alone Library,
+ -- set the Interface flag in the Withs table, so that its
+ -- dependant are not considered for elaboration order.
- -- Set the entry in the Interfaces hash table, so that other
- -- units that import this unit will set the flag in their
- -- entry in the Withs table.
+ if ALIs.Table (Idread).SAL_Interface then
+ Withs.Table (W).SAL_Interface := True;
+ Interface_Library_Unit := True;
- Interfaces.Set (Afile, True);
+ -- Set the entry in the Interfaces hash table, so that
+ -- other units that import this unit will set the flag
+ -- in their entry in the Withs table.
- else
- -- Otherwise, recurse to get new dependents
+ Interfaces.Set (Afile, True);
- Read_Withed_ALIs (Idread);
+ else
+ -- Otherwise, recurse to get new dependents
+
+ Read_Withed_ALIs (Idread);
+ end if;
end if;
-- If the ALI file has already been processed and is an interface,
Index: ali-util.ads
===================================================================
--- ali-util.ads (revision 178381)
+++ ali-util.ads (working copy)
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2011, 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- --
@@ -100,11 +100,15 @@
-- Subprograms for Manipulating ALI Information --
--------------------------------------------------
- procedure Read_Withed_ALIs (Id : ALI_Id);
+ procedure Read_Withed_ALIs
+ (Id : ALI_Id;
+ Ignore_Errors : Boolean := False);
-- Process an ALI file which has been read and scanned by looping through
-- all withed units in the ALI file, checking if they have been processed.
-- Each unit that has not yet been processed will be read, scanned, and
- -- processed recursively.
+ -- processed recursively. If Ignore_Errors is True, then failure to read an
+ -- ALI file is not reported as an error, and scanning continues with other
+ -- ALI files.
procedure Set_Source_Table (A : ALI_Id);
-- Build source table entry corresponding to the ALI file whose id is A