diff options
author | Ronan Desplanques <desplanques@adacore.com> | 2024-02-12 16:49:38 +0100 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2024-05-14 10:19:53 +0200 |
commit | f545412378592e3c4b420b61867bfd3dda2f6480 (patch) | |
tree | 7516cc2bb2c4f87cce8a7beee71279bba302fada /gcc | |
parent | 4f3567cf3b71ccf5447659a028d08429c2d30df7 (diff) | |
download | gcc-f545412378592e3c4b420b61867bfd3dda2f6480.zip gcc-f545412378592e3c4b420b61867bfd3dda2f6480.tar.gz gcc-f545412378592e3c4b420b61867bfd3dda2f6480.tar.bz2 |
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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/sem_warn.adb | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb index 57bdee6..ccf9067 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<writable actual for & overlaps with actual for &", - Act1, Form1); + Error_Msg_FE ("<.i<writable actual for & overlaps with" + & "actual for &", Act1, Form1); + end if; end if; end if; end if; |