Skip to content

Commit

Permalink
Fix -Wexpansion-to-defined warnings
Browse files Browse the repository at this point in the history
Closes wahern#25
  • Loading branch information
daurnimator committed Jun 16, 2018
1 parent 0ac72c9 commit f3a3778
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions src/dns.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,11 @@
#endif

#ifndef HAVE_STATIC_ASSERT
#if DNS_GNUC_PREREQ(0,0,0) && !DNS_GNUC_PREREQ(4,6,0)
#define HAVE_STATIC_ASSERT 0 /* glibc doesn't check GCC version */
#if (defined static_assert) && \
(!DNS_GNUC_PREREQ(0,0,0) || DNS_GNUC_PREREQ(4,6,0)) /* glibc doesn't check GCC version */
#define HAVE_STATIC_ASSERT 1
#else
#define HAVE_STATIC_ASSERT (defined static_assert)
#define HAVE_STATIC_ASSERT 0
#endif
#endif

Expand Down Expand Up @@ -372,7 +373,11 @@ const char *dns_strerror(int error) {
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#ifndef HAVE___ATOMIC_FETCH_ADD
#define HAVE___ATOMIC_FETCH_ADD (defined __ATOMIC_RELAXED)
#ifdef __ATOMIC_RELAXED
#define HAVE___ATOMIC_FETCH_ADD 1
#else
#define HAVE___ATOMIC_FETCH_ADD 0
#endif
#endif

#ifndef HAVE___ATOMIC_FETCH_SUB
Expand Down Expand Up @@ -779,7 +784,11 @@ DNS_NOTUSED static size_t dns_strnlcpy(char *dst, size_t lim, const char *src, s
} /* dns_strnlcpy() */


#define DNS_HAVE_SOCKADDR_UN (defined AF_UNIX && !defined _WIN32)
#if (defined AF_UNIX && !defined _WIN32)
#define DNS_HAVE_SOCKADDR_UN 1
#else
#define DNS_HAVE_SOCKADDR_UN 0
#endif

static size_t dns_af_len(int af) {
static const size_t table[AF_MAX] = {
Expand Down Expand Up @@ -6114,11 +6123,19 @@ static void dns_socketclose(int *fd, const struct dns_options *opts) {
#endif

#ifndef HAVE_SOCK_CLOEXEC
#define HAVE_SOCK_CLOEXEC (defined SOCK_CLOEXEC)
#ifdef SOCK_CLOEXEC
#define HAVE_SOCK_CLOEXEC 1
#else
#define HAVE_SOCK_CLOEXEC 0
#endif
#endif

#ifndef HAVE_SOCK_NONBLOCK
#define HAVE_SOCK_NONBLOCK (defined SOCK_NONBLOCK)
#ifdef SOCK_NONBLOCK
#define HAVE_SOCK_NONBLOCK 1
#else
#define HAVE_SOCK_NONBLOCK 0
#endif
#endif

#define DNS_SO_MAXTRY 7
Expand Down

1 comment on commit f3a3778

@CarloWood
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I also did this... Why wasn't this merged into upstream yet?

Please sign in to comment.