From: Ronan Desplanques Date: Mon, 12 Feb 2024 15:49:38 +0000 (+0100) Subject: ada: Fix overlap warning suppression X-Git-Tag: basepoints/gcc-16~9098 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f545412378592e3c4b420b61867bfd3dda2f6480;p=thirdparty%2Fgcc.git ada: Fix overlap warning suppression Before this patch, some warnings about overlapping actuals were emitted regardless of the Value of Warnsw.Warnings_Package.Warn_On_Overlap. This patch fixes this. gcc/ada/ * sem_warn.adb (Warn_On_Overlapping_Actuals): Stop ignoring warning suppression settings. --- diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb index 57bdee65356..ccf9067c672 100644 --- a/gcc/ada/sem_warn.adb +++ b/gcc/ada/sem_warn.adb @@ -3831,16 +3831,6 @@ package body Sem_Warn is then null; - -- We only report warnings on overlapping arrays and record - -- types if switch is set. - - elsif not Warn_On_Overlap - and then not (Is_Elementary_Type (Etype (Form1)) - and then - Is_Elementary_Type (Etype (Form2))) - then - null; - -- Here we may need to issue overlap message else @@ -3858,22 +3848,25 @@ package body Sem_Warn is or else not (Is_Elementary_Type (Etype (Form1)) - and then Is_Elementary_Type (Etype (Form2))) + and then Is_Elementary_Type (Etype (Form2))); - -- debug flag -gnatd.E changes the error to a warning - -- even in Ada 2012 mode. + if not Error_Msg_Warn or else Warn_On_Overlap then + -- debug flag -gnatd.E changes the error to a warning + -- even in Ada 2012 mode. - or else Error_To_Warning; + if Error_To_Warning then + Error_Msg_Warn := True; + end if; - -- For greater clarity, give name of formal + -- For greater clarity, give name of formal - Error_Msg_Node_2 := Form2; + Error_Msg_Node_2 := Form2; - -- This is one of the messages + -- This is one of the messages - Error_Msg_FE - ("<.i