Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#defining defined() in macros is undefined #25

Open
bentley opened this issue Feb 19, 2018 · 0 comments · May be fixed by #27
Open

#defining defined() in macros is undefined #25

bentley opened this issue Feb 19, 2018 · 0 comments · May be fixed by #27

Comments

@bentley
Copy link

bentley commented Feb 19, 2018

Clang-5.0.1 on OpenBSD complains when compiling dns.c:

cc -std=gnu99 -Wall -Wextra -O2 -g -fstack-protector -O2 -pipe  -DDNS_DEBUG -DDNS_MAIN  -o dns dns.c 
dns.c:383:5: warning: macro expansion producing 'defined' has undefined behavior
      [-Wexpansion-to-defined]
#if HAVE___ATOMIC_FETCH_ADD && __GCC_ATOMIC_LONG_LOCK_FREE == 2
    ^
dns.c:375:34: note: expanded from macro 'HAVE___ATOMIC_FETCH_ADD'
#define HAVE___ATOMIC_FETCH_ADD (defined __ATOMIC_RELAXED)
                                 ^
dns.c:392:5: warning: macro expansion producing 'defined' has undefined behavior
      [-Wexpansion-to-defined]
#if HAVE___ATOMIC_FETCH_SUB && __GCC_ATOMIC_LONG_LOCK_FREE == 2
    ^
dns.c:379:33: note: expanded from macro 'HAVE___ATOMIC_FETCH_SUB'
#define HAVE___ATOMIC_FETCH_SUB HAVE___ATOMIC_FETCH_ADD
                                ^
dns.c:375:34: note: expanded from macro 'HAVE___ATOMIC_FETCH_ADD'
#define HAVE___ATOMIC_FETCH_ADD (defined __ATOMIC_RELAXED)
                                 ^
dns.c:788:5: warning: macro expansion producing 'defined' has undefined behavior
      [-Wexpansion-to-defined]
#if DNS_HAVE_SOCKADDR_UN
    ^
dns.c:782:31: note: expanded from macro 'DNS_HAVE_SOCKADDR_UN'
#define DNS_HAVE_SOCKADDR_UN (defined AF_UNIX && !defined _WIN32)
                              ^
dns.c:788:5: warning: macro expansion producing 'defined' has undefined behavior
      [-Wexpansion-to-defined]
dns.c:782:51: note: expanded from macro 'DNS_HAVE_SOCKADDR_UN'
#define DNS_HAVE_SOCKADDR_UN (defined AF_UNIX && !defined _WIN32)
                                                  ^
dns.c:843:5: warning: macro expansion producing 'defined' has undefined behavior
      [-Wexpansion-to-defined]
#if DNS_HAVE_SOCKADDR_UN
    ^
dns.c:782:31: note: expanded from macro 'DNS_HAVE_SOCKADDR_UN'
#define DNS_HAVE_SOCKADDR_UN (defined AF_UNIX && !defined _WIN32)
                              ^
dns.c:843:5: warning: macro expansion producing 'defined' has undefined behavior
      [-Wexpansion-to-defined]
dns.c:782:51: note: expanded from macro 'DNS_HAVE_SOCKADDR_UN'
#define DNS_HAVE_SOCKADDR_UN (defined AF_UNIX && !defined _WIN32)
                                                  ^
dns.c:849:5: warning: macro expansion producing 'defined' has undefined behavior
      [-Wexpansion-to-defined]
#if DNS_HAVE_SOCKADDR_UN
    ^
dns.c:782:31: note: expanded from macro 'DNS_HAVE_SOCKADDR_UN'
#define DNS_HAVE_SOCKADDR_UN (defined AF_UNIX && !defined _WIN32)
                              ^
dns.c:849:5: warning: macro expansion producing 'defined' has undefined behavior
      [-Wexpansion-to-defined]
dns.c:782:51: note: expanded from macro 'DNS_HAVE_SOCKADDR_UN'
#define DNS_HAVE_SOCKADDR_UN (defined AF_UNIX && !defined _WIN32)
                                                  ^
dns.c:909:5: warning: macro expansion producing 'defined' has undefined behavior
      [-Wexpansion-to-defined]
#if DNS_HAVE_SOCKADDR_UN
    ^
dns.c:782:31: note: expanded from macro 'DNS_HAVE_SOCKADDR_UN'
#define DNS_HAVE_SOCKADDR_UN (defined AF_UNIX && !defined _WIN32)
                              ^
dns.c:909:5: warning: macro expansion producing 'defined' has undefined behavior
      [-Wexpansion-to-defined]
dns.c:782:51: note: expanded from macro 'DNS_HAVE_SOCKADDR_UN'
#define DNS_HAVE_SOCKADDR_UN (defined AF_UNIX && !defined _WIN32)
                                                  ^
dns.c:6134:5: warning: macro expansion producing 'defined' has undefined
      behavior [-Wexpansion-to-defined]
#if HAVE_SOCK_CLOEXEC
    ^
dns.c:6118:28: note: expanded from macro 'HAVE_SOCK_CLOEXEC'
#define HAVE_SOCK_CLOEXEC (defined SOCK_CLOEXEC)
                           ^
dns.c:6137:5: warning: macro expansion producing 'defined' has undefined
      behavior [-Wexpansion-to-defined]
#if HAVE_SOCK_NONBLOCK
    ^
dns.c:6122:29: note: expanded from macro 'HAVE_SOCK_NONBLOCK'
#define HAVE_SOCK_NONBLOCK (defined SOCK_NONBLOCK)
                            ^
dns.c:6143:25: warning: macro expansion producing 'defined' has undefined
      behavior [-Wexpansion-to-defined]
#if defined F_SETFD && !HAVE_SOCK_CLOEXEC
                        ^
dns.c:6118:28: note: expanded from macro 'HAVE_SOCK_CLOEXEC'
#define HAVE_SOCK_CLOEXEC (defined SOCK_CLOEXEC)
                           ^
dns.c:6148:28: warning: macro expansion producing 'defined' has undefined
      behavior [-Wexpansion-to-defined]
#if defined O_NONBLOCK && !HAVE_SOCK_NONBLOCK
                           ^
dns.c:6122:29: note: expanded from macro 'HAVE_SOCK_NONBLOCK'
#define HAVE_SOCK_NONBLOCK (defined SOCK_NONBLOCK)
                            ^
dns.c:6206:26: warning: macro expansion producing 'defined' has undefined
      behavior [-Wexpansion-to-defined]
#if (defined F_SETFD && !HAVE_SOCK_CLOEXEC) || (defined O_NONBLOCK && !H...
                         ^
dns.c:6118:28: note: expanded from macro 'HAVE_SOCK_CLOEXEC'
#define HAVE_SOCK_CLOEXEC (defined SOCK_CLOEXEC)
                           ^
dns.c:6206:72: warning: macro expansion producing 'defined' has undefined
      behavior [-Wexpansion-to-defined]
  ...F_SETFD && !HAVE_SOCK_CLOEXEC) || (defined O_NONBLOCK && !HAVE_SOCK_NONB...
                                                               ^
dns.c:6122:29: note: expanded from macro 'HAVE_SOCK_NONBLOCK'
#define HAVE_SOCK_NONBLOCK (defined SOCK_NONBLOCK)
                            ^
16 warnings generated.
daurnimator added a commit to daurnimator/dns that referenced this issue Jun 16, 2018
@daurnimator daurnimator linked a pull request Jun 16, 2018 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant