summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2006-02-15 09:34:58 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2006-02-15 09:34:58 +0000
commit96f95387e99df811bbc156695a498bfce3e5666c (patch)
treefda1ad159253cd6336589c00c573454ac557c958
parentd20595a6f1a7610af5f8f673ba0d4de343a5ef1c (diff)
downloadgcc-96f95387e99df811bbc156695a498bfce3e5666c.tar.gz
2006-02-13 Vincent Celier <celier@adacore.com>
* back_end.adb (Scan_Compiler_Arguments): Check if Search_Directory_Present is True and, if it is, add the argument in the source search directory path. * switch-c.adb (Scan_Front_End_Switches): Accept switch "-I". Set Search_Directory_Present to True. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111044 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ada/back_end.adb21
-rw-r--r--gcc/ada/switch-c.adb12
2 files changed, 24 insertions, 9 deletions
diff --git a/gcc/ada/back_end.adb b/gcc/ada/back_end.adb
index 5453dd3ab30..a77edd978c4 100644
--- a/gcc/ada/back_end.adb
+++ b/gcc/ada/back_end.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2006, 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- --
@@ -238,11 +238,10 @@ package body Back_End is
-- Loop through command line arguments, storing them for later access
while Next_Arg < save_argc loop
-
Look_At_Arg : declare
- Argv_Ptr : constant BSP := save_argv (Next_Arg);
- Argv_Len : constant Nat := Len_Arg (Next_Arg);
- Argv : constant String := Argv_Ptr (1 .. Natural (Argv_Len));
+ Argv_Ptr : constant BSP := save_argv (Next_Arg);
+ Argv_Len : constant Nat := Len_Arg (Next_Arg);
+ Argv : constant String := Argv_Ptr (1 .. Natural (Argv_Len));
begin
-- If the previous switch has set the Output_File_Name_Present
@@ -260,6 +259,18 @@ package body Back_End is
Output_File_Name_Seen := True;
end if;
+ -- If the previous switch has set the Search_Directory_Present
+ -- flag (that is if we have just seen -I), then the next
+ -- argument is a search directory path.
+
+ elsif Search_Directory_Present then
+ if Is_Switch (Argv) then
+ Fail ("search directory missing after -I");
+ else
+ Add_Src_Search_Dir (Argv);
+ Search_Directory_Present := False;
+ end if;
+
elsif not Is_Switch (Argv) then -- must be a file name
Add_File (Argv);
diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb
index eaefef90430..1428aa79f63 100644
--- a/gcc/ada/switch-c.adb
+++ b/gcc/ada/switch-c.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2006, 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- --
@@ -102,12 +102,16 @@ package body Switch.C is
if Switch_Chars (Ptr) = 'I' then
Store_Switch := False;
- Ptr := Ptr + 1;
+ -- Set flag Search_Directory_Present if switch is "-I" only:
+ -- the directory will be the next argument.
- if Ptr > Max then
- Bad_Switch (C);
+ if Ptr = Max then
+ Search_Directory_Present := True;
+ return;
end if;
+ Ptr := Ptr + 1;
+
-- Find out whether this is a -I- or regular -Ixxx switch
if Ptr = Max and then Switch_Chars (Ptr) = '-' then