From c0f46187dec76c4ff980a3267d716e7f05c92f33 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Thu, 12 Jan 2017 18:12:10 +0100 Subject: Fix build error in Crypto/Whirpool.c when using LLVM Clang compiler by disabling inline assembly in this case (caused by http://llvm.org/bugs/show_bug.cgi?id=24232) --- src/Crypto/config.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/Crypto/config.h') diff --git a/src/Crypto/config.h b/src/Crypto/config.h index 792ac678..03b1ecb4 100644 --- a/src/Crypto/config.h +++ b/src/Crypto/config.h @@ -9,6 +9,12 @@ #define VC_INLINE static inline #endif +// Clang pretends to be VC++, too. +// See http://github.com/weidai11/cryptopp/issues/147 +#if defined(_MSC_VER) && defined(__clang__) +# error: "Unsupported configuration" +#endif + #ifdef __GNUC__ #define CRYPTOPP_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) #endif @@ -16,15 +22,17 @@ // Apple and LLVM's Clang. Apple Clang version 7.0 roughly equals LLVM Clang version 3.7 #if defined(__clang__ ) && !defined(__apple_build_version__) - #define CRYPTOPP_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) + #define CRYPTOPP_LLVM_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) + #define CRYPTOPP_CLANG_INTEGRATED_ASSEMBLER 1 #elif defined(__clang__ ) && defined(__apple_build_version__) - #define CRYPTOPP_APPLE_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) + #define CRYPTOPP_APPLE_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) + #define CRYPTOPP_CLANG_INTEGRATED_ASSEMBLER 1 #endif // Clang due to "Inline assembly operands don't work with .intel_syntax", http://llvm.org/bugs/show_bug.cgi?id=24232 // TODO: supply the upper version when LLVM fixes it. We set it to 20.0 for compilation purposes. -#if (defined(CRYPTOPP_CLANG_VERSION) && CRYPTOPP_CLANG_VERSION <= 200000) || (defined(CRYPTOPP_APPLE_CLANG_VERSION) && CRYPTOPP_APPLE_CLANG_VERSION <= 200000) -#define CRYPTOPP_DISABLE_INTEL_ASM 1 +#if (defined(CRYPTOPP_LLVM_CLANG_VERSION) && CRYPTOPP_LLVM_CLANG_VERSION <= 200000) || (defined(CRYPTOPP_APPLE_CLANG_VERSION) && CRYPTOPP_APPLE_CLANG_VERSION <= 200000) || defined(CRYPTOPP_CLANG_INTEGRATED_ASSEMBLER) + #define CRYPTOPP_DISABLE_INTEL_ASM 1 #endif #ifndef CRYPTOPP_L1_CACHE_LINE_SIZE -- cgit v1.2.3