summaryrefslogtreecommitdiff
path: root/gcc/ada/gnatbind.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2007-09-26 10:44:26 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2007-09-26 10:44:26 +0000
commitb2afe5ef0fc2e1d99ff312c80e1a4f73cb06b167 (patch)
tree9de288085d47932d60eac2b2ca05b2b741d4d76d /gcc/ada/gnatbind.adb
parente41e0253937dc242a0a4324c880e1e8a7b57738e (diff)
downloadgcc-b2afe5ef0fc2e1d99ff312c80e1a4f73cb06b167.tar.gz
2007-09-26 Vincent Celier <celier@adacore.com>
* gnatbind.adb: If there are several ALI files specified and there is a main program to bind, the first ALI is expected to contain the main subprogram and the names of the binder generated files will be derived from the first ALI file name. (Gnatbind): Fix insertion character in invocation of Error_Msg git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128793 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/gnatbind.adb')
-rw-r--r--gcc/ada/gnatbind.adb19
1 files changed, 18 insertions, 1 deletions
diff --git a/gcc/ada/gnatbind.adb b/gcc/ada/gnatbind.adb
index 7cc353d227b..8a166991c5c 100644
--- a/gcc/ada/gnatbind.adb
+++ b/gcc/ada/gnatbind.adb
@@ -64,6 +64,10 @@ procedure Gnatbind is
Main_Lib_File : File_Name_Type;
-- Current main library file
+ First_Main_Lib_File : File_Name_Type := No_File;
+ -- The first library file, that should be a main subprogram if neither -n
+ -- nor -z are used.
+
Std_Lib_File : File_Name_Type;
-- Standard library
@@ -593,6 +597,10 @@ begin
while More_Lib_Files loop
Main_Lib_File := Next_Main_Lib_File;
+ if First_Main_Lib_File = No_File then
+ First_Main_Lib_File := Main_Lib_File;
+ end if;
+
if Verbose_Mode then
if Check_Only then
Write_Str ("Checking: ");
@@ -683,6 +691,15 @@ begin
Set_Source_Table;
+ -- If there is main program to bind, set Main_Lib_File to the first
+ -- library file, and the name from which to derive the binder generate
+ -- file to the first ALI file.
+
+ if Bind_Main_Program then
+ Main_Lib_File := First_Main_Lib_File;
+ Set_Current_File_Name_Index (To => 1);
+ end if;
+
-- Check that main library file is a suitable main program
if Bind_Main_Program
@@ -690,7 +707,7 @@ begin
and then not No_Main_Subprogram
then
Error_Msg_File_1 := Main_Lib_File;
- Error_Msg ("% does not contain a unit that can be a main program");
+ Error_Msg ("{ does not contain a unit that can be a main program");
end if;
-- Perform consistency and correctness checks