Bug#559447: gnat-4.4: extends keyword in project files seems to be broken
tags 559447 upstream help
thanks
Since it also happens in GNAT GPL 2009, this is definitely an upstream
problem; tagging accordingly.
However I am not sure this is really a GNAT project manager bug; the
documentation is unclear about what happens when extending a library
project file.
I would suppose that the project extension should also be a library
project file (i.e. with Library_Name and Library_Dir defined). In the
first test case, proj.gpr is a regular (application) project file that
"withs" the library project file xmlada.gpr; proj_ter.gpr is a virtual
extension ("extends all") of proj.gpr; it is unclear to me what a such a
project is: regular or library?
Per the doc, a project extension inherits the source directories of its
parent but the doc is silent about other directories, namely Object_Dir,
Library_Dir and especially Library_ALI_Dir. I think it would be
worthwhile asking the question upstream.
My gut feeling is that an application project should never extend,
directly or indirectly through "extends all", a library project. More
precisely:
application project "with" application project: OK
application project "with" library project: OK
application project "extends" library project: ERROR (1)
application project "extends" application project: OK
library project "with" application project: ERROR (2)
library project "with" library project: OK
library project "extends" library project: ERROR (3)
library project "extends" application project: ERROR (4)
(1) unless the application project recompiles the entire library,
without -fPIC, into the executables, which defeats the purpose of a
library entirely
(2) unless the library project recompiles the application sources, with
-fPIC, into its own Object_Dir and Library_ALI_Dir, which defeats the
purpose of the application project
(3) the extension replaces the parent, i.e. it should copy the parent's
ALI files into its own Library_ALI_Dir and link the parent's object
files into the library itself, which defeats the purpose of the parent
library; better merge the two projects into a single one.
(4) unless the library project recompiles all the application's source
files, with -fPIC, into its own Object_Dir, which defeats the purpose of
the application project
The first test case shown is, indirectly through "extends all" rather
than "extends", an example of (1). I think it should be an error. GNAT
does not diagnose this error and instead emits another error message
about a missing ALI file. I also think that "extends", as opposed to
"extends all", should work, i.e. an application project that extends
another application project (OK) which "withs" a library project (also
OK).
--
Ludovic Brenta.
Reply to: