Magick.c: warning: unused variable
Posted: 2011-02-11T18:34:35-07:00
The file Magick.c is a PERL binary extension. It generates warnings about unused variables when compiled.
The sample code of perlxstut does not produce any warnings; inserting an unused variable into the implementation or a bogus parameter into the definition does produce a warning in function XS_Mytest_hello.
The minimal example of such a warning is:
with the following result:
The warnings are an artefact of ExtUtils::xsubpp; I am looking for a way to get rid of them.Magick.c: In function 'XS_Image__Magick_Animate':
Magick.c:2483:16: warning: unused variable 'ref'
Magick.c:2477:5: warning: unused variable 'ix'
The sample code of perlxstut does not produce any warnings; inserting an unused variable into the implementation or a bogus parameter into the definition does produce a warning in function XS_Mytest_hello.
The minimal example of such a warning is:
Code: Select all
void
hello(x)
ALIAS:
do_hello = 1
CODE:
printf("Hello, world!\n");
and the cure for that is to use PERL_UNUSED_VAR(ix), and to drop the declaration of ref.Mytest.c: In function ‘XS_Mytest_hello’:
Mytest.c:79:5: warning: unused variable ‘ix’