* [Ada] No room for new warning switches
@ 2017-09-08 13:31 Arnaud Charlet
0 siblings, 0 replies; only message in thread
From: Arnaud Charlet @ 2017-09-08 13:31 UTC (permalink / raw)
To: gcc-patches; +Cc: Justin Squirek
[-- Attachment #1: Type: text/plain, Size: 503 bytes --]
This patch adds machinary to create new warning flags using the underscore
"_" prefix. This is necessary because all letters of the alphabet and letters
prefixed with a dot "." are used already.
Tested on x86_64-pc-linux-gnu, committed on trunk
2017-09-08 Justin Squirek <squirek@adacore.com>
* switch-c.adb (Scan_Front_End_Switches): Add new warning switch
case to handle underscore flags.
* warnsw.adb, warnsw.ads (Set_Underscore_Warning_Switch): Create
new procedure to handle underscores.
[-- Attachment #2: difs --]
[-- Type: text/plain, Size: 2759 bytes --]
Index: switch-c.adb
===================================================================
--- switch-c.adb (revision 251892)
+++ switch-c.adb (working copy)
@@ -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);
Index: warnsw.adb
===================================================================
--- warnsw.adb (revision 251892)
+++ warnsw.adb (working copy)
@@ -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 --
----------------------------
Index: warnsw.ads
===================================================================
--- warnsw.ads (revision 251892)
+++ warnsw.ads (working copy)
@@ -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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-09-08 13:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-08 13:31 [Ada] No room for new warning switches Arnaud Charlet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).