OSDN Git Service

2005-06-14 Jose Ruiz <ruiz@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / switch-b.adb
index 356e498..6880d3c 100644 (file)
@@ -6,8 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---                                                                          --
---          Copyright (C) 2001-2002 Free Software Foundation, Inc.          --
+--          Copyright (C) 2001-2005 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- --
 -- MA 02111-1307, USA.                                                      --
 --                                                                          --
 -- GNAT was originally developed  by the GNAT team at  New York University. --
--- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
 --                                                                          --
 ------------------------------------------------------------------------------
 
-with Debug;    use Debug;
-with Osint;    use Osint;
-with Opt;      use Opt;
+with Debug; use Debug;
+with Osint; use Osint;
+with Opt;   use Opt;
 
 with System.WCh_Con; use System.WCh_Con;
 
@@ -38,9 +37,9 @@ package body Switch.B is
    --------------------------
 
    procedure Scan_Binder_Switches (Switch_Chars : String) is
-      Ptr : Integer := Switch_Chars'First;
-      Max : Integer := Switch_Chars'Last;
-      C   : Character := ' ';
+      Max : constant Integer := Switch_Chars'Last;
+      Ptr : Integer          := Switch_Chars'First;
+      C   : Character        := ' ';
 
    begin
       --  Skip past the initial character (must be the switch character)
@@ -59,7 +58,6 @@ package body Switch.B is
       then
          Osint.Fail ("invalid switch: """, Switch_Chars, """"
             & " (gnat not needed here)");
-
       end if;
 
       --  Loop to scan through switches given in switch string
@@ -133,6 +131,12 @@ package body Switch.B is
 
             return;
 
+         --  Processing for D switch
+
+         when 'D' =>
+            Ptr := Ptr + 1;
+            Scan_Pos (Switch_Chars, Max, Ptr, Default_Sec_Stack_Size);
+
          --  Processing for e switch
 
          when 'e' =>
@@ -145,11 +149,11 @@ package body Switch.B is
             Ptr := Ptr + 1;
             Exception_Tracebacks := True;
 
-         --  Processing for f switch
+         --  Processing for F switch
 
-         when 'f' =>
+         when 'F' =>
             Ptr := Ptr + 1;
-            Force_RM_Elaboration_Order := True;
+            Force_Checking_Of_Elaboration_Flags := True;
 
          --  Processing for g switch
 
@@ -282,6 +286,7 @@ package body Switch.B is
             Ptr := Ptr + 1;
             Time_Slice_Set := True;
             Scan_Nat (Switch_Chars, Max, Ptr, Time_Slice_Value);
+            Time_Slice_Value := Time_Slice_Value * 1_000;
 
          --  Processing for v switch
 
@@ -339,6 +344,12 @@ package body Switch.B is
             All_Sources := False;
             Check_Source_Files := False;
 
+         --  Processing for X switch
+
+         when 'X' =>
+            Ptr := Ptr + 1;
+            Scan_Pos (Switch_Chars, Max, Ptr, Default_Exit_Status);
+
          --  Processing for z switch
 
          when 'z' =>
@@ -372,21 +383,36 @@ package body Switch.B is
                   Opt.RTS_Switch := True;
 
                   declare
-                     Src_Path_Name : String_Ptr := Get_RTS_Search_Dir
-                       (Switch_Chars (Ptr + 4 .. Switch_Chars'Last), Include);
-                     Lib_Path_Name : String_Ptr := Get_RTS_Search_Dir
-                       (Switch_Chars (Ptr + 4 .. Switch_Chars'Last), Objects);
+                     Src_Path_Name : constant String_Ptr :=
+                                       Get_RTS_Search_Dir
+                                         (Switch_Chars
+                                           (Ptr + 4 .. Switch_Chars'Last),
+                                          Include);
+                     Lib_Path_Name : constant String_Ptr :=
+                                       Get_RTS_Search_Dir
+                                         (Switch_Chars
+                                           (Ptr + 4 .. Switch_Chars'Last),
+                                          Objects);
+
                   begin
                      if Src_Path_Name /= null and then
                        Lib_Path_Name /= null
                      then
-                        Add_Search_Dirs (Src_Path_Name, Include);
-                        Add_Search_Dirs (Lib_Path_Name, Objects);
-                        --  we can exit as there can not be another switch
+                        --  Set the RTS_*_Path_Name variables, so that the
+                        --  correct directories will be set when
+                        --  Osint.Add_Default_Search_Dirs will be called later.
+
+                        RTS_Src_Path_Name := Src_Path_Name;
+                        RTS_Lib_Path_Name := Lib_Path_Name;
+
+                        --  We can exit as there can not be another switch
                         --  after --RTS
+
                         exit;
+
                      elsif  Src_Path_Name = null
-                       and Lib_Path_Name = null then
+                       and then Lib_Path_Name = null
+                     then
                         Osint.Fail ("RTS path not valid: missing " &
                                     "adainclude and adalib directories");
                      elsif Src_Path_Name = null then
@@ -415,7 +441,7 @@ package body Switch.B is
          Osint.Fail ("invalid switch: ", (1 => C));
 
       when Bad_Switch_Value =>
-         Osint.Fail ("numeric value too big for switch: ", (1 => C));
+         Osint.Fail ("numeric value out of range for switch: ", (1 => C));
 
       when Missing_Switch_Value =>
          Osint.Fail ("missing numeric value for switch: ", (1 => C));