Scott Moore wrote:
IP Pascal uses:
procedure dummy(x, y: integer);
var a: integer;
begin
reference(x); reference(y)
end;
Which is straightforward. Reference is a built-in that sets the variable as referenced.
Sorry, but I fiind it absurd to write actual code to get rid of an unwanted warning (even if the actual code translates into dummy code). Why do we want warnings anyway ? Well, if there are many warnings on every build or compile, that only irritates the programmer and the warnings will miss their purpose. So, the idea is to have software that eventually compiles without warnings. There are two valid ways to get rid of warnings. The programmer carefully inspects the program source that produces the warning and then decides:
(1) the compiler is right, the source is dangerous and should be changed, òr (2) the compiler warning is irrelevant (or wrong) in the specific context of a portion of the source code, the compiler should stop complaining there.
In the second case, we need fine control over warnings, that is, a compiler directive to put specific warnings off locally with {$local W no-xxx} ... {$endlocal} or whatever.
Now, to the case of unused parameters - they don't hurt, unused parameters won't crash software. But - apparently we missed an opportunity to eliminate the unused parameter to make the software faster (at least in theory). However, this leads to problems when the parameter list of a procedure or function can not be changed, as is the case with e.g. callback routines. For those routines, we can should be able to put the check off with {$local W no-unused-parameter} ... {$endlocal}.
That's all - sorry, I don't see why need need control over individual parameters.
By the way, If the compiler were to eliminate unused parameters automatically, callback routines (and other fixed parameter list routines) will need local compiler directives anyway.
Peter N. Lewis wrote:
I'll still need the {$unused(x,y,z)} either supported or ignored for compatibility.
{$ifc defined __MWERKS__} ... {$endc} will ignore the warning in GPC.
Regards,
Adriaan van Os