Page 1 of 1

Magick.c: warning: unused variable

Posted: 2011-02-11T18:34:35-07:00
by yecril71pl
The file Magick.c is a PERL binary extension. It generates warnings about unused variables when compiled.
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 warnings are an artefact of ExtUtils::xsubpp; I am looking for a way to get rid of them.

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");
with the following result:
Mytest.c: In function ‘XS_Mytest_hello’:
Mytest.c:79:5: warning: unused variable ‘ix’
and the cure for that is to use PERL_UNUSED_VAR(ix), and to drop the declaration of ref.