aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/switch-m.adb
diff options
context:
space:
mode:
authorVincent Celier <celier@adacore.com>2008-04-08 08:48:54 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2008-04-08 08:48:54 +0200
commit68c3f02a687ec4e6dd51392f1154da5690cd7963 (patch)
tree19a9ced7ffaa892a7a6277565007023c9130ccce /gcc/ada/switch-m.adb
parenta1e2130ca1fa141e3dcb1ba4913a8f46d33ab9c1 (diff)
downloadgcc-68c3f02a687ec4e6dd51392f1154da5690cd7963.zip
gcc-68c3f02a687ec4e6dd51392f1154da5690cd7963.tar.gz
gcc-68c3f02a687ec4e6dd51392f1154da5690cd7963.tar.bz2
clean.adb (Parse_Cmd_Line): Recognize switch --subdirs=
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 From-SVN: r134023
Diffstat (limited to 'gcc/ada/switch-m.adb')
-rw-r--r--gcc/ada/switch-m.adb80
1 files changed, 67 insertions, 13 deletions
diff --git a/gcc/ada/switch-m.adb b/gcc/ada/switch-m.adb
index 208bb38..20761f4 100644
--- a/gcc/ada/switch-m.adb
+++ b/gcc/ada/switch-m.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-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- --
@@ -26,6 +26,7 @@
with Debug; use Debug;
with Osint; use Osint;
with Opt; use Opt;
+with Prj; use Prj;
with Prj.Ext; use Prj.Ext;
with Table;
@@ -150,20 +151,59 @@ package body Switch.M is
when False =>
-- All switches that don't start with -gnat stay as is,
- -- except -v, -E and -pg
+ -- except -pg, -Wall, -k8, -w
- if Switch_Chars = "-pg" then
+ if Switch_Chars = "-pg" or else Switch_Chars = "-p" then
-- The gcc driver converts -pg to -p, so that is what
-- is stored in the ALI file.
Add_Switch_Component ("-p");
- -- Do not take into account switches that are not transmitted
- -- to gnat1 by the gcc driver.
+ elsif Switch_Chars = "-Wall" then
- elsif C /= 'v' and then C /= 'E' then
+ -- The gcc driver adds -gnatwa when -Wall is used
+
+ Add_Switch_Component ("-gnatwa");
+ Add_Switch_Component ("-Wall");
+
+ elsif Switch_Chars = "-k8" then
+
+ -- The gcc driver transforms -k8 into -gnatk8
+
+ Add_Switch_Component ("-gnatk8");
+
+ elsif Switch_Chars = "-w" then
+
+ -- The gcc driver adds -gnatws when -w is used
+
+ Add_Switch_Component ("-gnatws");
+ Add_Switch_Component ("-w");
+
+ elsif Switch_Chars'Length > 6
+ and then
+ Switch_Chars (Switch_Chars'First .. Switch_Chars'First + 5)
+ = "--RTS="
+ then
Add_Switch_Component (Switch_Chars);
+
+ -- When --RTS=mtp is used, the gcc driver adds -mrtp
+
+ if Switch_Chars = "--RTS=mtp" then
+ Add_Switch_Component ("-mrtp");
+ end if;
+
+ -- Take only into account switches that are transmitted to
+ -- gnat1 by the gcc driver and stored by gnat1 in the ALI file.
+
+ else
+ case C is
+ when 'O' | 'W' | 'w' | 'f' | 'd' | 'g' | 'm' =>
+ Add_Switch_Component (Switch_Chars);
+
+ when others =>
+ null;
+ end case;
end if;
return;
@@ -332,7 +372,8 @@ package body Switch.M is
Ptr := Ptr + 1;
if Ptr <= Max
- and then Switch_Chars (Ptr) = 's' then
+ and then Switch_Chars (Ptr) = 's'
+ then
Last_Stored := Last_Stored + 1;
Storing (Last_Stored) := 's';
Ptr := Ptr + 1;
@@ -366,12 +407,9 @@ package body Switch.M is
-- -gnatyMxxx
- if C = 'M' and then
- Storing (First_Stored) = 'y'
- then
+ if C = 'M' and then Storing (First_Stored) = 'y' then
Last_Stored := First_Stored + 1;
Storing (Last_Stored) := 'M';
-
while Ptr <= Max loop
C := Switch_Chars (Ptr);
exit when C not in '0' .. '9';
@@ -517,8 +555,24 @@ package body Switch.M is
if Switch_Chars = "--create-missing-dirs" then
Setup_Projects := True;
- elsif Switch_Chars'Length > 3 and then
- Switch_Chars (Ptr .. Ptr + 1) = "aP"
+ elsif Switch_Chars'Length > Subdirs_Option'Length
+ and then
+ Switch_Chars
+ (Switch_Chars'First ..
+ Switch_Chars'First + Subdirs_Option'Length - 1) =
+ Subdirs_Option
+ then
+ Subdirs :=
+ new String'
+ (Switch_Chars
+ (Switch_Chars'First + Subdirs_Option'Length ..
+ Switch_Chars'Last));
+
+ elsif Switch_Chars (Ptr) = '-' then
+ Bad_Switch (Switch_Chars);
+
+ elsif Switch_Chars'Length > 3
+ and then Switch_Chars (Ptr .. Ptr + 1) = "aP"
then
Add_Search_Project_Directory
(Switch_Chars (Ptr + 2 .. Switch_Chars'Last));