diff mbox

[Ada] Wrong subunit source used in extending project

Message ID 20110902095345.GA31325@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Sept. 2, 2011, 9:53 a.m. UTC
When a subunit source file in a project being extended is replaced with
one in the extending project with a different source file name, the
subunit source in the project being extended is still used.
This patch fixes this. The test is to use a subunit source
pkg-execute.adb in a project being extended and a replacing subunit
source pkg-execute.bdy (with the correct declaration in package Naming)
in the extending project and to verify that the correct procedure
Pkg.Execute is executed.

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

2011-09-02  Vincent Celier  <celier@adacore.com>

	* prj-conf.adb (Add_Default_GNAT_Naming_Scheme): Declare "gcc"
	as the compiler driver so Is_Compilable returns True for sources.
	* prj-nmsc.adb (Override_Kind): When Kind is Sep, set the source
	for the body.
diff mbox

Patch

Index: prj-nmsc.adb
===================================================================
--- prj-nmsc.adb	(revision 178457)
+++ prj-nmsc.adb	(working copy)
@@ -6766,8 +6766,13 @@ 
                        & " kind=" & Source.Kind'Img);
       end if;
 
-      if Source.Kind in Spec_Or_Body and then Source.Unit /= null then
-         Source.Unit.File_Names (Source.Kind) := Source;
+      if Source.Unit /= null then
+         if Source.Kind = Spec then
+            Source.Unit.File_Names (Spec) := Source;
+
+         else
+            Source.Unit.File_Names (Impl) := Source;
+         end if;
       end if;
    end Override_Kind;
 
Index: prj-conf.adb
===================================================================
--- prj-conf.adb	(revision 178446)
+++ prj-conf.adb	(working copy)
@@ -436,6 +436,8 @@ 
 
          Compiler := Create_Package (Project_Tree, Config_File, "compiler");
          Create_Attribute
+           (Name_Driver, "gcc", "ada", Pkg => Compiler);
+         Create_Attribute
            (Name_Language_Kind, "unit_based", "ada", Pkg => Compiler);
          Create_Attribute
            (Name_Dependency_Kind, "ALI_File", "ada", Pkg => Compiler);