From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1499) id 630B83858D32; Sat, 3 Jun 2023 14:28:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 630B83858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685802522; bh=sjRuuFRZBFq6OG7RhIVxbiD4QV13pFNaYZ7iswu7ue4=; h=From:To:Subject:Date:From; b=HEXBy//QKCDkwhvmlhMdNaFP2YT+ZGgQIHxI+/c2yWWT+G7815l49uF+W1sXiqtuv fnfVP+Dq4p+pV8zo+UaFlg9qBaYKNC2DD5E6IRgoRwjh1koFGKVkpCZ3Y7S6jwkw1v hnB7SK4O3TLnPYCKI7LcfBuoX2ISKV8pXZ5aFujY= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Gaius Mulley To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-1520] PR modula2/110003 Wrong source line listed for unused parameters X-Act-Checkin: gcc X-Git-Author: Gaius Mulley X-Git-Refname: refs/heads/master X-Git-Oldrev: 38af81df6aac11d49f9378d1c628ccc3c815c3ff X-Git-Newrev: 7c0e2159afb3235950d3d8f61ef085cd1ccf0dfc Message-Id: <20230603142842.630B83858D32@sourceware.org> Date: Sat, 3 Jun 2023 14:28:42 +0000 (GMT) List-Id: https://gcc.gnu.org/g:7c0e2159afb3235950d3d8f61ef085cd1ccf0dfc commit r14-1520-g7c0e2159afb3235950d3d8f61ef085cd1ccf0dfc Author: Gaius Mulley Date: Sat Jun 3 15:27:58 2023 +0100 PR modula2/110003 Wrong source line listed for unused parameters Ensure that the parameter token position is recorded for both definition and implementation modules. The shadow variable is created inside BuildFormalParameterSection. The shadow variable needs to have the other definition or implementation module token position set when CheckFormalParameterSection is called. This allows the MetaError family of procedures to request the implementation module token position when reporting unused parameters. gcc/m2/ChangeLog: PR modula2/110003 * gm2-compiler/P2SymBuild.mod (GetParameterShadowVar): Import. (CheckFormalParameterSection): Call PutDeclared for the shadow variable associated with the parameter. Signed-off-by: Gaius Mulley Diff: --- gcc/m2/gm2-compiler/P2SymBuild.mod | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gcc/m2/gm2-compiler/P2SymBuild.mod b/gcc/m2/gm2-compiler/P2SymBuild.mod index de56cc46c5c..98a51ea2ca1 100644 --- a/gcc/m2/gm2-compiler/P2SymBuild.mod +++ b/gcc/m2/gm2-compiler/P2SymBuild.mod @@ -59,7 +59,7 @@ FROM SymbolTable IMPORT NulSym, MakeSubrange, MakeVar, MakeType, PutType, MakeModuleCtor, - PutMode, PutDeclared, + PutMode, PutDeclared, GetParameterShadowVar, PutFieldEnumeration, PutSubrange, PutVar, PutConst, PutConstSet, PutConstructor, IsDefImp, IsType, IsRecord, IsRecordField, IsPointer, @@ -1820,14 +1820,15 @@ BEGIN (* different parameter names *) FailParameter('', 'the parameter has been declared with a different name', - OperandT(pi), ParamTotal+i, ProcSym) + OperandT (pi), ParamTotal+i, ProcSym) END ELSE - IF GetSymName(ParamI)=NulName + IF GetSymName (ParamI) = NulName THEN - PutParamName (OperandTok (pi), ProcSym, ParamTotal+i, OperandT(pi)) + PutParamName (OperandTok (pi), ProcSym, ParamTotal+i, OperandT (pi)) END END ; + PutDeclared (OperandTok (pi), GetParameterShadowVar (ParamI)) ; IF Unbounded THEN (* GetType(ParamI) yields an UnboundedSym or a PartialUnboundedSym,