diff --git a/build/cmake/CMakeLists.txt b/build/cmake/CMakeLists.txt index 382a2172..0a8513d7 100644 --- a/build/cmake/CMakeLists.txt +++ b/build/cmake/CMakeLists.txt @@ -145,6 +145,7 @@ endif() include (CheckCCompilerFlag) foreach (flag # GCC-style + -pedantic-errors -Wall -Wextra -Wundef diff --git a/lib/lz4.c b/lib/lz4.c index 7d9bd45f..b7dd32a7 100644 --- a/lib/lz4.c +++ b/lib/lz4.c @@ -127,11 +127,11 @@ #endif /* _MSC_VER */ #ifndef LZ4_FORCE_INLINE -# ifdef _MSC_VER /* Visual Studio */ +# if defined (_MSC_VER) && !defined (__clang__) /* MSVC */ # define LZ4_FORCE_INLINE static __forceinline # else # if defined (__cplusplus) || defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ -# ifdef __GNUC__ +# if defined (__GNUC__) || defined (__clang__) # define LZ4_FORCE_INLINE static inline __attribute__((always_inline)) # else # define LZ4_FORCE_INLINE static inline diff --git a/lib/xxhash.c b/lib/xxhash.c index ff28749e..08d8b360 100644 --- a/lib/xxhash.c +++ b/lib/xxhash.c @@ -120,12 +120,12 @@ static void* XXH_memcpy(void* dest, const void* src, size_t size) { return memcp /* ************************************* * Compiler Specific Options ***************************************/ -#ifdef _MSC_VER /* Visual Studio */ +#if defined (_MSC_VER) && !defined (__clang__) /* MSVC */ # pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ # define FORCE_INLINE static __forceinline #else # if defined (__cplusplus) || defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ -# ifdef __GNUC__ +# if defined (__GNUC__) || defined (__clang__) # define FORCE_INLINE static inline __attribute__((always_inline)) # else # define FORCE_INLINE static inline