Added preprocessor checks for Clang on Windows

- MSVC-specific code is used in some places and compiled only if _MSC_VER is set; however, Clang under Windows also defines this, which reports errors on this non-standard code if the -pedantic-errors compiler flag is set
This commit is contained in:
Razakhel 2024-02-22 13:36:12 +01:00
parent 92dada5d84
commit be8a4f6522
3 changed files with 5 additions and 4 deletions

View File

@ -145,6 +145,7 @@ endif()
include (CheckCCompilerFlag)
foreach (flag
# GCC-style
-pedantic-errors
-Wall
-Wextra
-Wundef

View File

@ -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

View File

@ -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