[Ada] Fix bug in project manager

Arnaud Charlet charlet@adacore.com
Mon Sep 5 08:38:00 GMT 2005


Tested on i686-linux, committed on HEAD

When project files import other project files that have no Ada sources
(for example those produced by gnatname), adding to the object dir path
the default object dirs of these sourceless projects may end up in
an incorrect order for the object dirs in the object dir path.

2005-09-01  Vincent Celier  <celier@adacore.com>

	* prj-env.adb (Set_Ada_Paths.Add.Recursive_Add): Do not add the object
	directories of projects that have no Ada sources.

-------------- next part --------------
Index: prj-env.adb
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/prj-env.adb,v
retrieving revision 1.23
diff -u -p -r1.23 prj-env.adb
--- prj-env.adb	1 Jul 2005 01:25:32 -0000	1.23
+++ prj-env.adb	5 Sep 2005 07:30:44 -0000
@@ -32,7 +32,6 @@ with Prj.Com;  use Prj.Com;
 with Tempdir;
 
 with GNAT.Directory_Operations; use GNAT.Directory_Operations;
-with GNAT.OS_Lib;               use GNAT.OS_Lib;
 
 package body Prj.Env is
 
@@ -2138,9 +2137,15 @@ package body Prj.Env is
                            end if;
 
                         --  For a non-library project, add the object
-                        --  directory, if it is not a virtual project.
-
-                        elsif not Data.Virtual then
+                        --  directory, if it is not a virtual project, and
+                        --  if there are Ada sources. If there are no Ada
+                        --  sources, adding the object directory could
+                        --  disrupt the order of the object dirs in the path.
+
+                        elsif not Data.Virtual
+                          and then In_Tree.Projects.Table
+                                     (Project).Ada_Sources_Present
+                        then
                            Add_To_Object_Path
                              (Data.Object_Directory, In_Tree);
                         end if;


More information about the Gcc-patches mailing list