Commit 61dddae4 by Robert Dewar Committed by Arnaud Charlet

debug.adb: Eliminate numeric switches for binder/gnatmake

2006-02-13  Robert Dewar  <dewar@adacore.com>
	    Vincent Celier  <celier@adacore.com>

	* debug.adb: Eliminate numeric switches for binder/gnatmake

	* switch-m.adb (Normalize_Compiler_Switches): Record numeric debug
	switches for the compiler.
	(Scan_Make_Switches): Do not allow numeric debug switches for gnatmake
	(Scan_Make_Switches): When failing with an illegal switch, output an
	error message with the full switch.
	Eliminate numeric switches for binder/gnatmake

	* switch.ads, switch.adb (Bad_Switch): New procedure

	* switch-b.adb (Scan_Binder_Switches): Do not accept combined switches.
	Remove 0-9 as debug flag character possibilities
	-d is now controlling the primary stack size when its value is a
	positive. Also add checks against invalid values, and support for kb,
	mb. Ditto for -D switch.

From-SVN: r111053
parent 86ac5e79
......@@ -159,16 +159,6 @@ package body Debug is
-- dy
-- dz
-- d1
-- d2
-- d3
-- d4
-- d5
-- d6
-- d7
-- d8
-- d9
-- Debug flags used in package Make and its clients (e.g. GNATMAKE)
-- da
......@@ -198,16 +188,6 @@ package body Debug is
-- dy
-- dz
-- d1
-- d2
-- d3
-- d4
-- d5
-- d6
-- d7
-- d8
-- d9
--------------------------------------------
-- Documentation for Compiler Debug Flags --
--------------------------------------------
......
......@@ -491,7 +491,7 @@ package body Switch.M is
-- Skip past the initial character (must be the switch character)
if Ptr = Max then
Bad_Switch (C);
Bad_Switch (Switch_Chars);
else
Ptr := Ptr + 1;
......@@ -573,15 +573,11 @@ package body Switch.M is
while Ptr < Max loop
Ptr := Ptr + 1;
C := Switch_Chars (Ptr);
exit when C = ASCII.NUL or else C = '/' or else C = '-';
if C in '1' .. '9' or else
C in 'a' .. 'z' or else
C in 'A' .. 'Z'
then
if C in 'a' .. 'z' or else C in 'A' .. 'Z' then
Set_Debug_Flag (C);
else
Bad_Switch (C);
Bad_Switch (Switch_Chars);
end if;
end loop;
......@@ -593,7 +589,7 @@ package body Switch.M is
Ptr := Ptr + 1;
if Ptr > Max then
Bad_Switch (C);
Bad_Switch (Switch_Chars);
end if;
case Switch_Chars (Ptr) is
......@@ -611,7 +607,7 @@ package body Switch.M is
Follow_Links := True;
when others =>
Bad_Switch (C);
Bad_Switch (Switch_Chars);
end case;
-- Processing for f switch
......@@ -641,6 +637,10 @@ package body Switch.M is
-- Processing for j switch
when 'j' =>
if Ptr = Max then
Bad_Switch (Switch_Chars);
end if;
Ptr := Ptr + 1;
declare
......@@ -721,7 +721,7 @@ package body Switch.M is
Verbosity_Level := Opt.High;
when others =>
Osint.Fail ("invalid switch: ", Switch_Chars);
Bad_Switch (Switch_Chars);
end case;
Ptr := Ptr + 1;
......@@ -739,20 +739,15 @@ package body Switch.M is
Ptr := Ptr + 1;
No_Main_Subprogram := True;
-- Ignore extra switch character
when '/' | '-' =>
Ptr := Ptr + 1;
-- Anything else is an error (illegal switch character)
when others =>
Bad_Switch (C);
Bad_Switch (Switch_Chars);
end case;
if Ptr <= Max then
Osint.Fail ("invalid switch: ", Switch_Chars);
Bad_Switch (Switch_Chars);
end if;
end Check_Switch;
......
......@@ -37,6 +37,11 @@ package body Switch is
Osint.Fail ("invalid switch: ", (1 => Switch));
end Bad_Switch;
procedure Bad_Switch (Switch : String) is
begin
Osint.Fail ("invalid switch: ", Switch);
end Bad_Switch;
-------------------------
-- Is_Front_End_Switch --
-------------------------
......@@ -63,7 +68,6 @@ package body Switch is
and then Switch_Chars (Switch_Chars'First) = '-';
end Is_Switch;
------------------------
--------------
-- Scan_Nat --
--------------
......
......@@ -86,6 +86,7 @@ private
-- digit of the integer value.
procedure Bad_Switch (Switch : Character);
procedure Bad_Switch (Switch : String);
-- Fail with an appropriate message when a switch is not recognized
end Switch;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment