Restriction warning messages are now tagged [restriction warning]
if -gnatw.d is used, instead of [enabled by default]. This new
tag can be used in pragma Warning_As_Errors. The following is
compiled with -gnatw.d -gnatj50 -gnatl
1. pragma Warning_As_Error ("[restriction warning]");
2. pragma Restriction_Warnings (No_Wide_Characters);
3. package RWarnTag is
4. X : Wide_Wide_Character := 'X';
|
>>> error: violation of restriction
"No_Wide_Characters" at line 2
[restriction warning]
[warning-as-error]
5. end;
Tested on x86_64-pc-linux-gnu, committed on trunk
2014-05-21 Robert Dewar <[email protected]>
* errout.adb (Set_Msg_Insertion_Warning): Handle ?*? (restriction
warning) case.
* errout.ads: Document ?*? (restriction warning) insertion.
* erroutc.adb (Get_Warning_Tag): Deal with ?*? (restriction
warning) case.
* erroutc.ads: Document use of * for restriction warning tag.
* restrict.adb (Restriction_Msg): Tag with ?*? instead of ??.
Index: errout.adb
===================================================================
--- errout.adb (revision 210687)
+++ errout.adb (working copy)
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2014, 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- --
@@ -2764,7 +2764,9 @@
elsif P + 1 <= Text'Last
and then (Text (P) in 'a' .. 'z'
or else
- Text (P) in 'A' .. 'Z')
+ Text (P) in 'A' .. 'Z'
+ or else
+ Text (P) = '*')
and then Text (P + 1) = C
then
Warning_Msg_Char := Text (P);
Index: errout.ads
===================================================================
--- errout.ads (revision 210687)
+++ errout.ads (working copy)
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2014, 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- --
@@ -60,10 +60,12 @@
-- Exception raised if Raise_Exception_On_Error is true
Warning_Doc_Switch : Boolean renames Err_Vars.Warning_Doc_Switch;
- -- If this is set True, then the ??/?x?/?X? sequences in error messages
- -- are active (see errout.ads for details). If this switch is False, then
- -- these sequences are ignored (i.e. simply equivalent to a single ?). The
- -- -gnatw.d switch sets this flag True, -gnatw.D sets this flag False.
+ -- If this is set True, then the ??/?*?/?x?/?X? sequences in error messages
+ -- generate appropriate tags for the output error messages. If this switch
+ -- is False, then these sequences are still recognized (for the purposes
+ -- of implementing pragmas Warnings (Off,..) and Warning_As_Pragma(...) but
+ -- do not result in adding the error message tag. The -gnatw.d switch sets
+ -- this flag True, -gnatw.D sets this flag False.
-----------------------------------
-- Suppression of Error Messages --
@@ -281,7 +283,7 @@
-- messages, and the usual style is to include it, since it makes it
-- clear that the continuation is part of a warning message.
--
- -- Note: this usage is obsolete, use ??, ?x? or ?X? instead to specify
+ -- Note: this usage is obsolete, use ?? ?*? ?x? ?X? instead to specify
-- the string to be added when Warn_Doc_Switch is set to True. If this
-- switch is True, then for simple ? messages it has no effect. This
-- simple form is to ease transition and will be removed later.
@@ -302,6 +304,11 @@
-- letter corresponding to the lower case letter x in the message.
-- For continuations, use this on each continuation message.
+ -- Insertion character ?*? (restriction warning)
+ -- Like ?, but if the flag Warn_Doc_Switch is True, adds the string
+ -- "[restriction warning]" at the end of the warning message. For
+ -- continuations, use this on each continuation message.
+
-- Insertion character < (Less Than: conditional warning message)
-- The character < appearing anywhere in a message is used for a
-- conditional error message. If Error_Msg_Warn is True, then the
Index: restrict.adb
===================================================================
--- restrict.adb (revision 210687)
+++ restrict.adb (working copy)
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2014, 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- --
@@ -1047,7 +1047,7 @@
-- Set warning message if warning
if Restriction_Warnings (R) then
- Add_Str ("??");
+ Add_Str ("?*?");
-- If real violation (not warning), then mark it as non-serious unless
-- it is a violation of No_Finalization in which case we leave it as a
Index: erroutc.adb
===================================================================
--- erroutc.adb (revision 210687)
+++ erroutc.adb (working copy)
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2014, 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- --
@@ -310,6 +310,8 @@
if Warn and then Warn_Chr /= ' ' then
if Warn_Chr = '?' then
return "[enabled by default]";
+ elsif Warn_Chr = '*' then
+ return "[restriction warning]";
elsif Warn_Chr in 'a' .. 'z' then
return "[-gnatw" & Warn_Chr & ']';
else pragma Assert (Warn_Chr in 'A' .. 'Z');
Index: erroutc.ads
===================================================================
--- erroutc.ads (revision 210687)
+++ erroutc.ads (working copy)
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2014, 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- --
@@ -64,10 +64,11 @@
Warning_Msg_Char : Character;
-- Warning character, valid only if Is_Warning_Msg is True
- -- ' ' -- ? appeared on its own in message
- -- '?' -- ?? appeared in message
- -- 'x' -- ?x? appeared in message
- -- 'X' -- ?x? appeared in message (X is upper case of x)
+ -- ' ' -- ? appeared on its own in message
+ -- '?' -- ?? appeared in message
+ -- 'x' -- ?x? appeared in message (x = a .. z)
+ -- 'X' -- ?X? appeared in message (X = A .. Z)
+ -- '*' -- ?*? appeared in message
Is_Style_Msg : Boolean := False;
-- Set True to indicate if the current message is a style message
@@ -201,10 +202,11 @@
Warn_Chr : Character;
-- Warning character (note: set even if Warning_Doc_Switch is False)
- -- ' ' -- ? appeared on its own in message or no ? in message
- -- '?' -- ?? appeared in message
- -- 'x' -- ?x? appeared in message
- -- 'X' -- ?x? appeared in message (X is upper case of x)
+ -- ' ' -- ? appeared on its own in message
+ -- '?' -- ?? appeared in message
+ -- 'x' -- ?x? appeared in message (x = a .. z)
+ -- 'X' -- ?X? appeared in message (X = A .. Z)
+ -- '*' -- ?*? appeared in message
Style : Boolean;
-- True if style message (starts with "(style)")