https://gcc.gnu.org/g:6422bb490359aa43fbdf699195d7cc7e071a0fb1
commit r17-960-g6422bb490359aa43fbdf699195d7cc7e071a0fb1 Author: Viljar Indus <[email protected]> Date: Wed Mar 25 15:18:52 2026 +0200 ada: Create a boolean version of Warnings_Suppressed 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. Diff: --- gcc/ada/errout.adb | 8 ++------ gcc/ada/erroutc.ads | 5 +++++ gcc/ada/errutil.adb | 4 +--- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb index 2bf3a2844117..ab5aaf0b7374 100644 --- a/gcc/ada/errout.adb +++ b/gcc/ada/errout.adb @@ -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; diff --git a/gcc/ada/erroutc.ads b/gcc/ada/erroutc.ads index 3d4e14514dda..2a3f7e3c6bc2 100644 --- a/gcc/ada/erroutc.ads +++ b/gcc/ada/erroutc.ads @@ -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; diff --git a/gcc/ada/errutil.adb b/gcc/ada/errutil.adb index 0f88f2d4c48d..4ed8e952a291 100644 --- a/gcc/ada/errutil.adb +++ b/gcc/ada/errutil.adb @@ -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;
