From 71d01ae185d95888e3908cce5dba99890e970931 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 12 Sep 2019 20:35:46 -0700 Subject: All HAVE_* macros should be tested with #if, not #ifdef. * configure: In several config tests, test HAVE_SUPERLONG_T, HAVE_LONGLONG_T and HAVE_SYS_WAIT with #if. * lib.c: Test HAVE_GETENVIRONMENTSTRINGS with #if. * lib.h: Test HAVE_DOUBLE_INTPTR_T with #if. * mpi/mpi.c: Likewise. * mpi/mpi.h: Likewise. * socket.c: Test HAVE_GETADDRINFO with #if in three places. * stream.c: Test HAVE_SYS_WAIT and HAVE_SOCKETS with #if. --- configure | 6 +++--- lib.c | 2 +- lib.h | 2 +- mpi/mpi.c | 2 +- mpi/mpi.h | 2 +- socket.c | 6 +++--- stream.c | 4 ++-- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/configure b/configure index a70f9722..ef489af5 100755 --- a/configure +++ b/configure @@ -1199,10 +1199,10 @@ if [ -z "$intptr" ] ; then #include #include "config.h" char SIZEOF_BYTE[CHAR_BIT]; -#ifdef HAVE_SUPERLONG_T +#if HAVE_SUPERLONG_T char SIZEOF_SUPERLONG_T[sizeof (superlong_t)]; #endif -#ifdef HAVE_LONGLONG_T +#if HAVE_LONGLONG_T char SIZEOF_LONGLONG_T[sizeof (longlong_t)]; #endif char SIZEOF_PTR[sizeof (char *)]; @@ -1668,7 +1668,7 @@ printf "Checking for POSIX fork/pipe/exec/waitpid ... " cat > conftest.c < #endif #include diff --git a/lib.c b/lib.c index 90137512..debd353f 100644 --- a/lib.c +++ b/lib.c @@ -41,7 +41,7 @@ #include #include "config.h" #include "alloca.h" -#ifdef HAVE_GETENVIRONMENTSTRINGS +#if HAVE_GETENVIRONMENTSTRINGS #define NOMINMAX #include #endif diff --git a/lib.h b/lib.h index d960e5f4..9368cb08 100644 --- a/lib.h +++ b/lib.h @@ -30,7 +30,7 @@ typedef int_ptr_t cnum; typedef uint_ptr_t ucnum; -#ifdef HAVE_DOUBLE_INTPTR_T +#if HAVE_DOUBLE_INTPTR_T typedef double_intptr_t dbl_cnum; typedef double_uintptr_t dbl_ucnum; #endif diff --git a/mpi/mpi.c b/mpi/mpi.c index 52525762..0e01fc26 100644 --- a/mpi/mpi.c +++ b/mpi/mpi.c @@ -493,7 +493,7 @@ int mp_in_uintptr_range(mp_int *mp) return mp_in_range(mp, UINT_PTR_MAX, 1); } -#ifdef HAVE_DOUBLE_INTPTR_T +#if HAVE_DOUBLE_INTPTR_T mp_err mp_set_double_intptr(mp_int *mp, double_intptr_t z) { diff --git a/mpi/mpi.h b/mpi/mpi.h index cce283b0..2a73f233 100644 --- a/mpi/mpi.h +++ b/mpi/mpi.h @@ -88,7 +88,7 @@ mp_err mp_get_intptr(mp_int *mp, int_ptr_t *z); int mp_in_range(mp_int *mp, uint_ptr_t lim, int unsig); int mp_in_intptr_range(mp_int *mp); int mp_in_uintptr_range(mp_int *mp); -#ifdef HAVE_DOUBLE_INTPTR_T +#if HAVE_DOUBLE_INTPTR_T mp_err mp_set_double_intptr(mp_int *mp, double_intptr_t z); mp_err mp_set_double_uintptr(mp_int *mp, double_uintptr_t z); mp_err mp_get_double_intptr(mp_int *mp, double_intptr_t *z); diff --git a/socket.c b/socket.c index 79df7b7e..8f3662e0 100644 --- a/socket.c +++ b/socket.c @@ -159,7 +159,7 @@ static val sockaddr_unpack(int family, struct sockaddr_storage *src) } } -#ifdef HAVE_GETADDRINFO +#if HAVE_GETADDRINFO static void addrinfo_in(struct addrinfo *dest, val src) { @@ -1080,7 +1080,7 @@ void sock_load_init(void) flow_info_s = intern(lit("flow-info"), user_package); scope_id_s = intern(lit("scope-id"), user_package); -#ifdef HAVE_GETADDRINFO +#if HAVE_GETADDRINFO reg_fun(intern(lit("getaddrinfo"), user_package), func_n3o(getaddrinfo_wrap, 1)); #endif @@ -1100,7 +1100,7 @@ void sock_load_init(void) #ifdef SOCK_CLOEXEC reg_varl(intern(lit("sock-cloexec"), user_package), num_fast(SOCK_CLOEXEC)); #endif -#ifdef HAVE_GETADDRINFO +#if HAVE_GETADDRINFO reg_varl(intern(lit("ai-passive"), user_package), num_fast(AI_PASSIVE)); reg_varl(intern(lit("ai-canonname"), user_package), num_fast(AI_CANONNAME)); reg_varl(intern(lit("ai-numerichost"), user_package), num_fast(AI_NUMERICHOST)); diff --git a/stream.c b/stream.c index 5e0073ed..a57f9280 100644 --- a/stream.c +++ b/stream.c @@ -1271,7 +1271,7 @@ static val pipe_close(val stream, val throw_on_error) lit("unable to obtain status of command ~s: ~d/~s"), stream, num(errno), string_utf8(strerror(errno)), nao); } else { -#ifdef HAVE_SYS_WAIT +#if HAVE_SYS_WAIT if (throw_on_error) { if (WIFSIGNALED(status)) { int termsig = WTERMSIG(status); @@ -4749,7 +4749,7 @@ void stream_init(void) reg_fun(intern(lit("stream-set-prop"), user_package), func_n3(stream_set_prop)); reg_fun(intern(lit("stream-get-prop"), user_package), func_n2(stream_get_prop)); reg_fun(intern(lit("fileno"), user_package), func_n1(stream_fd)); -#ifdef HAVE_SOCKETS +#if HAVE_SOCKETS reg_fun(intern(lit("sock-family"), user_package), func_n1(sock_family)); reg_fun(intern(lit("sock-type"), user_package), func_n1(sock_type)); reg_fun(intern(lit("sock-peer"), user_package), func_n1(sock_peer)); -- cgit v1.2.3