Commit a21d245c by Arnaud Charlet

[multiple changes]

2014-08-01  Robert Dewar  <dewar@adacore.com>

	* make.adb, makeutl.ads: Minor reformatting.
	* debug.adb, opt.ads: Clarify documentation of Front_End_Inlining and
	Back_End_Inlining.

2014-08-01  Tristan Gingold  <gingold@adacore.com>

	* gnatcmd.adb (GNATCmd): Set AAMP_On_Target using command name.

From-SVN: r213453
parent 0f345950
2014-08-01 Robert Dewar <dewar@adacore.com>
* make.adb, makeutl.ads: Minor reformatting.
* debug.adb, opt.ads: Clarify documentation of Front_End_Inlining and
Back_End_Inlining.
2014-08-01 Tristan Gingold <gingold@adacore.com>
* gnatcmd.adb (GNATCmd): Set AAMP_On_Target using command name.
2014-08-01 Javier Miranda <miranda@adacore.com> 2014-08-01 Javier Miranda <miranda@adacore.com>
* gnat1drv.adb (Adjust_Global_Switches): Reverse meaning of * gnat1drv.adb (Adjust_Global_Switches): Reverse meaning of
......
...@@ -116,7 +116,7 @@ package body Debug is ...@@ -116,7 +116,7 @@ package body Debug is
-- d.w Do not check for infinite loops -- d.w Do not check for infinite loops
-- d.x No exception handlers -- d.x No exception handlers
-- d.y -- d.y
-- d.z Disable support for back end inlining -- d.z Restore previous support for frontend handling of Inline_Always
-- d.A Read/write Aspect_Specifications hash table to tree -- d.A Read/write Aspect_Specifications hash table to tree
-- d.B -- d.B
...@@ -582,14 +582,12 @@ package body Debug is ...@@ -582,14 +582,12 @@ package body Debug is
-- fully compiled and analyzed, they just get eliminated from the -- fully compiled and analyzed, they just get eliminated from the
-- code generation step. -- code generation step.
-- d.z Disable back end inlining. Back end inlining is enabled by default -- d.z Restore previous front-end support for Inline_Always. In default
-- on targets that have the GCC backend (ie. all targets except AAMP, -- mode, for targets that use the GCC back end (i.e. currently all
-- .NET and JVM). Back end inlining has no effect under GNATprove to -- targets except AAMP, .NET, JVM, and GNATprove), Inline_Always is
-- avoid confusing the formal verification output, and it is disabled -- handled by the back end. Use of this switch restores the previous
-- if the sources are compiled with frontend inlining (ie. -gnatN) to -- handling of Inline_Always by the front end on such targets. For the
-- minimize the output differences to customers still using this -- targets that do not use the GCC back end, this switch is ignored.
-- deprecated switch. The flag .z facilitates disabling the back end
-- inlining in case of unexpected problems.
-- d.A There seems to be a problem with ASIS if we activate the circuit -- d.A There seems to be a problem with ASIS if we activate the circuit
-- for reading and writing the aspect specification hash table, so -- for reading and writing the aspect specification hash table, so
......
...@@ -1584,15 +1584,12 @@ begin ...@@ -1584,15 +1584,12 @@ begin
Rules_Switches.Init; Rules_Switches.Init;
Rules_Switches.Set_Last (0); Rules_Switches.Set_Last (0);
-- Add the default search directories, to be able to find system.ads in the -- Set AAMP_On_Target from the command name, for testing in
-- subsequent call to Targparm.Get_Target_Parameters. -- Osint.Program_Name to handle the mapping of GNAAMP tool names. We don't
-- extract it from system.ads, has there may be no default runtime.
Add_Default_Search_Dirs; Find_Program_Name;
AAMP_On_Target := Name_Buffer (1 .. Name_Len) = "gnaampcmd";
-- Get target parameters so that AAMP_On_Target will be set, for testing in
-- Osint.Program_Name to handle the mapping of GNAAMP tool names.
Targparm.Get_Target_Parameters;
-- Put the command line in environment variable GNAT_DRIVER_COMMAND_LINE, -- Put the command line in environment variable GNAT_DRIVER_COMMAND_LINE,
-- so that the spawned tool may know the way the GNAT driver was invoked. -- so that the spawned tool may know the way the GNAT driver was invoked.
......
...@@ -68,9 +68,9 @@ with Targparm; use Targparm; ...@@ -68,9 +68,9 @@ with Targparm; use Targparm;
with Tempdir; with Tempdir;
with Types; use Types; with Types; use Types;
with Ada.Command_Line; use Ada.Command_Line; with Ada.Command_Line; use Ada.Command_Line;
with Ada.Directories; with Ada.Directories;
with Ada.Exceptions; use Ada.Exceptions; with Ada.Exceptions; use Ada.Exceptions;
with GNAT.Case_Util; use GNAT.Case_Util; with GNAT.Case_Util; use GNAT.Case_Util;
with GNAT.Command_Line; use GNAT.Command_Line; with GNAT.Command_Line; use GNAT.Command_Line;
...@@ -1986,7 +1986,7 @@ package body Make is ...@@ -1986,7 +1986,7 @@ package body Make is
D_Chk : D_Chk :
for D in ALIs.Table (ALI).First_Sdep .. for D in ALIs.Table (ALI).First_Sdep ..
ALIs.Table (ALI).Last_Sdep ALIs.Table (ALI).Last_Sdep
loop loop
Dep := Sdep.Table (D); Dep := Sdep.Table (D);
UID := Units_Htable.Get_First (Project_Tree.Units_HT); UID := Units_Htable.Get_First (Project_Tree.Units_HT);
...@@ -2285,8 +2285,7 @@ package body Make is ...@@ -2285,8 +2285,7 @@ package body Make is
if Arguments_Project = No_Project then if Arguments_Project = No_Project then
Add_Arguments (The_Saved_Gcc_Switches.all); Add_Arguments (The_Saved_Gcc_Switches.all);
elsif not Arguments_Project.Externally_Built elsif not Arguments_Project.Externally_Built or else Must_Compile
or else Must_Compile
then then
-- We get the project directory for the relative path -- We get the project directory for the relative path
-- switches and arguments. -- switches and arguments.
...@@ -2339,7 +2338,6 @@ package body Make is ...@@ -2339,7 +2338,6 @@ package body Make is
-- plus the saved gcc switches. -- plus the saved gcc switches.
when List => when List =>
declare declare
Current : String_List_Id := Switches.Values; Current : String_List_Id := Switches.Values;
Element : String_Element; Element : String_Element;
...@@ -3977,11 +3975,11 @@ package body Make is ...@@ -3977,11 +3975,11 @@ package body Make is
-- Reset Temporary_Config_File to False so that the eventual -- Reset Temporary_Config_File to False so that the eventual
-- other -gnatec switches will be displayed. -- other -gnatec switches will be displayed.
if (not Opt.Keep_Temporary_Files) if not Opt.Keep_Temporary_Files
and then Temporary_Config_File and then Temporary_Config_File
and then Args (J)'Length > 7 and then Args (J)'Length > 7
and then Args (J) (Args (J)'First .. Args (J)'First + 6) and then Args (J) (Args (J)'First .. Args (J)'First + 6) =
= "-gnatec" "-gnatec"
then then
Temporary_Config_File := False; Temporary_Config_File := False;
...@@ -4001,6 +3999,7 @@ package body Make is ...@@ -4001,6 +3999,7 @@ package body Make is
if Debug.Debug_Flag_F then if Debug.Debug_Flag_F then
declare declare
Equal_Pos : Natural; Equal_Pos : Natural;
begin begin
Equal_Pos := Args (J)'First - 1; Equal_Pos := Args (J)'First - 1;
for K in Args (J)'Range loop for K in Args (J)'Range loop
...@@ -4109,6 +4108,8 @@ package body Make is ...@@ -4109,6 +4108,8 @@ package body Make is
procedure Globalize_Dirs is new procedure Globalize_Dirs is new
Prj.Env.For_All_Object_Dirs (Globalize_Dir); Prj.Env.For_All_Object_Dirs (Globalize_Dir);
-- Start of procedure Globalize
begin begin
Success := True; Success := True;
Display (Globalizer, Globalizer_Args); Display (Globalizer, Globalizer_Args);
...@@ -4200,9 +4201,7 @@ package body Make is ...@@ -4200,9 +4201,7 @@ package body Make is
end loop; end loop;
for Index in 1 .. Library_Projs.Last loop for Index in 1 .. Library_Projs.Last loop
if if Library_Projs.Table (Index).Extended_By = No_Project then
Library_Projs.Table (Index).Extended_By = No_Project
then
if Library_Projs.Table (Index).Library_Kind = Static then if Library_Projs.Table (Index).Library_Kind = Static then
Linker_Switches.Increment_Last; Linker_Switches.Increment_Last;
Linker_Switches.Table (Linker_Switches.Last) := Linker_Switches.Table (Linker_Switches.Last) :=
...@@ -4279,8 +4278,7 @@ package body Make is ...@@ -4279,8 +4278,7 @@ package body Make is
-- We are going to create one switch of the form -- We are going to create one switch of the form
-- "-Wl,-rpath,dir_1:dir_2:dir_3" -- "-Wl,-rpath,dir_1:dir_2:dir_3"
for Index in for Index in Library_Paths.First .. Library_Paths.Last
Library_Paths.First .. Library_Paths.Last
loop loop
-- Add the length of the library dir plus one for the -- Add the length of the library dir plus one for the
-- directory separator. -- directory separator.
...@@ -4300,8 +4298,7 @@ package body Make is ...@@ -4300,8 +4298,7 @@ package body Make is
-- Put each library dir followed by a dir -- Put each library dir followed by a dir
-- separator. -- separator.
for Index in for Index in Library_Paths.First .. Library_Paths.Last
Library_Paths.First .. Library_Paths.Last
loop loop
Option Option
(Current + 1 .. (Current + 1 ..
...@@ -4392,8 +4389,8 @@ package body Make is ...@@ -4392,8 +4389,8 @@ package body Make is
-- need to do the duplication since the arguments will get -- need to do the duplication since the arguments will get
-- normalized. Not doing so will result in calling normalized -- normalized. Not doing so will result in calling normalized
-- two times for the same set of arguments if gnatmake is -- two times for the same set of arguments if gnatmake is
-- passed multiple mains. This can result in the wrong argument -- passed multiple mains. This can result in the wrong
-- being passed to the linker. -- argument being passed to the linker.
else else
Last_Arg := Last_Arg + 1; Last_Arg := Last_Arg + 1;
...@@ -4414,6 +4411,7 @@ package body Make is ...@@ -4414,6 +4411,7 @@ package body Make is
declare declare
Success : Boolean := False; Success : Boolean := False;
begin begin
-- If gnatmake was invoked with --subdirs and no project file, -- If gnatmake was invoked with --subdirs and no project file,
-- put the executable in the subdirectory specified. -- put the executable in the subdirectory specified.
...@@ -4431,9 +4429,7 @@ package body Make is ...@@ -4431,9 +4429,7 @@ package body Make is
Successful_Links.Increment_Last; Successful_Links.Increment_Last;
Successful_Links.Table (Successful_Links.Last) := Main_ALI_File; Successful_Links.Table (Successful_Links.Last) := Main_ALI_File;
elsif Osint.Number_Of_Files = 1 elsif Osint.Number_Of_Files = 1 or else not Keep_Going then
or else not Keep_Going
then
Make_Failed ("*** link failed."); Make_Failed ("*** link failed.");
else else
...@@ -4603,8 +4599,7 @@ package body Make is ...@@ -4603,8 +4599,7 @@ package body Make is
Proj1 : Project_List; Proj1 : Project_List;
procedure Add_To_Library_Projs (Proj : Project_Id); procedure Add_To_Library_Projs (Proj : Project_Id);
-- Add project Project to table Library_Projs in -- Add project Project to table Library_Projs in decreasing depth order
-- decreasing depth order.
-------------------------- --------------------------
-- Add_To_Library_Projs -- -- Add_To_Library_Projs --
...@@ -4749,7 +4744,6 @@ package body Make is ...@@ -4749,7 +4744,6 @@ package body Make is
Stop_Compile : out Boolean) Stop_Compile : out Boolean)
is is
Args : Argument_List (1 .. Gcc_Switches.Last); Args : Argument_List (1 .. Gcc_Switches.Last);
First_Compiled_File : File_Name_Type; First_Compiled_File : File_Name_Type;
Youngest_Obj_File : File_Name_Type; Youngest_Obj_File : File_Name_Type;
Youngest_Obj_Stamp : Time_Stamp_Type; Youngest_Obj_Stamp : Time_Stamp_Type;
...@@ -5081,8 +5075,7 @@ package body Make is ...@@ -5081,8 +5075,7 @@ package body Make is
-- If there is no object directory, then it will be -- If there is no object directory, then it will be
-- impossible to build the library, so fail immediately. -- impossible to build the library, so fail immediately.
if Proj.Project.Object_Directory = if Proj.Project.Object_Directory = No_Path_Information
No_Path_Information
then then
Make_Failed Make_Failed
("no object files to build library for" ("no object files to build library for"
...@@ -5207,6 +5200,10 @@ package body Make is ...@@ -5207,6 +5200,10 @@ package body Make is
-- Handles builder and global compilation switches, as read from the -- Handles builder and global compilation switches, as read from the
-- project file. -- project file.
-------------------------
-- Add_Global_Switches --
-------------------------
function Add_Global_Switches function Add_Global_Switches
(Switch : String; (Switch : String;
For_Lang : Name_Id; For_Lang : Name_Id;
...@@ -5214,6 +5211,7 @@ package body Make is ...@@ -5214,6 +5211,7 @@ package body Make is
Has_Global_Compilation_Switches : Boolean) return Boolean Has_Global_Compilation_Switches : Boolean) return Boolean
is is
pragma Unreferenced (For_Lang); pragma Unreferenced (For_Lang);
begin begin
if For_Builder then if For_Builder then
Program_Args := None; Program_Args := None;
...@@ -5230,12 +5228,15 @@ package body Make is ...@@ -5230,12 +5228,15 @@ package body Make is
end Add_Global_Switches; end Add_Global_Switches;
procedure Do_Compute_Builder_Switches procedure Do_Compute_Builder_Switches
is new Makeutl.Compute_Builder_Switches (Add_Global_Switches); is new Makeutl.Compute_Builder_Switches (Add_Global_Switches);
-- Start of processing for Compute_Switches_For_Main
begin begin
if Main_Project /= No_Project then if Main_Project /= No_Project then
declare declare
Main_Source_File_Name : constant String := Main_Source_File_Name : constant String :=
Get_Name_String (Main_Source_File); Get_Name_String (Main_Source_File);
Main_Unit_File_Name : constant String := Main_Unit_File_Name : constant String :=
Prj.Env.File_Name_Of_Library_Unit_Body Prj.Env.File_Name_Of_Library_Unit_Body
...@@ -5366,6 +5367,7 @@ package body Make is ...@@ -5366,6 +5367,7 @@ package body Make is
declare declare
Dir_Path : constant String := Dir_Path : constant String :=
Get_Name_String (Main_Project.Directory.Display_Name); Get_Name_String (Main_Project.Directory.Display_Name);
begin begin
for J in Last_Binder_Switch + 1 .. Binder_Switches.Last loop for J in Last_Binder_Switch + 1 .. Binder_Switches.Last loop
Ensure_Absolute_Path Ensure_Absolute_Path
...@@ -5473,6 +5475,7 @@ package body Make is ...@@ -5473,6 +5475,7 @@ package body Make is
Real_Main_Project : Project_Id := No_Project; Real_Main_Project : Project_Id := No_Project;
Info : Main_Info; Info : Main_Info;
Proj : Project_Id; Proj : Project_Id;
begin begin
if Mains.Number_Of_Mains (Project_Tree) = 0 if Mains.Number_Of_Mains (Project_Tree) = 0
and then not Unique_Compile and then not Unique_Compile
...@@ -5641,7 +5644,6 @@ package body Make is ...@@ -5641,7 +5644,6 @@ package body Make is
-- else gnatmake was invoked with the switch "-u". -- else gnatmake was invoked with the switch "-u".
if Value = Prj.Nil_String or else Unique_Compile then if Value = Prj.Nil_String or else Unique_Compile then
if not Make_Steps if not Make_Steps
or Compile_Only or Compile_Only
or not Main_Project.Library or not Main_Project.Library
...@@ -5788,9 +5790,7 @@ package body Make is ...@@ -5788,9 +5790,7 @@ package body Make is
if Osint.Number_Of_Files = 0 then if Osint.Number_Of_Files = 0 then
if Main_Project /= No_Project and then Main_Project.Library then if Main_Project /= No_Project and then Main_Project.Library then
if Do_Bind_Step if Do_Bind_Step and then Main_Project.Standalone_Library = No then
and then Main_Project.Standalone_Library = No
then
Make_Failed ("only stand-alone libraries may be bound"); Make_Failed ("only stand-alone libraries may be bound");
end if; end if;
...@@ -5982,7 +5982,7 @@ package body Make is ...@@ -5982,7 +5982,7 @@ package body Make is
if Current_Main_Index = 0 if Current_Main_Index = 0
and then Unique_Compile and then Unique_Compile
and then Main_Project /= No_Project and then Main_Project /= No_Project
then then
-- If this is a multi-unit source, do not compile it as is (ie -- If this is a multi-unit source, do not compile it as is (ie
-- without specifying which unit to compile) -- without specifying which unit to compile)
...@@ -5996,9 +5996,7 @@ package body Make is ...@@ -5996,9 +5996,7 @@ package body Make is
Index => Current_Main_Index, Index => Current_Main_Index,
In_Imported_Only => True); In_Imported_Only => True);
begin begin
if Source /= No_Source if Source /= No_Source and then Source.Index /= 0 then
and then Source.Index /= 0
then
goto Next_Main; goto Next_Main;
end if; end if;
end; end;
...@@ -6090,26 +6088,28 @@ package body Make is ...@@ -6090,26 +6088,28 @@ package body Make is
begin begin
Proj := Project_Tree.Projects; Proj := Project_Tree.Projects;
while Proj /= null loop while Proj /= null loop
Data := new Project_Compilation_Data' Data :=
(Mapping_File_Names => new Temp_Path_Names new Project_Compilation_Data'
(1 .. Saved_Maximum_Processes), (Mapping_File_Names =>
Last_Mapping_File_Names => 0, new Temp_Path_Names (1 .. Saved_Maximum_Processes),
Free_Mapping_File_Indexes => new Free_File_Indexes Last_Mapping_File_Names => 0,
(1 .. Saved_Maximum_Processes), Free_Mapping_File_Indexes =>
Last_Free_Indexes => 0); new Free_File_Indexes (1 .. Saved_Maximum_Processes),
Last_Free_Indexes => 0);
Project_Compilation_Htable.Set Project_Compilation_Htable.Set
(Project_Compilation, Proj.Project, Data); (Project_Compilation, Proj.Project, Data);
Proj := Proj.Next; Proj := Proj.Next;
end loop; end loop;
Data := new Project_Compilation_Data' Data :=
(Mapping_File_Names => new Temp_Path_Names new Project_Compilation_Data'
(1 .. Saved_Maximum_Processes), (Mapping_File_Names =>
Last_Mapping_File_Names => 0, new Temp_Path_Names (1 .. Saved_Maximum_Processes),
Free_Mapping_File_Indexes => new Free_File_Indexes Last_Mapping_File_Names => 0,
(1 .. Saved_Maximum_Processes), Free_Mapping_File_Indexes =>
Last_Free_Indexes => 0); new Free_File_Indexes (1 .. Saved_Maximum_Processes),
Last_Free_Indexes => 0);
Project_Compilation_Htable.Set Project_Compilation_Htable.Set
(Project_Compilation, No_Project, Data); (Project_Compilation, No_Project, Data);
...@@ -6322,12 +6322,10 @@ package body Make is ...@@ -6322,12 +6322,10 @@ package body Make is
else else
Tempdir.Create_Temp_File Tempdir.Create_Temp_File
(FD, (FD, Data.Mapping_File_Names (Data.Last_Mapping_File_Names));
Data.Mapping_File_Names (Data.Last_Mapping_File_Names));
if FD = Invalid_FD then if FD = Invalid_FD then
Make_Failed ("disk full"); Make_Failed ("disk full");
else else
Record_Temp_File Record_Temp_File
(Project_Tree.Shared, (Project_Tree.Shared,
...@@ -6357,7 +6355,7 @@ package body Make is ...@@ -6357,7 +6355,7 @@ package body Make is
procedure Check_Version_And_Help is procedure Check_Version_And_Help is
new Check_Version_And_Help_G (Makeusg); new Check_Version_And_Help_G (Makeusg);
-- Start of processing for Initialize -- Start of processing for Initialize
begin begin
-- Prepare the project's tree, since this is used to hold external -- Prepare the project's tree, since this is used to hold external
...@@ -6474,16 +6472,12 @@ package body Make is ...@@ -6474,16 +6472,12 @@ package body Make is
-- Test for trailing -o switch -- Test for trailing -o switch
elsif Output_File_Name_Present elsif Output_File_Name_Present and then not Output_File_Name_Seen then
and then not Output_File_Name_Seen
then
Make_Failed ("output file name missing after -o"); Make_Failed ("output file name missing after -o");
-- Test for trailing -D switch -- Test for trailing -D switch
elsif Object_Directory_Present elsif Object_Directory_Present and then not Object_Directory_Seen then
and then not Object_Directory_Seen
then
Make_Failed ("object directory missing after -D"); Make_Failed ("object directory missing after -D");
end if; end if;
...@@ -6742,8 +6736,8 @@ package body Make is ...@@ -6742,8 +6736,8 @@ package body Make is
and then not Unit.File_Names (Spec).Locally_Removed and then not Unit.File_Names (Spec).Locally_Removed
and then and then
(All_Projects (All_Projects
or else or else
Is_Extending (The_Project, Unit.File_Names (Spec).Project)) Is_Extending (The_Project, Unit.File_Names (Spec).Project))
then then
-- If there is no source for the body, but there is one for the -- If there is no source for the body, but there is one for the
-- spec which has not been locally removed, then we take this one. -- spec which has not been locally removed, then we take this one.
...@@ -7407,9 +7401,7 @@ package body Make is ...@@ -7407,9 +7401,7 @@ package body Make is
-- A special test is needed for the -o switch within a -largs since that -- A special test is needed for the -o switch within a -largs since that
-- is another way to specify the name of the final executable. -- is another way to specify the name of the final executable.
elsif Program_Args = Linker elsif Program_Args = Linker and then Argv = "-o" then
and then Argv = "-o"
then
Make_Failed Make_Failed
("switch -o not allowed within a -largs. Use -o directly."); ("switch -o not allowed within a -largs. Use -o directly.");
......
...@@ -87,7 +87,7 @@ package Makeutl is ...@@ -87,7 +87,7 @@ package Makeutl is
Keep_Temp_Files_Option : constant String := "--keep-temp-files"; Keep_Temp_Files_Option : constant String := "--keep-temp-files";
-- Switch to suppress deletion of temp files created by the builder. -- Switch to suppress deletion of temp files created by the builder.
-- Equivallent of -dn. -- Note that debug switch -gnatdn also has this effect.
Load_Standard_Base : Boolean := True; Load_Standard_Base : Boolean := True;
-- False when gprbuild is called with --db- -- False when gprbuild is called with --db-
......
...@@ -248,7 +248,10 @@ package Opt is ...@@ -248,7 +248,10 @@ package Opt is
Back_End_Inlining : Boolean := False; Back_End_Inlining : Boolean := False;
-- GNAT -- GNAT
-- Set True to activate inlining by back-end expansion -- Set True to activate inlining by back-end expansion. This is the normal
-- default mode for gcc targets, so it is True on such targets unless the
-- switches -gnatN or -gnatd.z are used. See circuitry in gnat1drv for the
-- exact conditions for setting this switch.
Bind_Alternate_Main_Name : Boolean := False; Bind_Alternate_Main_Name : Boolean := False;
-- GNATBIND -- GNATBIND
...@@ -823,7 +826,10 @@ package Opt is ...@@ -823,7 +826,10 @@ package Opt is
Front_End_Inlining : Boolean := False; Front_End_Inlining : Boolean := False;
-- GNAT -- GNAT
-- Set True to activate inlining by front-end expansion -- Set True to activate inlining by front-end expansion (even on GCC
-- targets, where inlining is normally handled by the back end). Set by
-- the flag -gnatN (which is now considered obsolescent, since the GCC
-- back end can do a better job of inlining than the front end these days.
Inline_Processing_Required : Boolean := False; Inline_Processing_Required : Boolean := False;
-- GNAT -- GNAT
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment