From: Michal Nowak Date: Mon, 30 May 2022 10:36:27 +0000 (+0200) Subject: Fix compilation warnings in dlz_perl_driver.c X-Git-Tag: v9.19.8~47^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=be928dbba29088a966d7fb93ab9dfe3c9417ad37;p=thirdparty%2Fbind9.git Fix compilation warnings in dlz_perl_driver.c dlz_perl_driver.c: In function ‘dlz_version’: dlz_perl_driver.c:116:27: warning: unused parameter ‘flags’ [-Wunused-parameter] 116 | dlz_version(unsigned int *flags) { | ~~~~~~~~~~~~~~^~~~~ In file included from /usr/lib64/perl5/CORE/perl.h:5685, from dlz_perl_driver.c:33: dlz_perl_driver.c: In function ‘dlz_allnodes’: /usr/lib64/perl5/CORE/pp.h:162:26: warning: value computed is not used [-Wunused-value] 162 | #define POPs (*sp--) | ~^~~~~~ dlz_perl_driver.c:151:17: note: in expansion of macro ‘POPs’ 151 | POPs; | ^~~~ dlz_perl_driver.c: In function ‘dlz_allowzonexfr’: /usr/lib64/perl5/CORE/pp.h:162:26: warning: value computed is not used [-Wunused-value] 162 | #define POPs (*sp--) | ~^~~~~~ dlz_perl_driver.c:251:17: note: in expansion of macro ‘POPs’ 251 | POPs; | ^~~~ dlz_perl_driver.c: In function ‘dlz_findzonedb’: /usr/lib64/perl5/CORE/pp.h:162:26: warning: value computed is not used [-Wunused-value] 162 | #define POPs (*sp--) | ~^~~~~~ dlz_perl_driver.c:328:17: note: in expansion of macro ‘POPs’ 328 | POPs; | ^~~~ dlz_perl_driver.c: In function ‘dlz_lookup’: /usr/lib64/perl5/CORE/pp.h:162:26: warning: value computed is not used [-Wunused-value] 162 | #define POPs (*sp--) | ~^~~~~~ dlz_perl_driver.c:407:17: note: in expansion of macro ‘POPs’ 407 | POPs; | ^~~~ dlz_perl_driver.c:472:1: error: no previous prototype for ‘missing_perl_method’ [-Werror=missing-prototypes] 472 | missing_perl_method(const char *perl_class_name, PerlInterpreter *my_perl) | ^~~~~~~~~~~~~~~~~~~ dlz_perl_driver.c: In function ‘missing_perl_method’: dlz_perl_driver.c:485:9: error: ISO C90 forbids array ‘full_name’ whose size cannot be evaluated [-Werror=vla] 485 | char full_name[BUF_LEN]; | ^~~~ dlz_perl_driver.c: In function ‘dlz_create’: dlz_perl_driver.c:613:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses] 613 | if (missing_method_name = missing_perl_method(perl_class_name, my_perl)) | ^~~~~~~~~~~~~~~~~~~ /usr/lib64/perl5/CORE/pp.h:162:26: warning: value computed is not used [-Wunused-value] 162 | #define POPs (*sp--) | ~^~~~~~ dlz_perl_driver.c:657:17: note: in expansion of macro ‘POPs’ 657 | POPs; | ^~~~ dlz_perl_driver.c:502:15: warning: unused variable ‘init_args’ [-Wunused-variable] 502 | char *init_args[] = { NULL, NULL }; | ^~~~~~~~~ --- diff --git a/contrib/dlz/modules/perl/dlz_perl_driver.c b/contrib/dlz/modules/perl/dlz_perl_driver.c index 9bbcfc2b0bf..88edc0ced03 100644 --- a/contrib/dlz/modules/perl/dlz_perl_driver.c +++ b/contrib/dlz/modules/perl/dlz_perl_driver.c @@ -37,6 +37,8 @@ #include +#define BUF_LEN 64 /* Should be big enough, right? hah */ + /* Enable debug logging? */ #if 0 #define carp(...) cd->log(ISC_LOG_INFO, __VA_ARGS__); @@ -79,7 +81,7 @@ EXTERN_C void boot_DLZ_Perl(pTHX_ CV *cv); EXTERN_C void xs_init(pTHX) { - char *file = __FILE__; + const char *file = __FILE__; dXSUB_SYS; /* DynaLoader is a special case */ @@ -114,6 +116,7 @@ b9_add_helper(config_data_t *state, const char *helper_name, void *ptr) { int dlz_version(unsigned int *flags) { + UNUSED(flags); return (DLZ_DLOPEN_VERSION); } @@ -148,7 +151,7 @@ dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes) { SPAGAIN; if (SvTRUE(ERRSV)) { - POPs; + (void)POPs; cd->log(ISC_LOG_ERROR, "DLZ Perl: allnodes for zone %s died in eval: %s", zone, SvPV_nolen(ERRSV)); @@ -248,7 +251,7 @@ dlz_allowzonexfr(void *dbdata, const char *name, const char *client) { * it away so we don't leave junk on the stack for the next * caller. */ - POPs; + (void)POPs; cd->log(ISC_LOG_ERROR, "DLZ Perl: allowzonexfr died in eval: %s", SvPV_nolen(ERRSV)); @@ -325,7 +328,7 @@ dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods, * it away so we don't leave junk on the stack for the next * caller. */ - POPs; + (void)POPs; cd->log(ISC_LOG_ERROR, "DLZ Perl: findzone died in eval: %s", SvPV_nolen(ERRSV)); retval = ISC_R_FAILURE; @@ -404,7 +407,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata, SPAGAIN; if (SvTRUE(ERRSV)) { - POPs; + (void)POPs; cd->log(ISC_LOG_ERROR, "DLZ Perl: lookup died in eval: %s", SvPV_nolen(ERRSV)); retval = ISC_R_FAILURE; @@ -470,14 +473,13 @@ CLEAN_UP_AND_RETURN: return (retval); } -const char * +static const char * #ifdef MULTIPLICITY missing_perl_method(const char *perl_class_name, PerlInterpreter *my_perl) #else /* ifdef MULTIPLICITY */ missing_perl_method(const char *perl_class_name) #endif /* ifdef MULTIPLICITY */ { - const int BUF_LEN = 64; /* Should be big enough, right? hah */ char full_name[BUF_LEN]; const char *methods[] = { "new", "findzone", "lookup", NULL }; int i = 0; @@ -499,8 +501,7 @@ isc_result_t dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata, ...) { config_data_t *cd; - char *init_args[] = { NULL, NULL }; - char *perlrun[] = { "", NULL, "dlz perl", NULL }; + char *perlrun[] = { (char *)"", NULL, (char *)"dlz perl", NULL }; char *perl_class_name; int r; va_list ap; @@ -610,9 +611,10 @@ dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata, } #ifdef MULTIPLICITY - if (missing_method_name = missing_perl_method(perl_class_name, my_perl)) + if ((missing_method_name = missing_perl_method(perl_class_name, + my_perl))) #else /* ifdef MULTIPLICITY */ - if (missing_method_name = missing_perl_method(perl_class_name)) + if ((missing_method_name = missing_perl_method(perl_class_name))) #endif /* ifdef MULTIPLICITY */ { cd->log(ISC_LOG_ERROR, @@ -654,7 +656,7 @@ dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata, LEAVE; if (SvTRUE(ERRSV)) { - POPs; + (void)POPs; cd->log(ISC_LOG_ERROR, "DLZ Perl '%s': new died in eval: %s", dlzname, SvPV_nolen(ERRSV)); goto CLEAN_UP_PERL_AND_FAIL;