diff options
author | teor <teor2345@gmail.com> | 2014-10-26 14:43:55 +1100 |
---|---|---|
committer | teor <teor2345@gmail.com> | 2014-10-30 22:34:46 +1100 |
commit | 13298d90a90dc62d21d38f910171c9b57a8f0273 (patch) | |
tree | df91745009bef0a26901438d361036f039e9b00f /src/common/compat.h | |
parent | acc392856d255059949bb22d2daf56c61f3fd76d (diff) | |
download | tor-13298d90a90dc62d21d38f910171c9b57a8f0273.tar.gz tor-13298d90a90dc62d21d38f910171c9b57a8f0273.zip |
Silence spurious clang warnings
Silence clang warnings under --enable-expensive-hardening, including:
+ implicit truncation of 64 bit values to 32 bit;
+ const char assignment to self;
+ tautological compare; and
+ additional parentheses around equality tests. (gcc uses these to
silence assignment, so clang warns when they're present in an
equality test. But we need to use extra parentheses in macros to
isolate them from other code).
Diffstat (limited to 'src/common/compat.h')
-rw-r--r-- | src/common/compat.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/common/compat.h b/src/common/compat.h index a61ed009c1..f2eef5b6e7 100644 --- a/src/common/compat.h +++ b/src/common/compat.h @@ -562,17 +562,18 @@ const char *tor_socket_strerror(int e); #else #define SOCK_ERRNO(e) e #if EAGAIN == EWOULDBLOCK -#define ERRNO_IS_EAGAIN(e) ((e) == EAGAIN) +/* || 0 is for -Wparentheses-equality (-Wall?) appeasement under clang */ +#define ERRNO_IS_EAGAIN(e) ((e) == EAGAIN || 0) #else #define ERRNO_IS_EAGAIN(e) ((e) == EAGAIN || (e) == EWOULDBLOCK) #endif -#define ERRNO_IS_EINPROGRESS(e) ((e) == EINPROGRESS) -#define ERRNO_IS_CONN_EINPROGRESS(e) ((e) == EINPROGRESS) +#define ERRNO_IS_EINPROGRESS(e) ((e) == EINPROGRESS || 0) +#define ERRNO_IS_CONN_EINPROGRESS(e) ((e) == EINPROGRESS || 0) #define ERRNO_IS_ACCEPT_EAGAIN(e) \ (ERRNO_IS_EAGAIN(e) || (e) == ECONNABORTED) #define ERRNO_IS_ACCEPT_RESOURCE_LIMIT(e) \ ((e) == EMFILE || (e) == ENFILE || (e) == ENOBUFS || (e) == ENOMEM) -#define ERRNO_IS_EADDRINUSE(e) ((e) == EADDRINUSE) +#define ERRNO_IS_EADDRINUSE(e) (((e) == EADDRINUSE) || 0) #define tor_socket_errno(sock) (errno) #define tor_socket_strerror(e) strerror(e) #endif |