[Ada] Fix error in classification of restriction warnings

Arnaud Charlet charlet@adacore.com
Wed May 21 13:08:00 GMT 2014


Some restriction warnings messages were still being tagged as
[enabled by default] instead of [restriction warning]. The
following program used not to give the warning since it got
incorrectly suppressed (compiled with -gnatj55 -gnatw.d -gnatl)

     1. pragma Warnings (Off, "[enabled by default]");
     2. pragma Restriction_Warnings
     3.   (No_Dependence => Ada.Containers);
     4. with Ada.Containers;
             |
        >>> warning: violation of restriction
            "No_Dependence => Ada.Containers" at line
            3 [restriction warning]

     5. procedure Ololo (Unref : Integer) is
     6.     type String is (A, B, C);
     7.
     8.     procedure P (I, J : in out Integer) is
     9.     begin
    10.        if I < J then
    11.           I := I + 1;
    12.           P (I, J);
    13.        end if;
    14.     end P;
    15.
    16.     J, I  : Integer := 10;
    17.
    18.     X, Y : Float := 1.0;
    19. begin
    20.     if X = Y then
    21.        P (J, I);
    22.     end if;
    23. end;

Tested on x86_64-pc-linux-gnu, committed on trunk

2014-05-21  Robert Dewar  <dewar@adacore.com>

	* errout.ads: Add documentation for use of >*> tag.
	* restrict.adb: Make sure we use >*> tag for restriction warnings.

-------------- next part --------------
Index: errout.ads
===================================================================
--- errout.ads	(revision 210697)
+++ errout.ads	(working copy)
@@ -312,10 +312,10 @@
    --    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
-   --      effect is the same as ? described above, and in particular << and
-   --      <X< have the effect of ?? and ?X? respectively. If Error_Msg_Warn
-   --      is False, then the < << or <X< sequence is ignored and the message
-   --      is treated as a error rather than a warning.
+   --      effect is the same as ? described above, and in particular <<
+   --      <X< and <*< have the effect of ?? ?X? and ?*? respectively. If
+   --      Error_Msg_Warn is False, then the < << or <X< sequence is ignored
+   --      and the message is treated as a error rather than a warning.
 
    --    Insertion character A-Z (Upper case letter: Ada reserved word)
    --      If two or more upper case letters appear in the message, they are
Index: restrict.adb
===================================================================
--- restrict.adb	(revision 210697)
+++ restrict.adb	(working copy)
@@ -303,7 +303,7 @@
          Error_Msg_Node_1 := N;
          Error_Msg_Warn := No_Use_Of_Attribute_Warning (A_Id);
          Error_Msg_N
-           ("<violation of restriction `No_Use_Of_Attribute '='> &`#", N);
+           ("<*<violation of restriction `No_Use_Of_Attribute '='> &`#", N);
       end if;
    end Check_Restriction_No_Use_Of_Attribute;
 
@@ -336,7 +336,7 @@
          Error_Msg_Node_1 := Id;
          Error_Msg_Warn := No_Use_Of_Pragma_Warning (P_Id);
          Error_Msg_N
-           ("<violation of restriction `No_Use_Of_Pragma '='> &`#", Id);
+           ("<*<violation of restriction `No_Use_Of_Pragma '='> &`#", Id);
       end if;
    end Check_Restriction_No_Use_Of_Pragma;
 
@@ -645,7 +645,7 @@
 
             if No_Dependences.Table (J).Warn then
                Error_Msg
-                 ("??violation of restriction `No_Dependence '='> &`#",
+                 ("?*?violation of restriction `No_Dependence '='> &`#",
                   Sloc (Err));
             else
                Error_Msg
@@ -691,7 +691,7 @@
          Error_Msg_Node_1 := Id;
          Error_Msg_Warn := No_Specification_Of_Aspect_Warning (A_Id);
          Error_Msg_N
-           ("<violation of restriction `No_Specification_Of_Aspect '='> &`#",
+           ("<*<violation of restriction `No_Specification_Of_Aspect '='> &`#",
             Id);
       end if;
    end Check_Restriction_No_Specification_Of_Aspect;


More information about the Gcc-patches mailing list