diff options
author | Gaius Mulley <gaiusmod2@gmail.com> | 2023-01-26 21:43:22 +0000 |
---|---|---|
committer | Gaius Mulley <gaiusmod2@gmail.com> | 2023-01-26 21:43:22 +0000 |
commit | 94673a121cfc7f9d51c9d05e31795477f4dc8dc7 (patch) | |
tree | 4c9f12b0bfba33a7fd1c51afe648ba9a927b3fbe /gcc/fortran/trans-openmp.cc | |
parent | 67bcd1c5ed4d966a91b49b8a7da7c1ca3289c2ce (diff) | |
download | gcc-94673a121cfc7f9d51c9d05e31795477f4dc8dc7.zip gcc-94673a121cfc7f9d51c9d05e31795477f4dc8dc7.tar.gz gcc-94673a121cfc7f9d51c9d05e31795477f4dc8dc7.tar.bz2 |
PR-108551 gcc/m2/gm2-libs-pim/Termbase.mod:128:1 error end of non-void
cc1gm2 generates an error: control reaches end of non-void function when
compiling Termbase.mod if -Werror=return-type is present.
../gcc/m2/gm2-libs-pim/Termbase.mod: In function 'Termbase_KeyPressed':
../gcc/m2/gm2-libs-pim/Termbase.mod:128:1: error: control reaches end
of non-void function [-Werror=return-type]
128 | END KeyPressed ;
| ^~~
This occurs as cc1gm2 does skips over the <* noreturn *> attribute. This
patch records the <* noreturn *> attribute in the m2 symbol table and
later on sets TREE_THIS_VOLATILE when creating the function decl.
The patch also contains a fix for the main scaffold which also omitted
a return 0 after the exception handler code.
gcc/m2/ChangeLog:
* gm2-compiler/M2GCCDeclare.mod: Import IsProcedureNoReturn.
(DeclareProcedureToGccWholeProgram): New variable declared and set
returnType. Pass returnType to BuildEndFunctionDeclaration.
Extra parameter IsProcedureNoReturn passed to
BuildEndFunctionDeclaration.
* gm2-compiler/M2Quads.mod (BuildM2MainFunction): Correct
scaffold comment and add extra return 0.
* gm2-compiler/P2Build.bnf: Import BuildNoReturnAttribute.
(ProcedureHeading): Process EndBuildFormalParameters before
parsing AttributeNoReturn.
(DefProcedureHeading): Process EndBuildFormalParameters before
parsing AttributeNoReturn.
(AttributeNoReturn): Call BuildNoReturnAttribute.
* gm2-compiler/P2SymBuild.def (BuildNoReturnAttribute): New
procedure.
* gm2-compiler/P2SymBuild.mod (BuildNoReturnAttribute): New
procedure.
* gm2-compiler/SymbolTable.def (PutProcedureInline): Corrected
comment.
(PutProcedureNoReturn): New procedure.
(IsProcedureNoReturn): New procedure function.
* gm2-compiler/SymbolTable.mod (SymProcedure): IsNoReturn
new field.
(MakeProcedure): Initialize IsNoReturn to FALSE.
(PutProcedureNoReturn): New procedure.
(IsProcedureNoReturn): New procedure function.
* gm2-gcc/m2decl.cc (m2decl_BuildEndFunctionDeclaration):
Add extra parameter isnoreturn. Set TREE_THIS_VOLATILE
to isnoreturn.
* gm2-gcc/m2decl.def (BuildEndFunctionDeclaration): Add
extra parameter isnoreturn.
* gm2-gcc/m2decl.h (m2decl_BuildEndFunctionDeclaration): Add
extra parameter isnoreturn.
* gm2-gcc/m2except.cc (m2except_InitExceptions): Change all
function decl to pass an extra parameter isnoreturn.
gcc/testsuite/ChangeLog:
* gm2/warnings/returntype/fail/badreturn.mod: New test.
* gm2/warnings/returntype/fail/warnings-returntype-fail.exp:
New test.
* gm2/warnings/returntype/pass/Termbase.mod: New test.
* gm2/warnings/returntype/pass/goodreturn.mod: New test.
* gm2/warnings/returntype/pass/keypressedsimple.mod: New test.
* gm2/warnings/returntype/pass/warnings-returntype-pass.exp:
New test.
Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
Diffstat (limited to 'gcc/fortran/trans-openmp.cc')
0 files changed, 0 insertions, 0 deletions