/* */
#if defined(sun) || defined(__sun__) || \
defined(__SUNPRO_C) || defined(__SUNPRO_CC)
-# if defined(__SVR4) || defined(__srv4__)
-# define PLATFORM_SOLARIS
-# else
-# define PLATFORM_SUNOS4
-# endif
+# if defined(__SVR4) || defined(__srv4__)
+# define PLATFORM_SOLARIS
+# else
+# define PLATFORM_SUNOS4
+# endif
#endif
#if (defined(_AIX) || defined(__xlC__)) && !defined(_AIX41)
-# define PLATFORM_AIX_V3
+# define PLATFORM_AIX_V3
#endif
/* */
#if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3)
#endif
/* tests for gethostbyname_r */
-#if defined(HAVE_GETHOSTBYNAME_R_3_REENTRANT) || \
- defined(HAVE_GETHOSTBYNAME_R_5_REENTRANT) || \
- defined(HAVE_GETHOSTBYNAME_R_6_REENTRANT)
-# define _REENTRANT
- /* no idea whether _REENTRANT is always set, just invent a new flag */
-# define TEST_GETHOSTBYFOO_REENTRANT
-#endif
#if defined(HAVE_GETHOSTBYNAME_R_3) || \
+ defined(HAVE_GETHOSTBYNAME_R_3_REENTRANT) || \
defined(HAVE_GETHOSTBYNAME_R_5) || \
+ defined(HAVE_GETHOSTBYNAME_R_5_REENTRANT) || \
defined(HAVE_GETHOSTBYNAME_R_6) || \
- defined(TEST_GETHOSTBYFOO_REENTRANT)
+ defined(HAVE_GETHOSTBYNAME_R_6_REENTRANT)
#include <sys/types.h>
#include <netdb.h>
int main(void)
{
const char *address = "example.com";
- int length = 0;
- int type = 0;
struct hostent h;
int rc = 0;
-#if defined(HAVE_GETHOSTBYNAME_R_3) || \
- defined(HAVE_GETHOSTBYNAME_R_3_REENTRANT)
+#if defined(HAVE_GETHOSTBYNAME_R_3) || \
+ defined(HAVE_GETHOSTBYNAME_R_3_REENTRANT)
struct hostent_data hdata;
#elif defined(HAVE_GETHOSTBYNAME_R_5) || \
defined(HAVE_GETHOSTBYNAME_R_5_REENTRANT) || \
defined(HAVE_GETHOSTBYNAME_R_6) || \
defined(HAVE_GETHOSTBYNAME_R_6_REENTRANT)
char buffer[8192];
- int h_errnop;
struct hostent *hp;
+ int h_errnop;
#endif
#if defined(HAVE_GETHOSTBYNAME_R_3) || \
defined(HAVE_GETHOSTBYNAME_R_3_REENTRANT)
rc = gethostbyname_r(address, &h, &hdata);
+ (void)hdata;
#elif defined(HAVE_GETHOSTBYNAME_R_5) || \
defined(HAVE_GETHOSTBYNAME_R_5_REENTRANT)
rc = gethostbyname_r(address, &h, buffer, 8192, &h_errnop);
(void)hp; /* not used for test */
+ (void)h_errnop;
#elif defined(HAVE_GETHOSTBYNAME_R_6) || \
defined(HAVE_GETHOSTBYNAME_R_6_REENTRANT)
rc = gethostbyname_r(address, &h, buffer, 8192, &hp, &h_errnop);
+ (void)hp;
+ (void)h_errnop;
#endif
-
- (void)length;
- (void)type;
+ (void)h;
(void)rc;
return 0;
}
#endif
int main(void)
{
- if(sizeof(bool *))
- return 0;
- ;
- return 0;
+ return (int)sizeof(bool *);
}
#endif
#endif
#ifdef HAVE_FILE_OFFSET_BITS
-#undef _FILE_OFFSET_BITS
-#define _FILE_OFFSET_BITS 64
#include <sys/types.h>
/* Check that off_t can represent 2**63 - 1 correctly.
We cannot simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
-int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
- && LARGE_OFF_T % 2147483647 == 1)
- ? 1 : -1];
-int main(void) { return 0; }
+static int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 &&
+ LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int main(void)
+{
+ (void)off_t_is_large;
+ return 0;
+}
#endif
#ifdef HAVE_IOCTLSOCKET
/* ioctlsocket source code */
int socket = -1;
unsigned long flags = ioctlsocket(socket, FIONBIO, &flags);
- ;
+ (void)flags;
return 0;
}
/* IoctlSocket source code */
if(0 != IoctlSocket(0, 0, 0))
return 1;
- ;
return 0;
}
#endif
long flags = 0;
if(0 != IoctlSocket(0, FIONBIO, &flags))
return 1;
- ;
+ (void)flags;
return 0;
}
#endif
unsigned long flags = 0;
if(0 != ioctlsocket(0, FIONBIO, &flags))
return 1;
- ;
+ (void)flags;
return 0;
}
#endif
int flags = 0;
if(0 != ioctl(0, FIONBIO, &flags))
return 1;
- ;
+ (void)flags;
return 0;
}
#endif
struct ifreq ifr;
if(0 != ioctl(0, SIOCGIFADDR, &ifr))
return 1;
- ;
+ (void)ifr;
return 0;
}
#endif
{
if(0 != setsockopt(0, SOL_SOCKET, SO_NONBLOCK, 0, 0))
return 1;
- ;
return 0;
}
#endif
#include <string.h>
#include <errno.h>
-void check(char c) {}
+static void check(char c) { (void)c; }
int main(void)
{
#include <errno.h>
/* Float, because a pointer cannot be implicitly cast to float */
-void check(float f) {}
+static void check(float f) { (void)f; }
int main(void)
{
#include <time.h>
int main(void)
{
- struct timespec ts = {0, 0};
- clock_gettime(CLOCK_MONOTONIC, &ts);
+ struct timespec ts;
+ (void)clock_gettime(CLOCK_MONOTONIC, &ts);
+ (void)ts;
return 0;
}
#endif
check_c_source_compiles("${_source_epilogue}
int main(void)
{
- #ifdef h_errno
- return 0;
- #else
+ #ifndef h_errno
#error force compilation error
#endif
+ return 0;
}" HAVE_H_ERRNO)
if(NOT HAVE_H_ERRNO)
int main(void)
{
#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L)
- return 0;
#elif defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 700)
- return 0;
#else
#error force compilation error
#endif
+ return 0;
}" HAVE_H_ERRNO_SBS_ISSUE_7)
endif()
endif()
list(APPEND _picky "-Werror-implicit-function-declaration") # clang 1.0 gcc 2.95
endif()
+if(MSVC)
+ if(CMAKE_C_FLAGS MATCHES "[/-]W[0-4]")
+ string(REGEX REPLACE "[/-]W[0-4]" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
+ endif()
+ list(APPEND _picky "-W4")
+elseif(BORLAND)
+ list(APPEND _picky "-w-") # Disable warnings on Borland to avoid changing 3rd party code.
+endif()
+
if(PICKY_COMPILER)
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
endif()
endif()
-# Disable warnings on Borland to avoid changing 3rd party code.
-if(BORLAND)
- string(APPEND CMAKE_C_FLAGS " -w-")
-endif()
-
# If we are on AIX, do the _ALL_SOURCE magic
if(CMAKE_SYSTEM_NAME STREQUAL "AIX")
add_definitions("-D_ALL_SOURCE")
HAVE_GETHOSTBYNAME_R_3
HAVE_GETHOSTBYNAME_R_5
HAVE_GETHOSTBYNAME_R_6
- HAVE_GETHOSTBYNAME_R_3_REENTRANT
- HAVE_GETHOSTBYNAME_R_5_REENTRANT
- HAVE_GETHOSTBYNAME_R_6_REENTRANT
HAVE_BOOL_T
STDC_HEADERS
- HAVE_FILE_OFFSET_BITS
HAVE_ATOMIC
)
curl_internal_test(${_curl_test})
endforeach()
+# Check for reentrant
+cmake_push_check_state()
+list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_REENTRANT")
+foreach(_curl_test IN ITEMS
+ HAVE_GETHOSTBYNAME_R_3
+ HAVE_GETHOSTBYNAME_R_5
+ HAVE_GETHOSTBYNAME_R_6)
+ curl_internal_test(${_curl_test}_REENTRANT)
+ if(NOT ${_curl_test} AND ${_curl_test}_REENTRANT)
+ set(NEED_REENTRANT 1)
+ endif()
+endforeach()
+cmake_pop_check_state()
+
+if(NEED_REENTRANT)
+ foreach(_curl_test IN ITEMS
+ HAVE_GETHOSTBYNAME_R_3
+ HAVE_GETHOSTBYNAME_R_5
+ HAVE_GETHOSTBYNAME_R_6)
+ set(${_curl_test} 0)
+ if(${_curl_test}_REENTRANT)
+ set(${_curl_test} 1)
+ endif()
+ endforeach()
+endif()
+
+cmake_push_check_state()
+list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_FILE_OFFSET_BITS=64")
+curl_internal_test(HAVE_FILE_OFFSET_BITS)
+cmake_pop_check_state()
+
cmake_push_check_state()
if(HAVE_FILE_OFFSET_BITS)
set(_FILE_OFFSET_BITS 64)
curl_internal_test(HAVE_GLIBC_STRERROR_R)
curl_internal_test(HAVE_POSIX_STRERROR_R)
-# Check for reentrant
-foreach(_curl_test IN ITEMS
- HAVE_GETHOSTBYNAME_R_3
- HAVE_GETHOSTBYNAME_R_5
- HAVE_GETHOSTBYNAME_R_6)
- if(NOT ${_curl_test})
- if(${_curl_test}_REENTRANT)
- set(NEED_REENTRANT 1)
- endif()
- endif()
-endforeach()
-
-if(NEED_REENTRANT)
- foreach(_curl_test IN ITEMS
- HAVE_GETHOSTBYNAME_R_3
- HAVE_GETHOSTBYNAME_R_5
- HAVE_GETHOSTBYNAME_R_6)
- set(${_curl_test} 0)
- if(${_curl_test}_REENTRANT)
- set(${_curl_test} 1)
- endif()
- endforeach()
-endif()
-
if(NOT WIN32)
curl_internal_test(HAVE_CLOCK_GETTIME_MONOTONIC) # Check clock_gettime(CLOCK_MONOTONIC, x) support
endif()
# Disable default manifest added by CMake
string(APPEND CMAKE_EXE_LINKER_FLAGS " -MANIFEST:NO")
- if(CMAKE_C_FLAGS MATCHES "[/-]W[0-4]")
- string(REGEX REPLACE "[/-]W[0-4]" "-W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
- else()
- string(APPEND CMAKE_C_FLAGS " -W4")
- endif()
-
# Use multithreaded compilation on VS2008+
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC" AND MSVC_VERSION GREATER_EQUAL 1500)
string(APPEND CMAKE_C_FLAGS " -MP")
tmp_exp=""
AC_PREPROC_IFELSE([
AC_LANG_SOURCE(
-ifelse($2,,,[$2])[[
+ ifelse($2,,,[$2])[[
#ifdef $1
CURL_DEF_TOKEN $1
#endif
ifelse($3,,[AC_MSG_CHECKING([for compiler definition of $1])])
AC_COMPILE_IFELSE([
AC_LANG_SOURCE(
-ifelse($2,,,[$2])[[
+ ifelse($2,,,[$2])[[
int main(void)
{
- #ifdef $1
- return 0;
- #else
+ #ifndef $1
#error force compilation error
#endif
+ return 0;
}
]])
],[
int main(void)
{
#if defined(__hpux) && defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 600)
- return 0;
#elif defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED)
- return 0;
#else
#error force compilation error
#endif
+ return 0;
}
]])
],[
AC_LANG_PROGRAM([[
]],[[
#ifdef _WIN32
- int dummy=1;
+ int dummy = 1;
+ (void)dummy;
#else
#error Not a native Windows build target.
#endif
]],[[
LDAP *ldp = ldap_init("0.0.0.0", LDAP_PORT);
int res = ldap_unbind(ldp);
+ (void)res;
]])
],[
curl_cv_header_ldap_h="yes"
#include <ldap_ssl.h>
]],[[
LDAP *ldp = ldapssl_init("0.0.0.0", LDAPS_PORT, 1);
+ (void)ldp;
]])
],[
curl_cv_header_ldap_ssl_h="yes"
LDAP *ldp = ldap_init("0.0.0.0", LDAP_PORT);
ULONG res = ldap_unbind(ldp);
ber_free(bep, 1);
+ (void)res;
]])
],[
curl_cv_ldap_LIBS="$x_nlibs"
LDAP *ldp = ldap_init("0.0.0.0", LDAP_PORT);
int res = ldap_unbind(ldp);
ber_free(bep, 1);
+ (void)res;
]])
],[
curl_cv_ldap_LIBS="$x_nlibs"
#endif
#endif
]],[[
- int flag=MSG_NOSIGNAL;
+ int flag = MSG_NOSIGNAL;
+ (void)flag;
]])
],[
curl_cv_msg_nosignal="yes"
struct timeval ts;
ts.tv_sec = 0;
ts.tv_usec = 0;
+ (void)ts;
]])
],[
curl_cv_struct_timeval="yes"
]],[[
struct timespec ts;
(void)clock_gettime(CLOCK_MONOTONIC, &ts);
+ (void)ts;
]])
],[
AC_MSG_RESULT([yes])
]],[[
struct timespec ts;
(void)clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
+ (void)ts;
]])
],[
AC_MSG_RESULT([yes])
]],[[
struct timespec ts;
(void)clock_gettime(CLOCK_MONOTONIC, &ts);
+ (void)ts;
]])
],[
curl_cv_gclk_LIBS="$x_xlibs"
#include <time.h>
]],[[
struct timespec ts;
- if (0 == clock_gettime(CLOCK_MONOTONIC, &ts))
- exit(0);
- else
- exit(1);
+ if(0 == clock_gettime(CLOCK_MONOTONIC, &ts))
+ return 0;
+ (void)ts;
+ return 1;
]])
],[
AC_MSG_RESULT([yes])
dnl point also is available run-time!
AC_MSG_CHECKING([run-time libs availability])
CURL_RUN_IFELSE([
- int main()
+ int main(void)
{
return 0;
}
struct Library *SocketBase = NULL;
#endif
]],[[
- gethostbyname("localhost");
+ unsigned char host[] = "localhost";
+ gethostbyname(host);
]])
],[
AC_MSG_RESULT([yes])
#include <netinet/in6.h>
#endif
#endif
-
int main(void)
{
- struct sockaddr_in6 s;
+ int s = (int)sizeof(struct sockaddr_in6);
(void)s;
return socket(AF_INET6, SOCK_STREAM, 0) < 0;
}
]], [[
struct sockaddr_in6 s;
s.sin6_scope_id = 0;
+ (void)s;
]])
],[
AC_MSG_RESULT([yes])
AC_MSG_CHECKING([if compiler halts on negative sized arrays])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
- typedef char bad_t[sizeof(char) == sizeof(int) ? -1 : -1 ];
+ typedef char bad_t[sizeof(char) == sizeof(int) ? -1 : -1];
]],[[
bad_t dummy;
+ (void)dummy;
]])
],[
AC_MSG_RESULT([no])
struct mystruct *next;
};
struct mystruct myfunc();
- typedef char good_t1[sizeof(myfunc().mi) == sizeof(int) ? 1 : -1 ];
- typedef char good_t2[sizeof(myfunc().mc) == sizeof(char) ? 1 : -1 ];
+ typedef char good_t1[sizeof(myfunc().mi) == sizeof(int) ? 1 : -1];
+ typedef char good_t2[sizeof(myfunc().mc) == sizeof(char) ? 1 : -1];
]],[[
good_t1 dummy1;
good_t2 dummy2;
+ (void)dummy1;
+ (void)dummy2;
]])
],[
tst_compiler_check_one_works="yes"
struct mystruct *next;
};
struct mystruct myfunc();
- typedef char bad_t1[sizeof(myfunc().mi) != sizeof(int) ? 1 : -1 ];
- typedef char bad_t2[sizeof(myfunc().mc) != sizeof(char) ? 1 : -1 ];
+ typedef char bad_t1[sizeof(myfunc().mi) != sizeof(int) ? 1 : -1];
+ typedef char bad_t2[sizeof(myfunc().mc) != sizeof(char) ? 1 : -1];
]],[[
bad_t1 dummy1;
bad_t2 dummy2;
+ (void)dummy1;
+ (void)dummy2;
]])
],[
tst_compiler_check_two_works="no"
squeeze CFLAGS
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
- $tmp_EXTERN char *dummy(char *buff);
- char *dummy(char *buff)
+ $tmp_EXTERN const char *dummy(const char *buff);
+ const char *dummy(const char *buff)
{
if(buff)
return ++buff;
return buff;
}
]],[[
- char b[16];
- char *r = dummy(&b[0]);
+ const char *b = "example";
+ const char *r = dummy(&b[0]);
if(r)
return (int)*r;
]])
AC_LANG_PROGRAM([[
#include <ares.h>
/* set of dummy functions in case c-ares was built with debug */
- void curl_dofree() { }
- void curl_sclose() { }
- void curl_domalloc() { }
- void curl_docalloc() { }
- void curl_socket() { }
+ void curl_dofree(void); void curl_dofree(void) {}
+ void curl_sclose(void); void curl_sclose(void) {}
+ void curl_domalloc(void); void curl_domalloc(void) {}
+ void curl_docalloc(void); void curl_docalloc(void) {}
+ void curl_socket(void); void curl_socket(void) {}
]],[[
ares_channel channel;
ares_cancel(channel); /* added in 1.2.0 */
$curl_includes_unistd
$curl_includes_bsdsocket
$curl_preprocess_callconv
- extern int FUNCALLCONV gethostname($tst_arg1, $tst_arg2);
+ #if defined(_WIN32) && defined(WINSOCK_API_LINKAGE)
+ WINSOCK_API_LINKAGE
+ #else
+ extern
+ #endif
+ int FUNCALLCONV gethostname($tst_arg1, $tst_arg2);
]],[[
if(0 != gethostname(0, 0))
return 1;
struct tm *gmt = 0;
struct tm result;
gmt = gmtime_r(&local, &result);
+ (void)result;
if(gmt)
exit(0);
else
char ipv4res[sizeof "255.255.255.255"];
unsigned char ipv6a[26];
unsigned char ipv4a[5];
- char *ipv6ptr = 0;
- char *ipv4ptr = 0;
+ const char *ipv6ptr = 0;
+ const char *ipv4ptr = 0;
/* - */
ipv4res[0] = '\0';
ipv4a[0] = 0xc0;
AC_LANG_PROGRAM([[
$curl_includes_string
]],[[
- if(0 != memrchr(0, 0, 0))
+ if(0 != memrchr("", 0, 0))
return 1;
]])
],[
AC_LANG_PROGRAM([[
$curl_includes_string
]],[[
- if(0 != strcasecmp(0, 0))
+ if(0 != strcasecmp("", ""))
return 1;
]])
],[
$curl_includes_string
char *strerror_r(int errnum, char *workbuf, $arg3 bufsize);
]],[[
- if(0 != strerror_r(0, 0, 0))
+ char s[1];
+ if(0 != strerror_r(0, s, 0))
return 1;
+ (void)s;
]])
],[
tst_glibc_strerror_r_type_arg3="$arg3"
AC_LANG_PROGRAM([[
$curl_includes_stdlib
$curl_includes_string
-# include <errno.h>
+ #include <errno.h>
]],[[
char buffer[1024];
char *string = 0;
$curl_includes_string
int strerror_r(int errnum, char *resultbuf, $arg3 bufsize);
]],[[
- if(0 != strerror_r(0, 0, 0))
+ char s[1];
+ if(0 != strerror_r(0, s, 0))
return 1;
+ (void)s;
]])
],[
tst_posix_strerror_r_type_arg3="$arg3"
AC_LANG_PROGRAM([[
$curl_includes_stdlib
$curl_includes_string
-# include <errno.h>
+ #include <errno.h>
]],[[
char buffer[1024];
int error = 1;
AC_LANG_PROGRAM([[
$curl_includes_string
]],[[
- if(0 != strtok_r(0, 0, 0))
+ if(0 != strtok_r(0, "", 0))
return 1;
]])
],[
AC_LANG_PROGRAM([[
$curl_includes_stdlib
]],[[
- if(0 != strtoll(0, 0, 0))
+ if(0 != strtoll("", 0, 0))
return 1;
]])
],[
]],[[
_Atomic int i = 0;
i = 4; // Force an atomic-write operation.
+ (void)i;
]])
],[
AC_MSG_RESULT([yes])
my_ac_save_LIBS=$LIBS
LIBS="-lgdi32 $LIBS"
AC_LINK_IFELSE([ AC_LANG_PROGRAM([[
+ #ifndef WIN32_LEAN_AND_MEAN
+ #define WIN32_LEAN_AND_MEAN
+ #endif
#include <windef.h>
#include <wingdi.h>
]],
#include <openssl/opensslv.h>
]],[[
int dummy = LIBRESSL_VERSION_NUMBER;
+ (void)dummy;
]])
],[
AC_MSG_RESULT([yes])
AC_MSG_CHECKING([for SRP support in OpenSSL])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
+ #ifndef OPENSSL_SUPPRESS_DEPRECATED
+ #define OPENSSL_SUPPRESS_DEPRECATED
+ #endif
#include <openssl/ssl.h>
]],[[
- SSL_CTX_set_srp_username(NULL, "");
- SSL_CTX_set_srp_password(NULL, "");
+ SSL_CTX_set_srp_username(NULL, NULL);
+ SSL_CTX_set_srp_password(NULL, NULL);
]])
],[
AC_MSG_RESULT([yes])
int main(void)
{
$2
- ;
- return 0;
+ return 0;
}])
dnl Override Autoconf's AC_LANG_CALL (C)
#include <errno.h>
]],[[
#ifdef errno
- int dummy=1;
+ int dummy = 1;
+ (void)dummy;
#else
#error force compilation error
#endif
#include <errno.h>
]],[[
#ifdef errno
- int dummy=1;
+ int dummy = 1;
+ (void)dummy;
#else
#error force compilation error
#endif
AC_LANG_PROGRAM([[
]],[[
#ifdef _REENTRANT
- int dummy=1;
+ int dummy = 1;
+ (void)dummy;
#else
#error force compilation error
#endif
AC_LANG_PROGRAM([[
]],[[
#ifdef _THREAD_SAFE
- int dummy=1;
+ int dummy = 1;
+ (void)dummy;
#else
#error force compilation error
#endif