aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/makegpr.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2004-07-06 15:57:33 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2004-07-06 15:57:33 +0200
commit15ce9ca22bc2a1c9986fee07fe3b41980b2f9665 (patch)
tree242c4d5505932ff31c97e368e02a5597dee1c5a9 /gcc/ada/makegpr.adb
parentef5732117a3c18e1ba3dc3670e6933f3c795dfcf (diff)
downloadgcc-15ce9ca22bc2a1c9986fee07fe3b41980b2f9665.zip
gcc-15ce9ca22bc2a1c9986fee07fe3b41980b2f9665.tar.gz
gcc-15ce9ca22bc2a1c9986fee07fe3b41980b2f9665.tar.bz2
[multiple changes]
2004-07-06 Vincent Celier <celier@gnat.com> * vms_conv.ads: Minor reformatting. Alphabetical order for enumerated values of type Command_Type, to have the command in alphabetical order for the usage. * vms_conv.adb (Process_Argument): Set Keep_Temporary_Files to True for the special qualifier /KEEP_TEMPORARY_FILES (minimum 6 characters). * gnat_ugn.texi: Document new switch -dn for the GNAT driver. * makegpr.adb (Global_Archive_Exists): New global Boolean variable (Add_Archive_Path): Only add the global archive if there is one. (Build_Global_Archive): Set Global_Archive_Exists depending if there is or not any object file to put in the global archive, and don't build a global archive if there is none. (X_Switches): New table (Compile_Link_With_Gnatmake): Pass to gnatmake the -X switches stored in the X_Switches table, if any. (Initialize): Make sure the X_Switches table is empty (Scan_Arg): Record -X switches in table X_Switches * opt.ads (Keep_Temporary_Files): New Boolean flag, defaulted to False. * make.adb: Minor comment fix * gnatname.adb (Gnatname): When not on VMS, and gnatname has been invoked with directory information, add the directory in front of the path. * gnatchop.adb (Gnatchop): When not on VMS, and gnatchop has been invoked with directory information, add the directory in front of the path. * gnatcmd.adb (Delete_Temp_Config_Files): Only delete temporary files when Keep_Temporary_Files is False. (GNATCmd): When not on VMS, and the GNAT driver has been invoked with directory information, add the directory in front of the path. When not on VMS, handle new switch -dn before the command to set Keep_Temporary_Files to True. (Non_VMS_Usage): Use lower case for the non VMS usage: this is valid everywhere. * gnatlink.adb (Gnatlink): When not on VMS, and gnatlink has been invoked with directory information, add the directory in front of the path. 2004-07-06 Thomas Quinot <quinot@act-europe.fr> * snames.ads, snames.adb (Name_Stub): New name for the distributed systems annex. * rtsfind.ads: New RTE TC_Object, for DSA/PolyORB. New RTEs RAS_Proxy_Type and RAS_Proxy_Type_Access, for DSA. * g-socket.adb (To_Timeval): Fix incorrect conversion of Selector_Duration to Timeval for the case of 0.0. * exp_util.ads (Evolve_Or_Else): Fix overenthusiastic copy/paste of documentation from Evolve_And_Then. 2004-07-06 Jose Ruiz <ruiz@act-europe.fr> * s-taprop-tru64.adb, s-taprop-os2.adb, s-taprop-mingw.adb, s-taprop-posix.adb: Update comment. 2004-07-06 Robert Dewar <dewar@gnat.com> * s-osinte-hpux.ads, s-osinte-freebsd.ads, s-osinte-lynxos.ads, s-taprop-lynxos.adb, s-osinte-tru64.ads, s-osinte-aix.ads, s-osinte-irix.ads, s-taprop-irix.adb, s-interr-sigaction.adb, s-taprop-irix-athread.adb, s-osinte-hpux-dce.adb, s-taprop-hpux-dce.adb, s-taprop-linux.adb, s-taprop-dummy.adb, s-taprop-solaris.adb, s-interr-vms.adb, s-osinte-vms.ads, s-taprop-vms.adb, s-osinte-vxworks.ads, s-osprim-vxworks.adb, a-numaux-x86.adb, a-except.adb, a-exexpr.adb, a-intsig.adb, a-tags.adb, a-tags.ads, bindgen.ads, checks.adb, checks.adb, csets.ads, einfo.ads, einfo.ads, elists.adb, exp_ch4.adb, exp_ch7.adb, exp_dist.adb, exp_util.adb, freeze.adb, g-dynhta.adb, gnatmem.adb, g-regexp.adb, inline.adb, i-os2thr.ads, osint.adb, prj.adb, scng.adb, sem_cat.adb, sem_ch10.adb, sem_ch12.adb, sem_ch4.adb, sem_ch7.adb, sem_ch8.adb, sem_disp.adb, sem_prag.adb, sem_res.adb, sem_type.adb, sem_type.ads, sem_warn.adb, s-ficobl.ads, s-finimp.adb, s-htable.adb, sinfo.ads, sinput-l.ads, s-interr.adb, s-interr.ads, sprint.adb, s-tarest.adb, s-tasini.ads, s-taskin.ads, s-taskin.ads, uname.adb, vms_data.ads: Minor reformatting, Fix bad box comment format. * gnat_rm.texi: Fix minor grammatical error * sem_attr.adb, exp_attr.adb: New attribute Has_Access_Values * sem_util.ads, sem_util.adb (Requires_Transient_Scope): Allow many more cases of discriminated records to be recognized as not needing a secondary stack. (Has_Access_Values): New function. * snames.h, snames.adb, snames.ads: New attribute Has_Access_Values * cstand.adb, layout.ads, layout.adb, sem_ch13.ads: Change name Set_Prim_Alignment to Set_Elem_Alignment (more accurate correspondence with LRM terminology). Change terminology in comments primitive type => elementary type. 2004-07-06 Ed Schonberg <schonberg@gnat.com> PR ada/15602 * sem_ch7.adb (Unit_Requires_Body): For a generic package, the formal parameters do not impose any requirements on the presence of a body. 2004-07-06 Ed Schonberg <schonberg@gnat.com> PR ada/15593 * sem_ch12.adb (Analyze_Package_Instantiation): If the generic is not a compilation unit and is in an open scope at the point of instantiation, assume that a body may be present later. 2004-07-06 Ed Schonberg <schonberg@gnat.com> * sem_ch13.adb (Analyze_Attribute_Definition_Clause, case 'Size): Improve error message when specified size is not supported. * sem_ch6.adb (Maybe_Primitive_Operation): A library-level subprogram is never a primitive operation. From-SVN: r84152
Diffstat (limited to 'gcc/ada/makegpr.adb')
-rw-r--r--gcc/ada/makegpr.adb160
1 files changed, 98 insertions, 62 deletions
diff --git a/gcc/ada/makegpr.adb b/gcc/ada/makegpr.adb
index ea50488..61f96f2 100644
--- a/gcc/ada/makegpr.adb
+++ b/gcc/ada/makegpr.adb
@@ -212,6 +212,15 @@ package body Makegpr is
Hash => Hash,
Equal => "=");
+ package X_Switches is new Table.Table
+ (Table_Component_Type => String_Access,
+ Table_Index_Type => Integer,
+ Table_Low_Bound => 1,
+ Table_Initial => 2,
+ Table_Increment => 100,
+ Table_Name => "Makegpr.X_Switches");
+ -- Table to store the -X switches to be passed to gnatmake
+
Initial_Argument_Count : constant Positive := 20;
type Boolean_Array is array (Positive range <>) of Boolean;
type Booleans is access Boolean_Array;
@@ -305,6 +314,10 @@ package body Makegpr is
Need_To_Relink : Boolean := False;
-- True when an executable of a language other than Ada need to be linked
+ Global_Archive_Exists : Boolean := False;
+ -- True if there is a non empty global archive, to prevent creation
+ -- of such archives.
+
Path_Option : String_Access;
-- The path option switch, when supported
@@ -567,9 +580,9 @@ package body Makegpr is
end if;
-- For a non-library project, the only archive needed
- -- is the one for the main project.
+ -- is the one for the main project, if there is one.
- elsif Project = Main_Project then
+ elsif Project = Main_Project and then Global_Archive_Exists then
Add_Argument
(Get_Name_String (Data.Object_Directory) &
Directory_Separator &
@@ -1157,11 +1170,6 @@ package body Makegpr is
-- Archive needs to be rebuilt
else
- -- If the archive is built, then linking will need to occur
- -- unconditionally.
-
- Need_To_Relink := True;
-
-- If archive already exists, first delete it
-- Comment needed on why we discard result???
@@ -1208,86 +1216,100 @@ package body Makegpr is
end if;
end loop;
- -- Spawn the archive builder (ar)
+ -- No need to create a global archive, if there is no object
+ -- file to put into.
- Saved_Last_Argument := Last_Argument;
+ Global_Archive_Exists := Last_Argument > First_Object;
- Last_Argument := First_Object + Max_In_Archives;
+ if Global_Archive_Exists then
+ -- If the archive is built, then linking will need to occur
+ -- unconditionally.
- loop
- if Last_Argument > Saved_Last_Argument then
- Last_Argument := Saved_Last_Argument;
- end if;
+ Need_To_Relink := True;
- Display_Command (Archive_Builder, Archive_Builder_Path);
+ -- Spawn the archive builder (ar)
- Spawn
- (Archive_Builder_Path.all,
- Arguments (1 .. Last_Argument),
- Success);
+ Saved_Last_Argument := Last_Argument;
- exit when not Success;
+ Last_Argument := First_Object + Max_In_Archives;
- exit when Last_Argument = Saved_Last_Argument;
+ loop
+ if Last_Argument > Saved_Last_Argument then
+ Last_Argument := Saved_Last_Argument;
+ end if;
- Arguments (1) := r;
- Arguments (3 .. Saved_Last_Argument - Last_Argument + 2) :=
- Arguments (Last_Argument + 1 .. Saved_Last_Argument);
- Saved_Last_Argument := Saved_Last_Argument - Last_Argument + 2;
- end loop;
+ Display_Command (Archive_Builder, Archive_Builder_Path);
- -- If the archive was built, run the archive indexer (ranlib)
- -- if there is one.
+ Spawn
+ (Archive_Builder_Path.all,
+ Arguments (1 .. Last_Argument),
+ Success);
- if Success then
+ exit when not Success;
- -- If the archive was built, run the archive indexer (ranlib),
+ exit when Last_Argument = Saved_Last_Argument;
+
+ Arguments (1) := r;
+ Arguments (3 .. Saved_Last_Argument - Last_Argument + 2) :=
+ Arguments (Last_Argument + 1 .. Saved_Last_Argument);
+ Saved_Last_Argument := Saved_Last_Argument - Last_Argument + 2;
+ end loop;
+
+ -- If the archive was built, run the archive indexer (ranlib)
-- if there is one.
- if Archive_Indexer_Path /= null then
- Last_Argument := 0;
- Add_Argument (Archive_Name, True);
+ if Success then
- Display_Command (Archive_Indexer, Archive_Indexer_Path);
+ -- If the archive was built, run the archive indexer (ranlib),
+ -- if there is one.
- Spawn (Archive_Indexer_Path.all, Arguments (1 .. 1), Success);
+ if Archive_Indexer_Path /= null then
+ Last_Argument := 0;
+ Add_Argument (Archive_Name, True);
- if not Success then
+ Display_Command (Archive_Indexer, Archive_Indexer_Path);
- -- Running ranlib failed, delete the dependency file,
- -- if it exists.
+ Spawn
+ (Archive_Indexer_Path.all, Arguments (1 .. 1), Success);
- if Is_Regular_File (Archive_Dep_Name) then
- Delete_File (Archive_Dep_Name, Success);
- end if;
+ if not Success then
+
+ -- Running ranlib failed, delete the dependency file,
+ -- if it exists.
+
+ if Is_Regular_File (Archive_Dep_Name) then
+ Delete_File (Archive_Dep_Name, Success);
+ end if;
- -- And report the error
+ -- And report the error
- Report_Error
- ("running" & Archive_Indexer & " for project """,
- Get_Name_String (Data.Name),
- """ failed");
- return;
+ Report_Error
+ ("running" & Archive_Indexer & " for project """,
+ Get_Name_String (Data.Name),
+ """ failed");
+ return;
+ end if;
end if;
- end if;
- -- The archive was correctly built, create its dependency file
+ -- The archive was correctly built, create its dependency file
- Create_Global_Archive_Dependency_File (Archive_Dep_Name);
+ Create_Global_Archive_Dependency_File (Archive_Dep_Name);
- -- Building the archive failed, delete dependency file if one exists
+ -- Building the archive failed, delete dependency file if one
+ -- exists.
- else
- if Is_Regular_File (Archive_Dep_Name) then
- Delete_File (Archive_Dep_Name, Success);
- end if;
+ else
+ if Is_Regular_File (Archive_Dep_Name) then
+ Delete_File (Archive_Dep_Name, Success);
+ end if;
- -- And report the error
+ -- And report the error
- Report_Error
- ("building archive for project """,
- Get_Name_String (Data.Name),
- """ failed");
+ Report_Error
+ ("building archive for project """,
+ Get_Name_String (Data.Name),
+ """ failed");
+ end if;
end if;
end if;
end Build_Global_Archive;
@@ -2316,6 +2338,12 @@ package body Makegpr is
Add_Argument (Dash_P, True);
Add_Argument (Get_Name_String (Data.Path_Name), True);
+ -- Add the -X switches, if any
+
+ for Index in 1 .. X_Switches.Last loop
+ Add_Argument (X_Switches.Table (Index), True);
+ end loop;
+
-- If Mains_Specified is True, find the mains in package Mains
if Mains_Specified then
@@ -3008,6 +3036,10 @@ package body Makegpr is
Add_Str_To_Name_Buffer ("compiler_command");
Name_Compiler_Command := Name_Find;
+ -- Make sure the -X switch table is empty
+
+ X_Switches.Set_Last (0);
+
-- Get the command line arguments
Scan_Args : for Next_Arg in 1 .. Argument_Count loop
@@ -3807,7 +3839,7 @@ package body Makegpr is
Osint.Fail
("switch -o not allowed within a -largs. Use -o directly.");
- -- If current processor is not gprmake dirrectly, store the option in
+ -- If current processor is not gprmake directly, store the option in
-- the appropriate table.
elsif Current_Processor /= None then
@@ -3877,7 +3909,11 @@ package body Makegpr is
then
-- Is_External_Assignment has side effects when it returns True
- null;
+ -- Record the -X switch, so that they can be passed to gnatmake,
+ -- if gnatmake is called.
+
+ X_Switches.Increment_Last;
+ X_Switches.Table (X_Switches.Last) := new String'(Arg);
else
Osint.Fail ("illegal option """, Arg, """");