public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Wrong subunit source used in extending project
@ 2011-09-02  9:54 Arnaud Charlet
  0 siblings, 0 replies; only message in thread
From: Arnaud Charlet @ 2011-09-02  9:54 UTC (permalink / raw)
  To: gcc-patches; +Cc: Vincent Celier

[-- Attachment #1: Type: text/plain, Size: 805 bytes --]

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.


[-- Attachment #2: difs --]
[-- Type: text/plain, Size: 1173 bytes --]

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);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-09-02  9:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-02  9:54 [Ada] Wrong subunit source used in extending project Arnaud Charlet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).