summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ada/ChangeLog11
-rw-r--r--gcc/ada/back_end.adb28
-rw-r--r--gcc/ada/gcc-interface/lang-specs.h1
-rw-r--r--gcc/ada/lib.ads6
-rw-r--r--gcc/ada/switch.adb34
-rw-r--r--gcc/ada/switch.ads18
6 files changed, 71 insertions, 27 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 27665e4248d..6a652be62cd 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,14 @@
+2009-05-24 Olivier Hainque <hainque@adacore.com>
+
+ * switch.adb (Is_Internal_GCC_Switch, Switch_Last): Bodies of ...
+ * switch.ads (Is_Internal_GCC_Switch, Switch_Last): New functions.
+ Add -auxbase variants to the list of recognized internal switches.
+ * back_end.adb (Scan_Back_End_Switches): Use the new functions and
+ adjust comments.
+ * lib.ads: Make comment on internal GCC switches more general.
+ * gcc-interface/lang-specs.h (specs for Ada): Pass -auxbase variants
+ as for C.
+
2009-05-23 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/misc.c (gnat_get_subrange_bounds): Fix thinko.
diff --git a/gcc/ada/back_end.adb b/gcc/ada/back_end.adb
index baf3ffda37f..a15d9ecfc16 100644
--- a/gcc/ada/back_end.adb
+++ b/gcc/ada/back_end.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, 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- --
@@ -158,12 +158,10 @@ package body Back_End is
-- entire string should consist of valid switch characters, except that
-- an optional terminating NUL character is allowed.
--
- -- Back end switches have already been checked and processed by GCC
- -- in toplev.c, so no errors can occur and control will always return.
- -- The switches must still be scanned to skip the arguments of the
- -- "-o" or the (undocumented) "-dumpbase" switch, by incrementing
- -- the Next_Arg variable. The "-dumpbase" switch is used to set the
- -- basename for GCC dumpfiles.
+ -- Back end switches have already been checked and processed by GCC in
+ -- toplev.c, so no errors can occur and control will always return. The
+ -- switches must still be scanned to skip "-o" or internal GCC switches
+ -- with their argument.
-------------
-- Len_Arg --
@@ -186,21 +184,13 @@ package body Back_End is
procedure Scan_Back_End_Switches (Switch_Chars : String) is
First : constant Positive := Switch_Chars'First + 1;
- Last : Natural := Switch_Chars'Last;
+ Last : constant Natural := Switch_Last (Switch_Chars);
begin
- if Last >= First
- and then Switch_Chars (Last) = ASCII.NUL
- then
- Last := Last - 1;
- end if;
-
- -- For switches -o, -dumpbase, --param, skip following argument and
- -- do not store either the switch or the following argument.
+ -- Skip -o or internal GCC switches together with their argument
- if Switch_Chars (First .. Last) = "o" or else
- Switch_Chars (First .. Last) = "dumpbase" or else
- Switch_Chars (First .. Last) = "-param"
+ if Switch_Chars (First .. Last) = "o"
+ or else Is_Internal_GCC_Switch (Switch_Chars)
then
Next_Arg := Next_Arg + 1;
diff --git a/gcc/ada/gcc-interface/lang-specs.h b/gcc/ada/gcc-interface/lang-specs.h
index c07547fbdf6..1afba3706b4 100644
--- a/gcc/ada/gcc-interface/lang-specs.h
+++ b/gcc/ada/gcc-interface/lang-specs.h
@@ -35,6 +35,7 @@
gnat1 %{I*} %{k8:-gnatk8} %{Wall:-gnatwa} %{w:-gnatws} %{!Q:-quiet}\
%{nostdinc*} %{nostdlib*}\
-dumpbase %{.adb:%b.adb}%{.ads:%b.ads}%{!.adb:%{!.ads:%b.ada}}\
+ %{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}%{!c:%{!S:-auxbase %b}} \
%{O*} %{W*} %{w} %{p} %{pg:-p} %{a} %{d*} %{f*}\
%{coverage:-fprofile-arcs -ftest-coverage} "
#if CONFIG_DUAL_EXCEPTIONS
diff --git a/gcc/ada/lib.ads b/gcc/ada/lib.ads
index 50be722e1f6..145d16dff08 100644
--- a/gcc/ada/lib.ads
+++ b/gcc/ada/lib.ads
@@ -734,9 +734,9 @@ private
Table_Name => "Linker_Option_Lines");
-- The following table records the compilation switches used to compile
- -- the main unit. The table includes only switches and excludes -quiet,
- -- -dumpbase, and -o switches, since the latter are typically artifacts
- -- of the gcc/gnat1 interface.
+ -- the main unit. The table includes only switches. It excludes -o
+ -- switches as well as artifacts of the gcc/gnat1 interface such as
+ -- -quiet, -dumpbase, or -auxbase.
-- This table is set as part of the compiler argument scanning in
-- Back_End. It can also be reset in -gnatc mode from the data in an
diff --git a/gcc/ada/switch.adb b/gcc/ada/switch.adb
index f318de7f191..cb5c4d11f49 100644
--- a/gcc/ada/switch.adb
+++ b/gcc/ada/switch.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, 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- --
@@ -138,6 +138,22 @@ package body Switch is
and then Switch_Chars (Ptr + 2 .. Ptr + 4) = "RTS"));
end Is_Front_End_Switch;
+ ----------------------------
+ -- Is_Internal_GCC_Switch --
+ ----------------------------
+
+ function Is_Internal_GCC_Switch (Switch_Chars : String) return Boolean is
+ First : constant Natural := Switch_Chars'First + 1;
+ Last : constant Natural := Switch_Last (Switch_Chars);
+ begin
+ return Is_Switch (Switch_Chars)
+ and then
+ (Switch_Chars (First .. Last) = "-param" or else
+ Switch_Chars (First .. Last) = "dumpbase" or else
+ Switch_Chars (First .. Last) = "auxbase-strip" or else
+ Switch_Chars (First .. Last) = "auxbase");
+ end Is_Internal_GCC_Switch;
+
---------------
-- Is_Switch --
---------------
@@ -149,6 +165,22 @@ package body Switch is
end Is_Switch;
-----------------
+ -- Switch_last --
+ -----------------
+
+ function Switch_Last (Switch_Chars : String) return Natural is
+ Last : constant Natural := Switch_Chars'Last;
+ begin
+ if Last >= Switch_Chars'First
+ and then Switch_Chars (Last) = ASCII.NUL
+ then
+ return Last - 1;
+ else
+ return Last;
+ end if;
+ end Switch_Last;
+
+ -----------------
-- Nat_Present --
-----------------
diff --git a/gcc/ada/switch.ads b/gcc/ada/switch.ads
index 9b6c7ea4552..027bf835487 100644
--- a/gcc/ada/switch.ads
+++ b/gcc/ada/switch.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, 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- --
@@ -72,11 +72,21 @@ package Switch is
-- Returns True iff Switch_Chars represents a front-end switch, i.e. it
-- starts with -I, -gnat or -?RTS.
-private
+ function Is_Internal_GCC_Switch (Switch_Chars : String) return Boolean;
+ -- Returns True iff Switch_Chars represents an internal GCC switch to be
+ -- followed by a single argument, such as -dumpbase, --param or -auxbase.
+ -- Eventhough passed by the "gcc" driver, these need not be stored in ALI
+ -- files and may safely be ignored by non GCC back-ends.
+
+ function Switch_Last (Switch_Chars : String) return Natural;
+ -- Index in Switch_Chars of the last relevant character for later string
+ -- comparison purposes. This is typically 'Last, minus one if there is a
+ -- terminating ASCII.NUL.
+private
-- This section contains some common routines used by the tool dependent
- -- child packages (there is one such child package for each tool that
- -- uses Switches to scan switches - Compiler/gnatbind/gnatmake/.
+ -- child packages (there is one such child package for each tool that uses
+ -- Switches to scan switches - Compiler/gnatbind/gnatmake/.
Switch_Max_Value : constant := 999_999;
-- Maximum value permitted in switches that take a value