]> git.ipfire.org Git - thirdparty/gcc.git/commit
PR modula2/114517 gm2 does not allow comparison operator hash in column one
authorGaius Mulley <(no_default)>
Thu, 28 Mar 2024 14:57:49 +0000 (14:57 +0000)
committerGaius Mulley <(no_default)>
Thu, 28 Mar 2024 14:57:49 +0000 (14:57 +0000)
commit04799f03e8d01b903295ef3a100a0117b7ddbf5e
tree18e5d0435fe934fae1e540a003445a00f0da84c6
parent44ab31419cf366e889a019a2fe31638c6f093729
PR modula2/114517 gm2 does not allow comparison operator hash in column one

This patch allows -fno-cpp to be supplied to gm2.  Without this patch
it causes an ICE.  The patch allows -fno-cpp to turn off cpp flags.
These are tested in m2.flex to decide whether a change of state is
allowed (enabling handling of #line directives).

gcc/ChangeLog:

PR modula2/114517
* doc/gm2.texi: Mention gm2 treats a # in the first column
as a preprocessor directive unless -fno-cpp is supplied.

gcc/m2/ChangeLog:

PR modula2/114517
* gm2-compiler/M2Options.def (SetCpp): Add comment.
(GetCpp): Move after SetCpp.
(GetLineDirectives): New procedure function.
* gm2-compiler/M2Options.mod (GetLineDirectives): New
procedure function.
* gm2-gcc/m2options.h (M2Options_GetLineDirectives): New
prototype.
* gm2-lang.cc (gm2_langhook_init_options): OPT_fcpp only
assert if !value.
* m2.flex: Test GetLineDirectives before changing to LINE0
state.

gcc/testsuite/ChangeLog:

PR modula2/114517
* gm2/cpp/fail/hashfirstcolumn2.mod: New test.
* gm2/imports/fail/imports-fail.exp: New test.
* gm2/imports/fail/localmodule2.mod: New test.
* gm2/imports/run/pass/localmodule.mod: New test.

Signed-off-by: Gaius Mulley <(no_default)>
gcc/doc/gm2.texi
gcc/m2/gm2-compiler/M2Options.def
gcc/m2/gm2-compiler/M2Options.mod
gcc/m2/gm2-gcc/m2options.h
gcc/m2/gm2-lang.cc
gcc/m2/m2.flex
gcc/testsuite/gm2/cpp/fail/hashfirstcolumn2.mod [new file with mode: 0644]
gcc/testsuite/gm2/imports/fail/imports-fail.exp [new file with mode: 0644]
gcc/testsuite/gm2/imports/fail/localmodule2.mod [new file with mode: 0644]
gcc/testsuite/gm2/imports/run/pass/localmodule.mod [new file with mode: 0644]