diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-04-08 06:48:54 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-04-08 06:48:54 +0000 |
commit | f17fd3d988f031a40da04751224ecfe8d2f276fc (patch) | |
tree | 19a9ced7ffaa892a7a6277565007023c9130ccce /gcc/ada/gnatcmd.adb | |
parent | 3dbdaa3852cab88ddf3ecafd330ad77e67de3c6d (diff) | |
download | gcc-f17fd3d988f031a40da04751224ecfe8d2f276fc.tar.gz |
2008-04-08 Vincent Celier <celier@adacore.com>
* clean.adb (Parse_Cmd_Line): Recognize switch --subdirs=
(Usage): Add line for switch --subdirs=
Add new switch -eL, to follow symbolic links when processing project
files.
* gnatcmd.adb: Process switches -eL and --subdirs=
(Non_VMS_Usage): Output "gnaampcmd" instead of "gnat", and call
Program_Name to get proper tool names when AAMP_On_Target is set.
(Gnatcmd): Call Add_Default_Search_Dirs and Get_Target_Parameters to get
AAMP_On_Target set properly for use of GNAAMP tools (this is needed by
Osint.Program_Name).
* gnatname.adb: (Scan_Args): Recognize switches -eL and --subdirs=
(Usage): Add lines for switches -eL and --subdirs=
* makeusg.adb: Add line for switch --subdirs=
* prj.ads:
(Source_Data): New Boolean component Compiled, defaulted to True
(Empty_File_Name: New global variable in private part, initialized in
procedure Initialize.
(Subdirs_Option): New constant string
(Subdirs): New String_Ptr global variable
(Language_Config): New component Include_Compatible_Languages
(Project_Qualifier): New type for project qualifiers
(Project_Data): New component Qualifier
(Project_Configuration): New component Archive_Builder_Append_Option
* prj-nmsc.adb (Get_Unit_Exceptions): When a unit is already in
another imported project indicate the name of this imported project.
(Check_File): When a unit is in two project files, indicate the project
names and the paths of the source files for each project.
(Add_Source): Set Compiled to False if compiler driver is empty. Only
set object, dependency and switches file names if Compiled is True.
(Process_Compiler): Allow the empty string for value of attribute Driver
(Get_Directories): When Subdirs is not null and Object_Dir is not
specified, locate and create if necessary the actual object dir.
(Locate_Directory): When Subdirs is not empty and Create is not the
empty string, locate and create if necessary the actual directory
as a subdirectory of directory Name.
(Check_Library_Attributes.Check_Library): Allow a project where the only
"sources" are header files of file based languages to be imported by
library projects, in multi-language mode (gprbuild).
(Check_Library_Attributes.Check_Library): In multi-language mode
(gprbuild), allow a library project to import a project with no
sources, even when this is not declared explicitly.
(Check_If_Externally_Built): A virtual project extending an externally
built project is also externally built.
(Check_Library_Attributes): For a virtual project extending a library
project, inherit the library directory.
(Process_Project_Level_Array_Attributes): Process new attribute
Inherit_Source_Path.
For projects with specified qualifiers "standard", "library" or
"abstract", check that the project conforms to the qualifier.
(Process_Project_Level_Simple_Attributes): Process new attribute
Archive_Builder_Append_Option.
* switch-m.adb: (Scan_Make_Switches): Process switch --subdirs=
(Normalize_Compiler_Switches): Only keep compiler switches that are
passed to gnat1 by the gcc driver and that are stored in the ALI file
by gnat1.
Do not take into account switc -save-temps
* makegpr.adb (Compile_Link_With_Gnatmake): Transmit switch -eL if
gprmake is called with -eL.
(Scan_Arg): Recognize switch -eL
(Usage): Add line for switch -eL
* prj.adb (Initialize): Initialize Empty_File_Name
(Project_Empty): New component Qualifier
* prj-attr.ads, prj-attr.adb: New project level attribute
Inherit_Source_Path.
New project level attribute Archive_Builder_Append_Option
* prj-dect.adb: Replace System.Strings by GNAT.Strings.
* prj-ext.adb (Initialize_Project_Path): In Multi_Language mode, add
<prefix>/lib/gnat in the project path, after <prefix>/share/gpr, for
upward compatibility.
* prj-part.adb (Project_Path_Name_Of.Try_Path): In high verbosity, put
each Trying ..." on different lines.
(Parse_Single_Project): Recognize project qualifiers. Fail in qualifier
is "configuration" when not in configuration. Fail when in configuration
when a specified qualifier is other than "configuration".
* prj-proc.adb (Process_Declarative_Items): Link new elements of copied
full associative array together.
(Recursive_Process): Put the project qualifier in the project data
* prj-tree.ads, prj-tree.adb: (Project_Qualifier_Of): New function
(Set_Project_Qualifier_Of): New procedure
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@134023 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/gnatcmd.adb')
-rw-r--r-- | gcc/ada/gnatcmd.adb | 111 |
1 files changed, 77 insertions, 34 deletions
diff --git a/gcc/ada/gnatcmd.adb b/gcc/ada/gnatcmd.adb index 13ddf63f8d4..8135bfc8a4d 100644 --- a/gcc/ada/gnatcmd.adb +++ b/gcc/ada/gnatcmd.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1996-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1996-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -41,6 +41,7 @@ with Prj.Util; use Prj.Util; with Sinput.P; with Snames; use Snames; with Table; +with Targparm; with Tempdir; with Types; use Types; with Hostparm; use Hostparm; @@ -233,7 +234,8 @@ procedure GNATCmd is -- METRIC). procedure Delete_Temp_Config_Files; - -- Delete all temporary config files + -- Delete all temporary config files. The caller is responsible for + -- ensuring that Keep_Temporary_Files is False. procedure Get_Closure; -- Get the sources in the closure of the ASIS_Main and add them to the @@ -721,38 +723,40 @@ procedure GNATCmd is pragma Warnings (Off, Success); begin - if not Keep_Temporary_Files then - if Project /= No_Project then - for Prj in Project_Table.First .. - Project_Table.Last (Project_Tree.Projects) - loop - if - Project_Tree.Projects.Table (Prj).Config_File_Temp - then - if Verbose_Mode then - Output.Write_Str ("Deleting temp configuration file """); - Output.Write_Str - (Get_Name_String - (Project_Tree.Projects.Table - (Prj).Config_File_Name)); - Output.Write_Line (""""); - end if; + -- This should only be called if Keep_Temporary_Files is False - Delete_File - (Name => Get_Name_String + pragma Assert (not Keep_Temporary_Files); + + if Project /= No_Project then + for Prj in Project_Table.First .. + Project_Table.Last (Project_Tree.Projects) + loop + if + Project_Tree.Projects.Table (Prj).Config_File_Temp + then + if Verbose_Mode then + Output.Write_Str ("Deleting temp configuration file """); + Output.Write_Str + (Get_Name_String (Project_Tree.Projects.Table - (Prj).Config_File_Name), - Success => Success); + (Prj).Config_File_Name)); + Output.Write_Line (""""); end if; - end loop; - end if; - -- If a temporary text file that contains a list of files for a tool - -- has been created, delete this temporary file. + Delete_File + (Name => + Get_Name_String + (Project_Tree.Projects.Table (Prj).Config_File_Name), + Success => Success); + end if; + end loop; + end if; - if Temp_File_Name /= null then - Delete_File (Temp_File_Name.all, Success); - end if; + -- If a temporary text file that contains a list of files for a tool + -- has been created, delete this temporary file. + + if Temp_File_Name /= null then + Delete_File (Temp_File_Name.all, Success); end if; end Delete_Temp_Config_Files; @@ -770,7 +774,8 @@ procedure GNATCmd is 6 => new String'("-bargs"), 7 => new String'("-R"), 8 => new String'("-Z")); - -- Arguments of the invocation of gnatmake to get the list of + -- Arguments for the invocation of gnatmake which are added to the + -- Last_Arguments list by this procedure. FD : File_Descriptor; -- File descriptor for the temp file that will get the output of the @@ -793,6 +798,8 @@ procedure GNATCmd is File : Ada.Text_IO.File_Type; Line : String (1 .. 250); Last : Natural; + -- Used to read file if there is an error, it is good enough to display + -- just 250 characters if the first line of the file is very long. Udata : Unit_Data; Path : Path_Name_Type; @@ -890,7 +897,6 @@ procedure GNATCmd is if not Keep_Temporary_Files then Delete (File); - else Close (File); end if; @@ -1322,9 +1328,15 @@ procedure GNATCmd is for C in Command_List'Range loop if not Command_List (C).VMS_Only then - Put ("gnat " & To_Lower (Command_List (C).Cname.all)); + if Targparm.AAMP_On_Target then + Put ("gnaampcmd "); + else + Put ("gnat "); + end if; + + Put (To_Lower (Command_List (C).Cname.all)); Set_Col (25); - Put (Command_List (C).Unixcmd.all); + Put (Program_Name (Command_List (C).Unixcmd.all).all); declare Sws : Argument_List_Access renames Command_List (C).Unixsws; @@ -1375,6 +1387,16 @@ begin Set_Mode (Ada_Only); + -- Add the default search directories, to be able to find system.ads in the + -- subsequent call to Targparm.Get_Target_Parameters. + + Add_Default_Search_Dirs; + + -- 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; + -- Add the directory where the GNAT driver is invoked in front of the path, -- if the GNAT driver is invoked with directory information. Do not do this -- for VMS, where the notion of path does not really exist. @@ -1666,9 +1688,23 @@ begin end if; end if; + -- --subdirs=... Specify Subdirs + + if Argv'Length > Subdirs_Option'Length and then + Argv + (Argv'First .. Argv'First + Subdirs_Option'Length - 1) = + Subdirs_Option + then + Subdirs := + new String' + (Argv + (Argv'First + Subdirs_Option'Length .. Argv'Last)); + + Remove_Switch (Arg_Num); + -- -aPdir Add dir to the project search path - if Argv'Length > 3 + elsif Argv'Length > 3 and then Argv (Argv'First + 1 .. Argv'First + 2) = "aP" then Add_Search_Project_Directory @@ -1676,6 +1712,13 @@ begin Remove_Switch (Arg_Num); + -- -eL Follow links for files + + elsif Argv.all = "-eL" then + Follow_Links_For_Files := True; + + Remove_Switch (Arg_Num); + -- -vPx Specify verbosity while parsing project files elsif Argv'Length = 4 |