From 6db828c3c5271d23d037f55824d9d0a6c07497ab Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Fri, 24 Apr 2009 15:48:25 +0200 Subject: [multiple changes] 2009-04-24 Robert Dewar * errout.ads: Minor reformatting 2009-04-24 Emmanuel Briot * gnat_ugn.texi (Library Projects): add documentation on gnatmake's behavior when the project includes sources from multiple languages 2009-04-24 Vincent Celier * prj.adb (Has_Foreign_Sources): Returns True in Ada_Only mode if there is a language other than Ada declared. * makeutl.adb (Linker_Options_Switches): Call For_All_Projects with Imported_First set to True. From-SVN: r146722 --- gcc/ada/ChangeLog | 17 +++++++++++++++++ gcc/ada/errout.ads | 4 ++-- gcc/ada/gnat_ugn.texi | 24 +++++++++++++++++++++++- gcc/ada/makeutl.adb | 2 +- gcc/ada/prj.adb | 3 ++- 5 files changed, 45 insertions(+), 5 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 383d65c..ab3a3b7 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,20 @@ +2009-04-24 Robert Dewar + + * errout.ads: Minor reformatting + +2009-04-24 Emmanuel Briot + + * gnat_ugn.texi (Library Projects): add documentation on gnatmake's + behavior when the project includes sources from multiple languages + +2009-04-24 Vincent Celier + + * prj.adb (Has_Foreign_Sources): Returns True in Ada_Only mode if there + is a language other than Ada declared. + + * makeutl.adb (Linker_Options_Switches): Call For_All_Projects with + Imported_First set to True. + 2009-04-24 Ed Schonberg * sem_res.adb: additional optimization to inhibit creation of diff --git a/gcc/ada/errout.ads b/gcc/ada/errout.ads index bc86f15..41daf24 100644 --- a/gcc/ada/errout.ads +++ b/gcc/ada/errout.ads @@ -651,8 +651,8 @@ package Errout is -- suppressed. procedure Error_Msg_F (Msg : String; N : Node_Id); - -- Similar to Error_Msg_N except that the message is placed on the - -- first node of the construct N (First_Node (N)). + -- Similar to Error_Msg_N except that the message is placed on the first + -- node of the construct N (First_Node (N)). procedure Error_Msg_NE (Msg : String; diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index dc9a86d..df66228 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -13675,6 +13675,15 @@ operating system). for Spec ("MyPack.MyChild") use "mypack.mychild.spec"; @end smallexample +When the source file contains several units, you can indicate at what +position the unit occurs in the file, with the following. The first unit +in the file has index 1 + +@smallexample @c projectfile + for Body ("top") use "foo.a" at 1; + for Body ("foo") use "foo.a" at 2; +@end smallexample + @item @code{Body} You can use the associative array attribute @code{Body} to @@ -13698,7 +13707,20 @@ sensitive or insensitive depending on the operating system). @noindent @emph{Library projects} are projects whose object code is placed in a library. -(Note that this facility is not yet supported on all platforms) +(Note that this facility is not yet supported on all platforms). + +@code{gnatmake} or @code{gprbuild} will collect all object files into a +single archive, which might either be a shared or a static library. This +library can later on be linked with multiple executables, potentially +reducing their sizes. + +If your project file specifies languages other than Ada, but you are still +using @code{gnatmake} to compile and link, the latter will not try to +compile your sources other than Ada (you should use @code{gprbuild} if that +is your intent). However, @code{gnatmake} will automatically link all object +files found in the object directory, whether or not they were compiled from +an Ada source file. This specific behavior only applies when multiple +languages are specified. To create a library project, you need to define in its project file two project-level attributes: @code{Library_Name} and @code{Library_Dir}. diff --git a/gcc/ada/makeutl.adb b/gcc/ada/makeutl.adb index c5bd942..b1b8239 100644 --- a/gcc/ada/makeutl.adb +++ b/gcc/ada/makeutl.adb @@ -412,7 +412,7 @@ package body Makeutl is begin Linker_Opts.Init; - For_All_Projects (Project, In_Tree, Dummy); + For_All_Projects (Project, In_Tree, Dummy, Imported_First => True); Last_Linker_Option := 0; diff --git a/gcc/ada/prj.adb b/gcc/ada/prj.adb index ec2e646..dae628b 100644 --- a/gcc/ada/prj.adb +++ b/gcc/ada/prj.adb @@ -1231,7 +1231,8 @@ package body Prj is Lang := Data.Languages; while Lang /= No_Language_Index loop if Lang.Name /= Name_Ada - and then Lang.First_Source /= No_Source + and then + (Current_Mode = Ada_Only or else Lang.First_Source /= No_Source) then return True; end if; -- cgit v1.1