svn commit: r1927745 - apr/apr/trunk/build

[email protected]
Newsgroups gmane.comp.apache.apr.cvs
Message-ID <175489801414.1792016.3701051855813366317@svn02-us-east.apache.org>
Author: jorton
Date: Mon Aug 11 07:40:13 2025
New Revision: 1927745

Log:
* 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

Modified:
   apr/apr/trunk/build/apr_network.m4

Modified: apr/apr/trunk/build/apr_network.m4
==============================================================================
--- apr/apr/trunk/build/apr_network.m4	Mon Aug 11 07:38:54 2025	(r1927744)
+++ apr/apr/trunk/build/apr_network.m4	Mon Aug 11 07:40:13 2025	(r1927745)
@@ -259,11 +259,12 @@ APR_TRY_COMPILE_NO_WARNING([
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #endif
+#include <stdio.h>
 ],[
 int tmp = gethostbyname_r((const char *) 0, (struct hostent *) 0, 
                           (char *) 0, 0, (struct hostent **) 0, &tmp);
 /* use tmp to suppress the warning */
-tmp=0;
+puts(tmp ? "non-zero" : "zero");
 ], ac_cv_gethostbyname_r_style=glibc2, ac_cv_gethostbyname_r_style=none))
 
 if test "$ac_cv_gethostbyname_r_style" = "glibc2"; then
@@ -287,11 +288,12 @@ APR_TRY_COMPILE_NO_WARNING([
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #endif
+#include <stdio.h>
 ],[
 int tmp = gethostbyname_r((const char *) 0, (struct hostent *) 0, 
                           (struct hostent_data *) 0);
 /* use tmp to suppress the warning */
-tmp=0;
+puts(tmp ? "non-zero" : "zero");
 ], ac_cv_gethostbyname_r_arg=hostent_data, ac_cv_gethostbyname_r_arg=char))
 
 if test "$ac_cv_gethostbyname_r_arg" = "hostent_data"; then
@@ -327,12 +329,13 @@ APR_TRY_COMPILE_NO_WARNING([
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #endif
+#include <stdio.h>
 ],[
 int tmp = getservbyname_r((const char *) 0, (const char *) 0,
                           (struct servent *) 0, (char *) 0, 0,
                           (struct servent **) 0);
 /* use tmp to suppress the warning */
-tmp=0;
+puts(tmp ? "non-zero" : "zero");
 ], ac_cv_getservbyname_r_style=glibc2, ac_cv_getservbyname_r_style=none)
 
 if test "$ac_cv_getservbyname_r_style" = "none"; then
@@ -354,11 +357,12 @@ if test "$ac_cv_getservbyname_r_style" =
     #ifdef HAVE_STDLIB_H
     #include <stdlib.h>
     #endif
+    #include <stdio.h>
     ],[
     struct servent *tmp = getservbyname_r((const char *) 0, (const char *) 0,
                                           (struct servent *) 0, (char *) 0, 0);
     /* use tmp to suppress the warning */
-    tmp=NULL;
+    puts(tmp ? "non-zero" : "zero");
     ], ac_cv_getservbyname_r_style=solaris, ac_cv_getservbyname_r_style=none)
 fi
 
@@ -381,11 +385,12 @@ if test "$ac_cv_getservbyname_r_style" =
     #ifdef HAVE_STDLIB_H
     #include <stdlib.h>
     #endif
+    #include <stdio.h>
     ],[
     int tmp = getservbyname_r((const char *) 0, (const char *) 0,
                               (struct servent *) 0, (struct servent_data *) 0);
     /* use tmp to suppress the warning */
-    tmp=0;
+    puts(tmp ? "non-zero" : "zero");
     ], ac_cv_getservbyname_r_style=osf1, ac_cv_getservbyname_r_style=none)
 fi
 ])
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.