rweather / noise-c

Noise-C, a plain C implementation of the Noise protocol
MIT License
306 stars 86 forks source link

macro expansion producing 'defined' has undefined behavior #19

Open nazar-pc opened 7 years ago

nazar-pc commented 7 years ago

When compiling with Clang 4 I'm getting following warnings:

In file included from vendor/src/backend/ref/cipher-chachapoly.c:25:
vendor/src/crypto/donna/poly1305-donna.c:18:6: warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined]
#if (HAS_SIZEOF_INT128_64BIT || HAS_MSVC_64BIT || HAS_GCC_4_4_64BIT)
     ^
vendor/src/crypto/donna/poly1305-donna.c:14:34: note: expanded from macro 'HAS_SIZEOF_INT128_64BIT'
#define HAS_SIZEOF_INT128_64BIT (defined(__SIZEOF_INT128__) && defined(__LP64__))
                                 ^
vendor/src/crypto/donna/poly1305-donna.c:18:6: warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined]
vendor/src/crypto/donna/poly1305-donna.c:14:64: note: expanded from macro 'HAS_SIZEOF_INT128_64BIT'
#define HAS_SIZEOF_INT128_64BIT (defined(__SIZEOF_INT128__) && defined(__LP64__))
                                                               ^
vendor/src/crypto/donna/poly1305-donna.c:18:33: warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined]
#if (HAS_SIZEOF_INT128_64BIT || HAS_MSVC_64BIT || HAS_GCC_4_4_64BIT)
                                ^
vendor/src/crypto/donna/poly1305-donna.c:15:25: note: expanded from macro 'HAS_MSVC_64BIT'
#define HAS_MSVC_64BIT (defined(_MSC_VER) && defined(_M_X64))
                        ^
vendor/src/crypto/donna/poly1305-donna.c:18:33: warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined]
vendor/src/crypto/donna/poly1305-donna.c:15:46: note: expanded from macro 'HAS_MSVC_64BIT'
#define HAS_MSVC_64BIT (defined(_MSC_VER) && defined(_M_X64))
                                             ^
vendor/src/crypto/donna/poly1305-donna.c:18:51: warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined]
#if (HAS_SIZEOF_INT128_64BIT || HAS_MSVC_64BIT || HAS_GCC_4_4_64BIT)
                                                  ^
vendor/src/crypto/donna/poly1305-donna.c:16:28: note: expanded from macro 'HAS_GCC_4_4_64BIT'
#define HAS_GCC_4_4_64BIT (defined(__GNUC__) && defined(__LP64__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4))))
                           ^
vendor/src/crypto/donna/poly1305-donna.c:18:51: warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined]
vendor/src/crypto/donna/poly1305-donna.c:16:49: note: expanded from macro 'HAS_GCC_4_4_64BIT'
#define HAS_GCC_4_4_64BIT (defined(__GNUC__) && defined(__LP64__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4))))
                                                ^
6 warnings generated.