]> git.ipfire.org Git - thirdparty/gcc.git/commit
PR modula2/122407: similar error messages are emitted for an unknown symbol
authorGaius Mulley <gaiusmod2@gmail.com>
Fri, 24 Oct 2025 12:04:10 +0000 (13:04 +0100)
committerGaius Mulley <gaiusmod2@gmail.com>
Fri, 24 Oct 2025 12:04:10 +0000 (13:04 +0100)
commitcafc877cc1ade3fea34f1ca32ab12126956fc5e8
treeb223e755c575c2beb40198cbf219b0a181a83359
parent04df8fa9e73e612f978fff35a97841703b872f6c
PR modula2/122407: similar error messages are emitted for an unknown symbol

This followup to PR modula2/122241 reduces error message clutter by
filtering unknown symbol error ensuring that only one error message
is emitted for an unknown symbol at a particular location.
The filter is implemented using two binary trees.  A new generic
(based on the address type) binary dictionary module is added to
the base libraries.

gcc/m2/ChangeLog:

PR modula2/122407
* Make-lang.in (GM2-LIBS-BOOT-DEFS): Add BinDict.def.
(GM2-LIBS-BOOT-MODS): Add BinDict.mod.
(GM2-COMP-BOOT-DEFS): Add FilterError.def.
(GM2-COMP-BOOT-MODS): Add FilterError.mod.
(GM2-LIBS-DEFS): Add BinDict.def.
(GM2-LIBS-MODS): Add BinDict.mod.
* gm2-compiler/M2Error.def (KillError): New procedure.
* gm2-compiler/M2Error.mod (WriteFormat3): Reformat.
(NewError): Rewrite and call AddToList.
(AddToList): New procedure.
(SubFromList): Ditto.
(WipeReferences): Ditto.
(KillError): Ditto.
* gm2-compiler/M2LexBuf.mod (MakeVirtualTok): Return
caret if all token positions are identical.
* gm2-compiler/M2MetaError.mod (KillError): Import.
(FilterError): Import.
(FilterUnknown): New global.
(initErrorBlock): Initialize symcause and token.
(push): Capitalize comments.
(pop): Copy symcause to toblock if discovered.
(doError): Add parameter sym.
(defaultError): Assign token if discovered.
Pass NulSym to doError.
(updateTokSym): New procedure.
(chooseError): Call updateTokSym.
(doErrorScopeModule): Pass sym to doError.
(doErrorScopeForward): Ditto.
(doErrorScopeMod): Ditto.
(doErrorScopeFor): Ditto.
(doErrorScopeDefinition): Ditto.
(doErrorScopeDef): Ditto.
(doErrorScopeProc): Ditto.
(used): Pass sym[bol] to doError.
(op): Assign symcause when encountering
an error, warning or note.
(MetaErrorStringT1): Rewrite.
(MetaErrorStringT2): Ditto.
(MetaErrorStringT3): Ditto.
(MetaErrorStringT4): Ditto.
(isUniqueError): New procedure function.
(wrapErrors): Rewrite.
(FilterUnknown): Initialize.
* gm2-compiler/M2Quads.mod (BuildTSizeFunction): Add spell check
hint specifier.
* gm2-compiler/FilterError.def: New file.
* gm2-compiler/FilterError.mod: New file.
* gm2-libs/BinDict.def: New file.
* gm2-libs/BinDict.mod: New file.

libgm2/ChangeLog:

PR modula2/122407
* libm2pim/Makefile.am (M2MODS): Add BinDict.mod.
(M2DEFS): Add BinDict.def.
* libm2pim/Makefile.in: Regenerate.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
12 files changed:
gcc/m2/Make-lang.in
gcc/m2/gm2-compiler/FilterError.def [new file with mode: 0644]
gcc/m2/gm2-compiler/FilterError.mod [new file with mode: 0644]
gcc/m2/gm2-compiler/M2Error.def
gcc/m2/gm2-compiler/M2Error.mod
gcc/m2/gm2-compiler/M2LexBuf.mod
gcc/m2/gm2-compiler/M2MetaError.mod
gcc/m2/gm2-compiler/M2Quads.mod
gcc/m2/gm2-libs/BinDict.def [new file with mode: 0644]
gcc/m2/gm2-libs/BinDict.mod [new file with mode: 0644]
libgm2/libm2pim/Makefile.am
libgm2/libm2pim/Makefile.in