Compilation with gcc 4.6.0
Julien ÉLIE
julien at trigofacile.com
Sun Jun 12 18:04:08 UTC 2011
Hi all,
I am currently building INN with gcc 4.6.0; a few issues appear with
the new "-Wunused-but-set-parameter" and "-Wunused-but-set-variable"
warnings.
I fixed all of them in our source code (variables or parameters
really not used).
However, here are a few errors I do not not what to do with.
In authprogs/radius.c:
typedef struct _auth_req {
unsigned char code;
unsigned char id;
unsigned short length;
unsigned char vector[AUTH_VECTOR_LEN];
unsigned char data[NNTP_MAXLEN_COMMAND*2];
int datalen;
} auth_req;
static void req_copyto (auth_req to, sending_t *from)
{
to = from->req;
}
The function is called in the code with:
req_copyto(req, sreq);
gcc tells me the function does nothing ("to" is unused). I understand
that we should give &req as the first argument and take the *to pointer.
However, it looks strange that we should do that. Wasn't the radius
authentication working? (As I do not use one, I hadn't had the
opportunity to test it yet.)
In innd/art.c:
static bool
ListHas(const char **list, const char *p)
{
const char *q;
char c;
for (c = *p; (q = *list) != NULL; list++)
if (strcasecmp(p, q) == 0)
return true;
return false;
}
The "c" variable is unused. I believe it is here so that the parameter
is not directly used in the function.
Is there a recommended behaviour between:
- removing "c = *p"
- declaring "char c UNUSED;"
?
In lib/perl.c:
@@ -75,12 +75,15 @@
if (perl_get_cv("filter_end", false) != NULL) {
ENTER;
SAVETMPS;
+ /* call_argv automatically uses PUSHMARK(SP). */
perl_call_argv("filter_end", G_EVAL | G_DISCARD | G_NOARGS, argv);
+ SPAGAIN;
if (SvTRUE(ERRSV)) {
syslog (L_ERROR, "SERVER perl function filter_end died: %s",
SvPV(ERRSV, PL_na));
(void) POPs;
}
+ PUTBACK;
FREETMPS;
LEAVE;
}
@@ -131,8 +134,9 @@
char *evalfile = NULL;
dSP;
ENTER;
SAVETMPS;
+ PUSHMARK(SP);
/* The Perl expression which will be evaluated. */
xasprintf(&evalfile, "do '%s'", startupfile);
@@ -152,8 +159,9 @@
PERLreadfilter (filterfile,function) ;
}
+ PUTBACK;
FREETMPS;
LEAVE;
} else {
These were tougher ones. I had to carefully read the percall
documentation. I think a few calls to PUSHMARK/SPAGAIN/PUTBACK
are missing. And they depend on the call_* function used.
Anyway, I do not think it does much harm to add these macros.
(Otherwise, gcc complains that the "sp" variable is not used.)
--
Julien ÉLIE
« Un voyage de mille lieues commence toujours par un premier pas. »
(Lao Zi)
More information about the inn-workers
mailing list