diff options
author | Viljar Indus <indus@adacore.com> | 2024-11-11 10:19:21 +0200 |
---|---|---|
committer | Marc Poulhiès <dkm@gcc.gnu.org> | 2024-11-26 10:49:35 +0100 |
commit | 8d0bb808f632eea52548df59e36c1b479c64c45b (patch) | |
tree | caec91850b73bb11982c7151cd12b509c85870e6 /gcc/ada/errutil.adb | |
parent | ba0c6d0e4ea01afa3ad8740fce6d77e009b1ccbf (diff) | |
download | gcc-8d0bb808f632eea52548df59e36c1b479c64c45b.zip gcc-8d0bb808f632eea52548df59e36c1b479c64c45b.tar.gz gcc-8d0bb808f632eea52548df59e36c1b479c64c45b.tar.bz2 |
ada: Refactor checking redundant messages
Move common code between errout and errutil into a single function.
gcc/ada/ChangeLog:
* errout.adb: Use Is_Redundant_Error_Message.
* erroutc.adb: Move the common code for checking if a message
can be removed to Is_Redundant_Error_Message.
* erroutc.ads: Add definition of Is_Redundant_Error_Message.
* errutil.adb: Use Is_Redundant_Error_Message.
Diffstat (limited to 'gcc/ada/errutil.adb')
-rw-r--r-- | gcc/ada/errutil.adb | 32 |
1 files changed, 4 insertions, 28 deletions
diff --git a/gcc/ada/errutil.adb b/gcc/ada/errutil.adb index ab320be..62cd867 100644 --- a/gcc/ada/errutil.adb +++ b/gcc/ada/errutil.adb @@ -244,35 +244,11 @@ package body Errutil is -- from the parser recovering. In full errors mode, we don't do this -- deletion, but otherwise such messages are discarded at this stage. - if Prev_Msg /= No_Error_Msg - and then Errors.Table (Prev_Msg).Line = Errors.Table (Cur_Msg).Line - and then Errors.Table (Prev_Msg).Sfile = Errors.Table (Cur_Msg).Sfile - then - -- Don't delete unconditional messages and at this stage, don't - -- delete continuation lines (we attempted to delete those earlier - -- if the parent message was deleted. - - if not Errors.Table (Cur_Msg).Uncond and then not Continuation then - - -- Don't delete if prev msg is warning and new msg is an error. - -- This is because we don't want a real error masked by a warning. - -- In all other cases (that is parse errors for the same line that - -- are not unconditional) we do delete the message. This helps to - -- avoid junk extra messages from cascaded parsing errors - - if Errors.Table (Prev_Msg).Kind not in Warning | Erroutc.Style - or else Errors.Table (Cur_Msg).Kind in Warning | Erroutc.Style - then - -- All tests passed, delete the message by simply returning - -- without any further processing. - - if not Continuation then - Last_Killed := True; - end if; + if Is_Redundant_Error_Message (Prev_Msg, Cur_Msg) then + pragma Assert (not Continuation); - return; - end if; - end if; + Last_Killed := True; + return; end if; -- Come here if message is to be inserted in the error chain |