It seems there is an off by one error with the "warning: unused variable" warning. Probably the line number is not saved when the variable identifier token is read, but instead the line following the entire variable declaration is used. Yep, declaring a typeless record supports this theory.
program testpas11;
procedure test; var a: Integer; b: record x,y: Integer; end; c: Integer; begin WriteLn( 'Hello' ); end;
begin end.
% gpc -Wall -c testpas11.pas testpas11.pas: In procedure `test': testpas11.pas:10: warning: unused variable `c' testpas11.pas:9: warning: unused variable `b' testpas11.pas:6: warning: unused variable `a'
1 program testpas11; 2 3 procedure test; 4 var 5 a: Integer; 6 b: record 7 x,y: Integer; 8 end; 9 c: Integer; 10 begin 11 WriteLn( 'Hello' ); 12 end; 13 14 begin 15 end.
It would be nicer if it recorded the identifier's line number when the token was first read - I'm not sure how hard this might be though (might be easy too). Normally GPC is pretty good with line numbers...
Enjoy, Peter.