Skip to content

Commit 5fcd84f

Browse files
committed
* build/apr_network.m4: In the gethostbyname_r/getservbyname_r checks,
try harder to suppress "unused variable" warnings which could otherwise create false negatives in the tests. conftest.c:264:5: error: variable 'tmp' set but not used [-Werror=unused-but-set-variable] 264 | int tmp = gethostbyname_r((const char *) 0, (struct hostent *) 0, GitHub: pr #68 git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1927745 13f79535-47bb-0310-9956-ffa450edef68
1 parent 043fa02 commit 5fcd84f

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

build/apr_network.m4

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,12 @@ APR_TRY_COMPILE_NO_WARNING([
259259
#ifdef HAVE_STDLIB_H
260260
#include <stdlib.h>
261261
#endif
262+
#include <stdio.h>
262263
],[
263264
int tmp = gethostbyname_r((const char *) 0, (struct hostent *) 0,
264265
(char *) 0, 0, (struct hostent **) 0, &tmp);
265266
/* use tmp to suppress the warning */
266-
tmp=0;
267+
puts(tmp ? "non-zero" : "zero");
267268
], ac_cv_gethostbyname_r_style=glibc2, ac_cv_gethostbyname_r_style=none))
268269
269270
if test "$ac_cv_gethostbyname_r_style" = "glibc2"; then
@@ -287,11 +288,12 @@ APR_TRY_COMPILE_NO_WARNING([
287288
#ifdef HAVE_STDLIB_H
288289
#include <stdlib.h>
289290
#endif
291+
#include <stdio.h>
290292
],[
291293
int tmp = gethostbyname_r((const char *) 0, (struct hostent *) 0,
292294
(struct hostent_data *) 0);
293295
/* use tmp to suppress the warning */
294-
tmp=0;
296+
puts(tmp ? "non-zero" : "zero");
295297
], ac_cv_gethostbyname_r_arg=hostent_data, ac_cv_gethostbyname_r_arg=char))
296298
297299
if test "$ac_cv_gethostbyname_r_arg" = "hostent_data"; then
@@ -327,12 +329,13 @@ APR_TRY_COMPILE_NO_WARNING([
327329
#ifdef HAVE_STDLIB_H
328330
#include <stdlib.h>
329331
#endif
332+
#include <stdio.h>
330333
],[
331334
int tmp = getservbyname_r((const char *) 0, (const char *) 0,
332335
(struct servent *) 0, (char *) 0, 0,
333336
(struct servent **) 0);
334337
/* use tmp to suppress the warning */
335-
tmp=0;
338+
puts(tmp ? "non-zero" : "zero");
336339
], ac_cv_getservbyname_r_style=glibc2, ac_cv_getservbyname_r_style=none)
337340
338341
if test "$ac_cv_getservbyname_r_style" = "none"; then
@@ -354,11 +357,12 @@ if test "$ac_cv_getservbyname_r_style" = "none"; then
354357
#ifdef HAVE_STDLIB_H
355358
#include <stdlib.h>
356359
#endif
360+
#include <stdio.h>
357361
],[
358362
struct servent *tmp = getservbyname_r((const char *) 0, (const char *) 0,
359363
(struct servent *) 0, (char *) 0, 0);
360364
/* use tmp to suppress the warning */
361-
tmp=NULL;
365+
puts(tmp ? "non-zero" : "zero");
362366
], ac_cv_getservbyname_r_style=solaris, ac_cv_getservbyname_r_style=none)
363367
fi
364368
@@ -381,11 +385,12 @@ if test "$ac_cv_getservbyname_r_style" = "none"; then
381385
#ifdef HAVE_STDLIB_H
382386
#include <stdlib.h>
383387
#endif
388+
#include <stdio.h>
384389
],[
385390
int tmp = getservbyname_r((const char *) 0, (const char *) 0,
386391
(struct servent *) 0, (struct servent_data *) 0);
387392
/* use tmp to suppress the warning */
388-
tmp=0;
393+
puts(tmp ? "non-zero" : "zero");
389394
], ac_cv_getservbyname_r_style=osf1, ac_cv_getservbyname_r_style=none)
390395
fi
391396
])

0 commit comments

Comments
 (0)