[Ada] Put imported spec in ALI file when body is not found

Arnaud Charlet charlet@adacore.com
Wed Aug 3 09:43:00 GMT 2011


When an imported unit needs a body, bit the body source file cannot be
found, always put the spec file name in the ALI file of the importing
unit. This was done when a configuration pragmas file was available to
the compiler, but not when there was no vonfiguration pragmas file.
This is now done in all cases.
The test is to compile a unit that imports a package that need
completion, when the source of the body cannot be found: the spec file
name should be in the ALI file of the compiled unit.

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-08-03  Vincent Celier  <celier@adacore.com>

	* fname-uf.adb
	(Get_File_Name) If the file cannot be found when there are no config
	pragmas file and May_Fail is True, return No_File instead of the file
	name, to be consistent.

-------------- next part --------------
Index: fname-uf.adb
===================================================================
--- fname-uf.adb	(revision 176998)
+++ fname-uf.adb	(working copy)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2007, 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- --
@@ -469,10 +469,15 @@
                      --  the default GNAT naming scheme. The file does
                      --  not exist, but there is no point doing the
                      --  second search, because we will end up with the
-                     --  same file name. Just return the file name.
+                     --  same file name. Just return the file name, or No_File
+                     --  if May_Fail is True.
 
                      elsif SFN_Patterns.Last = 2 then
-                        return Fnam;
+                        if May_Fail then
+                           return No_File;
+                        else
+                           return Fnam;
+                        end if;
 
                      --  The file does not exist, but there may be other
                      --  naming scheme. Keep on searching.


More information about the Gcc-patches mailing list