From f471efa78c64e405b61a195f072f8b759905f43f Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Fri, 18 Jun 2021 10:16:16 +0200 Subject: [PATCH] configure/cmake: remove checks for unused inet_ntoa and inet_ntoa_r Closes #7276 --- CMake/CurlTests.c | 31 -------- CMake/Platforms/WindowsCache.cmake | 4 - CMakeLists.txt | 12 +-- configure.ac | 1 - lib/inet_ntop.c | 2 +- m4/curl-functions.m4 | 124 ----------------------------- m4/curl-reentrant.m4 | 40 ---------- 7 files changed, 2 insertions(+), 212 deletions(-) diff --git a/CMake/CurlTests.c b/CMake/CurlTests.c index 2fcce1bb3..9c278ec50 100644 --- a/CMake/CurlTests.c +++ b/CMake/CurlTests.c @@ -214,37 +214,6 @@ if (sizeof (bool *) ) #include int main() { return 0; } #endif -#ifdef HAVE_INET_NTOA_R_DECL -#include - -typedef void (*func_type)(); - -int main() -{ -#ifndef inet_ntoa_r - func_type func; - func = (func_type)inet_ntoa_r; - (void)func; -#endif - return 0; -} -#endif -#ifdef HAVE_INET_NTOA_R_DECL_REENTRANT -#define _REENTRANT -#include - -typedef void (*func_type)(); - -int main() -{ -#ifndef inet_ntoa_r - func_type func; - func = (func_type)&inet_ntoa_r; - (void)func; -#endif - return 0; -} -#endif #ifdef HAVE_GETADDRINFO #include #include diff --git a/CMake/Platforms/WindowsCache.cmake b/CMake/Platforms/WindowsCache.cmake index 8f92cbd79..2f96dbca3 100644 --- a/CMake/Platforms/WindowsCache.cmake +++ b/CMake/Platforms/WindowsCache.cmake @@ -86,8 +86,6 @@ if(NOT UNIX) set(HAVE_GETHOSTBYADDR 1) set(HAVE_GETTIMEOFDAY 0) set(HAVE_INET_ADDR 1) - set(HAVE_INET_NTOA 1) - set(HAVE_INET_NTOA_R 0) set(HAVE_CLOSESOCKET 1) set(HAVE_SETVBUF 0) set(HAVE_SIGSETJMP 0) @@ -122,8 +120,6 @@ if(NOT UNIX) set(TIME_WITH_SYS_TIME 0) set(HAVE_O_NONBLOCK 0) set(HAVE_IN_ADDR_T 0) - set(HAVE_INET_NTOA_R_DECL 0) - set(HAVE_INET_NTOA_R_DECL_REENTRANT 0) if(ENABLE_IPV6) set(HAVE_GETADDRINFO 1) else() diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ad3e0ada..0fb196a13 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1019,8 +1019,6 @@ check_symbol_exists(gethostbyaddr "${CURL_INCLUDES}" HAVE_GETHOSTBYADDR) check_symbol_exists(gethostbyaddr_r "${CURL_INCLUDES}" HAVE_GETHOSTBYADDR_R) check_symbol_exists(gettimeofday "${CURL_INCLUDES}" HAVE_GETTIMEOFDAY) check_symbol_exists(inet_addr "${CURL_INCLUDES}" HAVE_INET_ADDR) -check_symbol_exists(inet_ntoa "${CURL_INCLUDES}" HAVE_INET_NTOA) -check_symbol_exists(inet_ntoa_r "${CURL_INCLUDES}" HAVE_INET_NTOA_R) check_symbol_exists(closesocket "${CURL_INCLUDES}" HAVE_CLOSESOCKET) check_symbol_exists(sigsetjmp "${CURL_INCLUDES}" HAVE_SIGSETJMP) check_symbol_exists(getpass_r "${CURL_INCLUDES}" HAVE_GETPASS_R) @@ -1128,8 +1126,6 @@ foreach(CURL_TEST HAVE_IN_ADDR_T HAVE_BOOL_T STDC_HEADERS - HAVE_INET_NTOA_R_DECL - HAVE_INET_NTOA_R_DECL_REENTRANT HAVE_GETADDRINFO HAVE_FILE_OFFSET_BITS HAVE_VARIADIC_MACROS_C99 @@ -1166,8 +1162,7 @@ foreach(CURL_TEST HAVE_GETHOSTBYADDR_R_8 HAVE_GETHOSTBYNAME_R_3 HAVE_GETHOSTBYNAME_R_5 - HAVE_GETHOSTBYNAME_R_6 - HAVE_INET_NTOA_R_DECL_REENTRANT) + HAVE_GETHOSTBYNAME_R_6) if(NOT ${CURL_TEST}) if(${CURL_TEST}_REENTRANT) set(NEED_REENTRANT 1) @@ -1190,11 +1185,6 @@ if(NEED_REENTRANT) endforeach() endif() -if(HAVE_INET_NTOA_R_DECL_REENTRANT) - set(HAVE_INET_NTOA_R_DECL 1) - set(NEED_REENTRANT 1) -endif() - # Check clock_gettime(CLOCK_MONOTONIC, x) support curl_internal_test(HAVE_CLOCK_GETTIME_MONOTONIC) diff --git a/configure.ac b/configure.ac index b13d83d08..de9578552 100644 --- a/configure.ac +++ b/configure.ac @@ -3232,7 +3232,6 @@ CURL_CHECK_FUNC_GETSOCKNAME CURL_CHECK_FUNC_IF_NAMETOINDEX CURL_CHECK_FUNC_GETIFADDRS CURL_CHECK_FUNC_GMTIME_R -CURL_CHECK_FUNC_INET_NTOA_R CURL_CHECK_FUNC_INET_NTOP CURL_CHECK_FUNC_INET_PTON CURL_CHECK_FUNC_IOCTL diff --git a/lib/inet_ntop.c b/lib/inet_ntop.c index 4c3e9e4da..b5f9b808a 100644 --- a/lib/inet_ntop.c +++ b/lib/inet_ntop.c @@ -40,7 +40,7 @@ #define INT16SZ 2 /* - * Format an IPv4 address, more or less like inet_ntoa(). + * Format an IPv4 address, more or less like inet_ntop(). * * Returns `dst' (as a const) * Note: diff --git a/m4/curl-functions.m4 b/m4/curl-functions.m4 index 1a21ca0be..ffade127d 100644 --- a/m4/curl-functions.m4 +++ b/m4/curl-functions.m4 @@ -3388,130 +3388,6 @@ AC_DEFUN([CURL_CHECK_FUNC_GMTIME_R], [ ]) -dnl CURL_CHECK_FUNC_INET_NTOA_R -dnl ------------------------------------------------- -dnl Verify if inet_ntoa_r is available, prototyped, -dnl and can be compiled. If all of these are true, and -dnl usage has not been previously disallowed with -dnl shell variable curl_disallow_inet_ntoa_r, then -dnl HAVE_INET_NTOA_R will be defined. - -AC_DEFUN([CURL_CHECK_FUNC_INET_NTOA_R], [ - AC_REQUIRE([CURL_INCLUDES_ARPA_INET])dnl - # - tst_links_inet_ntoa_r="unknown" - tst_proto_inet_ntoa_r="unknown" - tst_compi_inet_ntoa_r="unknown" - tst_allow_inet_ntoa_r="unknown" - tst_nargs_inet_ntoa_r="unknown" - # - AC_MSG_CHECKING([if inet_ntoa_r can be linked]) - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([inet_ntoa_r]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_inet_ntoa_r="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_inet_ntoa_r="no" - ]) - # - if test "$tst_links_inet_ntoa_r" = "yes"; then - AC_MSG_CHECKING([if inet_ntoa_r is prototyped]) - AC_EGREP_CPP([inet_ntoa_r],[ - $curl_includes_arpa_inet - ],[ - AC_MSG_RESULT([yes]) - tst_proto_inet_ntoa_r="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_inet_ntoa_r="no" - ]) - fi - # - if test "$tst_proto_inet_ntoa_r" = "yes"; then - if test "$tst_nargs_inet_ntoa_r" = "unknown"; then - AC_MSG_CHECKING([if inet_ntoa_r takes 2 args.]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $curl_includes_arpa_inet - ]],[[ - struct in_addr addr; - if(0 != inet_ntoa_r(addr, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_inet_ntoa_r="yes" - tst_nargs_inet_ntoa_r="2" - ],[ - AC_MSG_RESULT([no]) - tst_compi_inet_ntoa_r="no" - ]) - fi - if test "$tst_nargs_inet_ntoa_r" = "unknown"; then - AC_MSG_CHECKING([if inet_ntoa_r takes 3 args.]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $curl_includes_arpa_inet - ]],[[ - struct in_addr addr; - if(0 != inet_ntoa_r(addr, 0, 0)) - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_inet_ntoa_r="yes" - tst_nargs_inet_ntoa_r="3" - ],[ - AC_MSG_RESULT([no]) - tst_compi_inet_ntoa_r="no" - ]) - fi - AC_MSG_CHECKING([if inet_ntoa_r is compilable]) - if test "$tst_compi_inet_ntoa_r" = "yes"; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - fi - # - if test "$tst_compi_inet_ntoa_r" = "yes"; then - AC_MSG_CHECKING([if inet_ntoa_r usage allowed]) - if test "x$curl_disallow_inet_ntoa_r" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_inet_ntoa_r="yes" - else - AC_MSG_RESULT([no]) - tst_allow_inet_ntoa_r="no" - fi - fi - # - AC_MSG_CHECKING([if inet_ntoa_r might be used]) - if test "$tst_links_inet_ntoa_r" = "yes" && - test "$tst_proto_inet_ntoa_r" = "yes" && - test "$tst_compi_inet_ntoa_r" = "yes" && - test "$tst_allow_inet_ntoa_r" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_INET_NTOA_R, 1, - [Define to 1 if you have the inet_ntoa_r function.]) - dnl AC_DEFINE_UNQUOTED(INET_NTOA_R_ARGS, $tst_nargs_inet_ntoa_r, - dnl [Specifies the number of arguments to inet_ntoa_r]) - # - if test "$tst_nargs_inet_ntoa_r" -eq "2"; then - AC_DEFINE(HAVE_INET_NTOA_R_2, 1, [inet_ntoa_r() takes 2 args]) - elif test "$tst_nargs_inet_ntoa_r" -eq "3"; then - AC_DEFINE(HAVE_INET_NTOA_R_3, 1, [inet_ntoa_r() takes 3 args]) - fi - # - curl_cv_func_inet_ntoa_r="yes" - else - AC_MSG_RESULT([no]) - curl_cv_func_inet_ntoa_r="no" - fi -]) - - dnl CURL_CHECK_FUNC_INET_NTOP dnl ------------------------------------------------- dnl Verify if inet_ntop is available, prototyped, can diff --git a/m4/curl-reentrant.m4 b/m4/curl-reentrant.m4 index 4655b0547..3e4d6a969 100644 --- a/m4/curl-reentrant.m4 +++ b/m4/curl-reentrant.m4 @@ -214,43 +214,6 @@ AC_DEFUN([CURL_CHECK_NEED_REENTRANT_STRTOK_R], [ ]) -dnl CURL_CHECK_NEED_REENTRANT_INET_NTOA_R -dnl ------------------------------------------------- -dnl Checks if the preprocessor _REENTRANT definition -dnl makes function inet_ntoa_r compiler visible. - -AC_DEFUN([CURL_CHECK_NEED_REENTRANT_INET_NTOA_R], [ - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([inet_ntoa_r]) - ],[ - tmp_inet_ntoa_r="yes" - ],[ - tmp_inet_ntoa_r="no" - ]) - if test "$tmp_inet_ntoa_r" = "yes"; then - AC_EGREP_CPP([inet_ntoa_r],[ -#include -#include -#include -#include - ],[ - tmp_inet_ntoa_r="proto_declared" - ],[ - AC_EGREP_CPP([inet_ntoa_r],[ -#define _REENTRANT -#include -#include -#include -#include - ],[ - tmp_inet_ntoa_r="proto_needs_reentrant" - tmp_need_reentrant="yes" - ]) - ]) - fi -]) - - dnl CURL_CHECK_NEED_REENTRANT_GETHOSTBYADDR_R dnl ------------------------------------------------- dnl Checks if the preprocessor _REENTRANT definition @@ -369,9 +332,6 @@ AC_DEFUN([CURL_CHECK_NEED_REENTRANT_FUNCTIONS_R], [ if test "$tmp_need_reentrant" = "no"; then CURL_CHECK_NEED_REENTRANT_STRTOK_R fi - if test "$tmp_need_reentrant" = "no"; then - CURL_CHECK_NEED_REENTRANT_INET_NTOA_R - fi if test "$tmp_need_reentrant" = "no"; then CURL_CHECK_NEED_REENTRANT_GETHOSTBYADDR_R fi