]> git.ipfire.org Git - thirdparty/gcc.git/commit
PR modula2/122241 Lack of spelling hints with simple errors
authorGaius Mulley <gaiusmod2@gmail.com>
Sat, 11 Oct 2025 17:34:25 +0000 (18:34 +0100)
committerGaius Mulley <gaiusmod2@gmail.com>
Sat, 11 Oct 2025 17:34:25 +0000 (18:34 +0100)
commit66a53767061d3f992f1e91fdd02ea7395636cdc8
tree3e5511613b626a53dfa0789c0768547fe823379e
parentc9586a3e9060cfcbda62604f515d9974c00adaea
PR modula2/122241 Lack of spelling hints with simple errors

This patch introduces spell checking to Modula-2.  Currently
it spell checks unknown symbols in pass 3.  Unknowns found in
record fields, with statements, procedures and variable names
are checked.

gcc/m2/ChangeLog:

PR modula2/122241
* Make-lang.in (GM2_C_OBJS): Add m2/gm2-gcc/m2spellcheck.o.
(GM2-COMP-BOOT-DEFS): Add M2StackSpell.def.
(GM2-COMP-BOOT-MODS): Add M2StackSpell.mod.
(GM2-GCC-DEFS): Add m2spellcheck.def.
(GM2-COMP-DEFS): Add M2StackSpell.def.
(GM2-COMP-MODS): Add M2StackSpell.mod.
* gm2-compiler/M2Base.mod (CheckCompatible): Add comments.
* gm2-compiler/M2MetaError.mod (importHint): New field.
(exportHint): Ditto.
(withStackHint): Ditto.
* gm2-compiler/M2Quads.mod (M2StackSpell): Import.
(BuildProcedureCall): Add spell check specifier when
encountering an unknown symbol.
(CheckProcedureParameters): Ditto.
(CheckParameter): Ditto.
(DescribeType): Ditto.
(GetQualidentImport): Ditto.
(BuildValFunction): Ditto.
(BuildCastFunction): Ditto.
(BuildConvertFunction): Ditto.
(ExpectingParameterType): Ditto.
(ExpectingVariableType): Ditto.
(BuildDesignatorPointer): Ditto.
(BuildEmptySet): Ditto.
(CheckVariableOrConstantOrProcedure): Ditto.
* gm2-compiler/P2SymBuild.mod (BuildType): Add comment.
* gm2-compiler/P3Build.bnf (SubDesignator): Reimplement.
* gm2-compiler/P3SymBuild.mod (P3StartBuildDefModule): Add
M2StackSpell.Push.
(P3StartBuildProgModule): Ditto.
(P3StartBuildImpModule): Ditto.
(StartBuildInnerModule): Ditto.
(StartBuildProcedure): Ditto.
(P3EndBuildDefModule): Add M2StackSpell.Pop.
(P3EndBuildImpModule): Ditto.
(P3EndBuildProgModule): Ditto.
(EndBuildInnerModule): Ditto.
(EndBuildProcedure): Ditto.
(BuildProcedureHeading): Ditto.
(EndBuildForward): Ditto.
* gm2-compiler/SymbolTable.mod (RequestSym): Reformat.
* gm2-gcc/init.cc (_M2_M2StackSpell_init): New prototype.
(init_PerCompilationInit): Call _M2_M2StackSpell_init.
* gm2-libs/DynamicStrings.def (RemoveWhitePrefix): Correct
comment.
* gm2-libs/DynamicStrings.mod (RemoveWhitePrefix): Ditto.
* gm2-compiler/M2StackSpell.def: New file.
* gm2-compiler/M2StackSpell.mod: New file.
* gm2-gcc/m2spellcheck.cc: New file.
* gm2-gcc/m2spellcheck.def: New file.
* gm2-gcc/m2spellcheck.h: New file.

gcc/testsuite/ChangeLog:

* gm2/iso/fail/badfield.mod: New test.
* gm2/iso/fail/badfield2.mod: New test.
* gm2/iso/fail/badprocedure.mod: New test.
* gm2/iso/fail/badprocedure2.mod: New test.
* gm2/iso/fail/badset4.mod: New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
21 files changed:
gcc/m2/Make-lang.in
gcc/m2/gm2-compiler/M2Base.mod
gcc/m2/gm2-compiler/M2MetaError.mod
gcc/m2/gm2-compiler/M2Quads.mod
gcc/m2/gm2-compiler/M2StackSpell.def [new file with mode: 0644]
gcc/m2/gm2-compiler/M2StackSpell.mod [new file with mode: 0644]
gcc/m2/gm2-compiler/P2SymBuild.mod
gcc/m2/gm2-compiler/P3Build.bnf
gcc/m2/gm2-compiler/P3SymBuild.mod
gcc/m2/gm2-compiler/SymbolTable.mod
gcc/m2/gm2-gcc/init.cc
gcc/m2/gm2-gcc/m2spellcheck.cc [new file with mode: 0644]
gcc/m2/gm2-gcc/m2spellcheck.def [new file with mode: 0644]
gcc/m2/gm2-gcc/m2spellcheck.h [new file with mode: 0644]
gcc/m2/gm2-libs/DynamicStrings.def
gcc/m2/gm2-libs/DynamicStrings.mod
gcc/testsuite/gm2/iso/fail/badfield.mod [new file with mode: 0644]
gcc/testsuite/gm2/iso/fail/badfield2.mod [new file with mode: 0644]
gcc/testsuite/gm2/iso/fail/badprocedure.mod [new file with mode: 0644]
gcc/testsuite/gm2/iso/fail/badprocedure2.mod [new file with mode: 0644]
gcc/testsuite/gm2/iso/fail/badset4.mod [new file with mode: 0644]