switch.adb (Is_Internal_GCC_Switch, [...]): Bodies of ...

* 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.

From-SVN: r147830
This commit is contained in:
Olivier Hainque 2009-05-24 09:14:53 +00:00 committed by Olivier Hainque
parent a70d634247
commit 6e00e54643
6 changed files with 71 additions and 27 deletions

View File

@ -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.

View File

@ -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;
-- Skip -o or internal GCC switches together with their argument
-- For switches -o, -dumpbase, --param, skip following argument and
-- do not store either the switch or the following 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;

View File

@ -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

View File

@ -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

View File

@ -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 --
---------------
@ -148,6 +164,22 @@ package body Switch is
and then Switch_Chars (Switch_Chars'First) = '-';
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 --
-----------------

View File

@ -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