===================================================================
@@ -1268,8 +1268,20 @@
Bad_Switch ("-gnatw." & Switch_Chars (Ptr .. Max));
end if;
- -- Normal case, no dot
+ -- Case of underscore switch
+ elsif C = '_' and then Ptr < Max then
+ Ptr := Ptr + 1;
+ C := Switch_Chars (Ptr);
+
+ if Set_Underscore_Warning_Switch (C) then
+ Store_Compilation_Switch ("-gnatw_" & C);
+ else
+ Bad_Switch ("-gnatw_" & Switch_Chars (Ptr .. Max));
+ end if;
+
+ -- Normal case, no dot
+
else
if Set_Warning_Switch (C) then
Store_Compilation_Switch ("-gnatw" & C);
===================================================================
@@ -471,6 +471,24 @@
return True;
end Set_Dot_Warning_Switch;
+ -----------------------------------
+ -- Set_Underscore_Warning_Switch --
+ -----------------------------------
+
+ function Set_Underscore_Warning_Switch (C : Character) return Boolean is
+ begin
+ case C is
+ when others =>
+ if Ignore_Unrecognized_VWY_Switches then
+ Write_Line ("unrecognized switch -gnatw_" & C & " ignored");
+ else
+ return False;
+ end if;
+ end case;
+
+ return True;
+ end Set_Underscore_Warning_Switch;
+
----------------------------
-- Set_GNAT_Mode_Warnings --
----------------------------
===================================================================
@@ -147,6 +147,13 @@
-- the command line or .C in a string literal in pragma Warnings. Returns
-- True for valid warning character C, False for invalid character.
+ function Set_Underscore_Warning_Switch (C : Character) return Boolean;
+ -- This function sets the warning switch or switches corresponding to the
+ -- given character preceded by an underscore. Used to process a -gnatw_
+ -- switch on the command line or _C in a string literal in pragma Warnings.
+ -- Returns True for valid warnings character C, False for invalid
+ -- character.
+
procedure Set_GNAT_Mode_Warnings;
-- This is called in -gnatg mode to set the warnings for gnat mode. It is
-- also used to set the proper warning statuses for -gnatw.g. Note that