diff options
Diffstat (limited to 'gcc/ada/switch-m.adb')
-rw-r--r-- | gcc/ada/switch-m.adb | 127 |
1 files changed, 110 insertions, 17 deletions
diff --git a/gcc/ada/switch-m.adb b/gcc/ada/switch-m.adb index b04672b5ffc..ec99f8f20b4 100644 --- a/gcc/ada/switch-m.adb +++ b/gcc/ada/switch-m.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2001-2002 Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2003 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- -- @@ -37,7 +37,7 @@ package body Switch.M is Table_Low_Bound => 1, Table_Initial => 20, Table_Increment => 100, - Table_Name => "Switch.C.Normalized_Switches"); + Table_Name => "Switch.M.Normalized_Switches"); -- This table is used to keep the normalized switches, so that they may be -- reused for subsequent invocations of Normalize_Compiler_Switches with -- similar switches. @@ -62,7 +62,6 @@ package body Switch.M is Max : constant Integer := Switch_Chars'Last; C : Character := ' '; - First_Char : Integer := Ptr; Storing : String := Switch_Chars; First_Stored : Positive := Ptr + 1; Last_Stored : Positive := First_Stored; @@ -143,7 +142,6 @@ package body Switch.M is end if; while Ptr <= Max loop - First_Char := Ptr; C := Switch_Chars (Ptr); -- Processing for a switch @@ -151,9 +149,21 @@ package body Switch.M is case Switch_Starts_With_Gnat is when False => - -- All switches that don't start with -gnat stay as is - Add_Switch_Component (Switch_Chars); + -- All switches that don't start with -gnat stay as is, + -- except -v and -pg + + if Switch_Chars = "-pg" then + + -- The gcc driver converts -pg to -p, so that is what + -- is stored in the ALI file. + + Add_Switch_Component ("-p"); + + elsif C /= 'v' then + Add_Switch_Component (Switch_Chars); + end if; + return; when True => @@ -162,7 +172,7 @@ package body Switch.M is -- One-letter switches - when 'a' | 'A' | 'b' | 'c' | 'C' | 'D' | 'E' | 'f' | + when 'a' | 'A' | 'b' | 'c' | 'D' | 'E' | 'f' | 'F' | 'g' | 'h' | 'H' | 'k' | 'l' | 'L' | 'n' | 'N' | 'o' | 'O' | 'p' | 'P' | 'q' | 'Q' | 'r' | 's' | 't' | 'u' | 'U' | 'v' | 'x' | 'X' | 'Z' => @@ -214,8 +224,59 @@ package body Switch.M is return; when 'e' => - -- None of the -gnate switches (-gnatec and -gnatem) - -- need to be store in an ALI file. + + -- Only -gnateD and -gnatep= need to be store in an ALI + -- file. + + Storing (First_Stored) := 'e'; + Ptr := Ptr + 1; + + if Ptr > Max + or else (Switch_Chars (Ptr) /= 'D' + and then Switch_Chars (Ptr) /= 'p') + then + Last := 0; + return; + end if; + + if Switch_Chars (Ptr) = 'D' then + -- gnateD + + Storing (First_Stored + 1 .. + First_Stored + Max - Ptr + 1) := + Switch_Chars (Ptr .. Max); + Add_Switch_Component + (Storing (Storing'First .. + First_Stored + Max - Ptr + 1)); + + else + -- gnatep= + + Ptr := Ptr + 1; + + if Ptr = Max then + Last := 0; + return; + end if; + + if Switch_Chars (Ptr) = '=' then + Ptr := Ptr + 1; + end if; + + -- To normalize, always put a '=' after -gnatep. + -- Because that could lengthen the switch string, + -- declare a local variable. + + declare + To_Store : String (1 .. Max - Ptr + 9); + + begin + To_Store (1 .. 8) := "-gnatep="; + To_Store (9 .. Max - Ptr + 9) := + Switch_Chars (Ptr .. Max); + Add_Switch_Component (To_Store); + end; + end if; return; @@ -379,9 +440,9 @@ package body Switch.M is ------------------------ procedure Scan_Make_Switches (Switch_Chars : String) is - Ptr : Integer := Switch_Chars'First; - Max : Integer := Switch_Chars'Last; - C : Character := ' '; + Ptr : Integer := Switch_Chars'First; + Max : constant Integer := Switch_Chars'Last; + C : Character := ' '; begin -- Skip past the initial character (must be the switch character) @@ -405,7 +466,7 @@ package body Switch.M is -- Loop to scan through switches given in switch string - while Ptr <= Max loop + Check_Switch : begin C := Switch_Chars (Ptr); -- Processing for a switch @@ -420,13 +481,15 @@ package body Switch.M is when 'b' => Ptr := Ptr + 1; - Bind_Only := True; + Bind_Only := True; + Make_Steps := True; -- Processing for c switch when 'c' => Ptr := Ptr + 1; Compile_Only := True; + Make_Steps := True; -- Processing for C switch @@ -434,6 +497,18 @@ package body Switch.M is Ptr := Ptr + 1; Create_Mapping_File := True; + -- Processing for D switch + + when 'D' => + Ptr := Ptr + 1; + + if Object_Directory_Present then + Osint.Fail ("duplicate -D switch"); + + else + Object_Directory_Present := True; + end if; + -- Processing for d switch when 'd' => @@ -477,6 +552,12 @@ package body Switch.M is Ptr := Ptr + 1; Force_Compilations := True; + -- Processing for F switch + + when 'F' => + Ptr := Ptr + 1; + Full_Path_Name_For_Brief_Errors := True; + -- Processing for h switch when 'h' => @@ -511,7 +592,8 @@ package body Switch.M is when 'l' => Ptr := Ptr + 1; - Link_Only := True; + Link_Only := True; + Make_Steps := True; when 'M' => Ptr := Ptr + 1; @@ -540,6 +622,12 @@ package body Switch.M is Ptr := Ptr + 1; Quiet_Output := True; + -- Processing for R switch + + when 'R' => + Ptr := Ptr + 1; + Run_Path_Option := False; + -- Processing for s switch when 's' => @@ -569,14 +657,19 @@ package body Switch.M is raise Bad_Switch; end case; - end loop; + + if Ptr <= Max then + Osint.Fail ("invalid switch: ", Switch_Chars); + end if; + + end Check_Switch; exception when Bad_Switch => 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)); |