aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gnatcmd.adb
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2009-04-29 23:10:21 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2009-04-29 23:10:21 +0000
commit3cebfcc5c66e5337e8551a30cd6d29edc9aae9c8 (patch)
tree1eb925fe9ac0daa64343cebeedf8d15f314f4a29 /gcc/ada/gnatcmd.adb
parent9933b56afffcf56331c8818f729e97c1acf1ab59 (diff)
downloadgcc-3cebfcc5c66e5337e8551a30cd6d29edc9aae9c8.zip
gcc-3cebfcc5c66e5337e8551a30cd6d29edc9aae9c8.tar.gz
gcc-3cebfcc5c66e5337e8551a30cd6d29edc9aae9c8.tar.bz2
Revert
2009-04-29 Vincent Celier <celier@adacore.com> * sinput-l.adb (Load_File): When preprocessing, set temporarily the Source_File_Index_Table entries for the source, to avoid crash when reporting an error. * gnatcmd.adb (Test_If_Relative_Path): Use Makeutl.Test_If_Relative_Path. * makeutl.adb:(Test_If_Relative_Path): Process switches --RTS= only if Including_RTS is True. * makeutl.ads (Test_If_Relative_Path): New Boolean parameter Including_RTS defaulted to False. * sinput.ads, scans.ads, err_vars.ads: Initialize some variables with a default value. From-SVN: r146991
Diffstat (limited to 'gcc/ada/gnatcmd.adb')
-rw-r--r--gcc/ada/gnatcmd.adb58
1 files changed, 55 insertions, 3 deletions
diff --git a/gcc/ada/gnatcmd.adb b/gcc/ada/gnatcmd.adb
index 8310cd2..81e9bc4 100644
--- a/gcc/ada/gnatcmd.adb
+++ b/gcc/ada/gnatcmd.adb
@@ -26,7 +26,6 @@
with GNAT.Directory_Operations; use GNAT.Directory_Operations;
with Csets;
-with Makeutl;
with MLib.Tgt; use MLib.Tgt;
with MLib.Utl;
with MLib.Fil;
@@ -1266,8 +1265,61 @@ procedure GNATCmd is
Parent : String)
is
begin
- Makeutl.Test_If_Relative_Path
- (Switch, Parent, Including_Non_Switch => False, Including_RTS => True);
+ if Switch /= null then
+
+ declare
+ Sw : String (1 .. Switch'Length);
+ Start : Positive := 1;
+
+ begin
+ Sw := Switch.all;
+
+ if Sw (1) = '-' then
+ if Sw'Length >= 3
+ and then (Sw (2) = 'A' or else
+ Sw (2) = 'I' or else
+ Sw (2) = 'L')
+ then
+ Start := 3;
+
+ if Sw = "-I-" then
+ return;
+ end if;
+
+ elsif Sw'Length >= 4
+ and then (Sw (2 .. 3) = "aL" or else
+ Sw (2 .. 3) = "aO" or else
+ Sw (2 .. 3) = "aI")
+ then
+ Start := 4;
+
+ elsif Sw'Length >= 7
+ and then Sw (2 .. 6) = "-RTS="
+ then
+ Start := 7;
+ else
+ return;
+ end if;
+ end if;
+
+ -- If the path is relative, test if it includes directory
+ -- information. If it does, prepend Parent to the path.
+
+ if not Is_Absolute_Path (Sw (Start .. Sw'Last)) then
+ for J in Start .. Sw'Last loop
+ if Sw (J) = Directory_Separator then
+ Switch :=
+ new String'
+ (Sw (1 .. Start - 1) &
+ Parent &
+ Directory_Separator &
+ Sw (Start .. Sw'Last));
+ return;
+ end if;
+ end loop;
+ end if;
+ end;
+ end if;
end Test_If_Relative_Path;
-------------------