]> git.ipfire.org Git - thirdparty/gcc.git/commit
PR modula2/122241: Lack of spellng hints with simple errors
authorGaius Mulley <gaiusmod2@gmail.com>
Mon, 13 Oct 2025 15:43:07 +0000 (16:43 +0100)
committerGaius Mulley <gaiusmod2@gmail.com>
Mon, 13 Oct 2025 15:43:07 +0000 (16:43 +0100)
commit65acf3665ea92abed79e05e3e09e5bda4ab96317
tree2f77991641e2dcca962ad8f0e1a3ae0b42a51e7e
parent0c670d38455c788ac0447e3b86ba621521d44bce
PR modula2/122241: Lack of spellng hints with simple errors

Following on from the initial bug fix for PR modula2/122241
this patch provides spell check hints for unknown types, variables
and constants.  The accuracy of the offending module end name
is also improved

gcc/m2/ChangeLog:

PR modula2/122241
* gm2-compiler/M2Quads.mod (BuildSizeFunction): Improve
error message.
(BuildTSizeFunction): Improve error message.
* gm2-compiler/P3Build.bnf (ProgramModule): New variable
namet.
Pass namet to P3EndBuildProgModule.
(ImplementationModule): New variable namet.
Pass namet to P3EndBuildImpModule.
(ModuleDeclaration): New variable namet.
Pass namet to P3EndBuildInnerModule.
(DefinitionModule): New variable namet.
Pass namet to P3EndBuildDefModule.
* gm2-compiler/P3SymBuild.def (P3EndBuildDefModule): New
parameter tokno.
(P3EndBuildImpModule): Ditto.
(P3EndBuildProgModule): Ditto.
(EndBuildInnerModule): Ditto.
* gm2-compiler/P3SymBuild.mod (P3EndBuildDefModule): New
parameter tokno.
Pass tokno to CheckForUnknownInModule.
(P3EndBuildImpModule): Ditto.
(P3EndBuildProgModule): Ditto.
(EndBuildInnerModule): Ditto.
* gm2-compiler/PCBuild.bnf (ProgramModule): New variable
namet.
Pass namet to PCEndBuildProgModule.
(ImplementationModule): New variable namet.
Pass namet to PCEndBuildImpModule.
(ModuleDeclaration): New variable namet.
Pass namet to PCEndBuildInnerModule.
(DefinitionModule): New variable namet.
Pass namet to PCEndBuildDefModule.
* gm2-compiler/PCSymBuild.def (PCEndBuildDefModule): New
parameter tokno.
(PCEndBuildImpModule): Ditto.
(PCEndBuildProgModule): Ditto.
(PCEndBuildInnerModule): Ditto.
* gm2-compiler/PCSymBuild.mod (PCEndBuildDefModule): New
parameter tokno.
Pass tokno to CheckForUnknownInModule.
(PCEndBuildImpModule): Ditto.
(PCEndBuildProgModule): Ditto.
(PCEndBuildInnerModule): Ditto.
* gm2-compiler/PHBuild.bnf (DefinitionModule): New variable
namet.
Pass namet to PHEndBuildDefModule.
(ModuleDeclaration): New variable namet.
Pass namet to PHEndBuildProgModule.
(ImplementationModule): New variable namet.
Pass namet to PHEndBuildImpModule.
(ModuleDeclaration): New variable namet.
Pass namet to PHEndBuildInnerModule.
(DefinitionModule): New variable namet.
Pass namet to PHEndBuildDefModule.
* gm2-compiler/SymbolTable.def (CheckForUnknownInModule): Add
tokno parameter.
* gm2-compiler/SymbolTable.mod (CheckForUnknownInModule): Add
tokno parameter.
Pass tokno to CheckForUnknowns.
(CheckForUnknowns): Reimplement.

gcc/testsuite/ChangeLog:

PR modula2/122241
* gm2/iso/fail/badconst.mod: New test.
* gm2/iso/fail/badtype.mod: New test.
* gm2/iso/fail/badvar.mod: New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
13 files changed:
gcc/m2/gm2-compiler/M2Quads.mod
gcc/m2/gm2-compiler/P3Build.bnf
gcc/m2/gm2-compiler/P3SymBuild.def
gcc/m2/gm2-compiler/P3SymBuild.mod
gcc/m2/gm2-compiler/PCBuild.bnf
gcc/m2/gm2-compiler/PCSymBuild.def
gcc/m2/gm2-compiler/PCSymBuild.mod
gcc/m2/gm2-compiler/PHBuild.bnf
gcc/m2/gm2-compiler/SymbolTable.def
gcc/m2/gm2-compiler/SymbolTable.mod
gcc/testsuite/gm2/iso/fail/badconst.mod [new file with mode: 0644]
gcc/testsuite/gm2/iso/fail/badtype.mod [new file with mode: 0644]
gcc/testsuite/gm2/iso/fail/badvar.mod [new file with mode: 0644]