]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Create a boolean version of Warnings_Suppressed
authorViljar Indus <indus@adacore.com>
Wed, 25 Mar 2026 13:18:52 +0000 (15:18 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Fri, 29 May 2026 08:49:50 +0000 (10:49 +0200)
Add a Boolean overload of Warnings_Suppressed that wraps the existing
String_Id version, simplifying call sites that only need to know whether
warnings are suppressed at a location rather than the suppression reason.

gcc/ada/ChangeLog:

* erroutc.ads (Warnings_Suppressed): New Boolean overload.
* errout.adb (Error_Msg_Internal): Use Boolean Warnings_Suppressed.
* errutil.adb (Error_Msg): Likewise.

gcc/ada/errout.adb
gcc/ada/erroutc.ads
gcc/ada/errutil.adb

index 2bf3a284411721ad6352cbdfd3793f9cab9e26f0..ab5aaf0b7374ac1a471bd4bff34492d383a4d50f 100644 (file)
@@ -780,9 +780,7 @@ package body Errout is
       --  that style checks are not considered warning messages for this
       --  purpose.
 
-      if Error_Msg_Kind = Warning
-        and then Warnings_Suppressed (Orig_Loc) /= No_String
-      then
+      if Error_Msg_Kind = Warning and then Warnings_Suppressed (Orig_Loc) then
          return;
 
       --  For style messages, check too many messages so far
@@ -1351,9 +1349,7 @@ package body Errout is
 
          --  Immediate return if warning message and warnings are suppressed
 
-         if Warnings_Suppressed (Optr) /= No_String
-           or else Warnings_Suppressed (Sptr) /= No_String
-         then
+         if Warnings_Suppressed (Optr) or else Warnings_Suppressed (Sptr) then
             Cur_Msg := No_Error_Msg;
             return;
          end if;
index 3d4e14514dda6a1574f0bb82e702af9bfd8c8c23..2a3f7e3c6bc28b1f2b19ebaa5273d9a875f96d7d 100644 (file)
@@ -906,6 +906,11 @@ package Erroutc is
    --  parameter from the pragma is returned (or the null string if no Reason
    --  parameter was present).
 
+   function Warnings_Suppressed (Loc : Source_Ptr) return Boolean
+   is (Warnings_Suppressed (Loc) /= No_String);
+   --  Returns true if there is a reason for the warnings to be suppressed at
+   --  this location.
+
    function Warning_Specifically_Suppressed
      (Loc : Source_Ptr;
       Msg : String_Ptr;
index 0f88f2d4c48df6de53c93ab727d6a3bf4e900f5d..4ed8e952a2919d8c11ce989d1d2a9842006196de 100644 (file)
@@ -192,9 +192,7 @@ package body Errutil is
       --  Immediate return if warning message and warnings are suppressed.
       --  Note that style messages are not warnings for this purpose.
 
-      if Error_Msg_Kind = Warning
-        and then Warnings_Suppressed (Sptr) /= No_String
-      then
+      if Error_Msg_Kind = Warning and then Warnings_Suppressed (Sptr) then
          Cur_Msg := No_Error_Msg;
          return;
       end if;