Skip to content
Snippets Groups Projects
Commit 7c0e2159 authored by Gaius Mulley's avatar Gaius Mulley
Browse files

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: default avatarGaius Mulley <gaiusmod2@gmail.com>
parent 38af81df
No related branches found
No related tags found
No related merge requests found
...@@ -59,7 +59,7 @@ FROM SymbolTable IMPORT NulSym, ...@@ -59,7 +59,7 @@ FROM SymbolTable IMPORT NulSym,
MakeSubrange, MakeSubrange,
MakeVar, MakeType, PutType, MakeVar, MakeType, PutType,
MakeModuleCtor, MakeModuleCtor,
PutMode, PutDeclared, PutMode, PutDeclared, GetParameterShadowVar,
PutFieldEnumeration, PutSubrange, PutVar, PutConst, PutFieldEnumeration, PutSubrange, PutVar, PutConst,
PutConstSet, PutConstructor, PutConstSet, PutConstructor,
IsDefImp, IsType, IsRecord, IsRecordField, IsPointer, IsDefImp, IsType, IsRecord, IsRecordField, IsPointer,
...@@ -1820,14 +1820,15 @@ BEGIN ...@@ -1820,14 +1820,15 @@ BEGIN
(* different parameter names *) (* different parameter names *)
FailParameter('', FailParameter('',
'the parameter has been declared with a different name', 'the parameter has been declared with a different name',
OperandT(pi), ParamTotal+i, ProcSym) OperandT (pi), ParamTotal+i, ProcSym)
END END
ELSE ELSE
IF GetSymName(ParamI)=NulName IF GetSymName (ParamI) = NulName
THEN THEN
PutParamName (OperandTok (pi), ProcSym, ParamTotal+i, OperandT(pi)) PutParamName (OperandTok (pi), ProcSym, ParamTotal+i, OperandT (pi))
END END
END ; END ;
PutDeclared (OperandTok (pi), GetParameterShadowVar (ParamI)) ;
IF Unbounded IF Unbounded
THEN THEN
(* GetType(ParamI) yields an UnboundedSym or a PartialUnboundedSym, (* GetType(ParamI) yields an UnboundedSym or a PartialUnboundedSym,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment