From cef21ef035bbb3a8c04c10bee0d86b879cdfba5b Mon Sep 17 00:00:00 2001 From: Razakhel Date: Wed, 21 Feb 2024 22:54:44 +0100 Subject: [PATCH] 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 --- public/common/TracySystem.cpp | 4 ++-- public/common/tracy_lz4.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/public/common/TracySystem.cpp b/public/common/TracySystem.cpp index 0e26aeca..4482d5f7 100644 --- a/public/common/TracySystem.cpp +++ b/public/common/TracySystem.cpp @@ -110,7 +110,7 @@ struct ThreadNameData std::atomic& GetThreadNameData(); #endif -#ifdef _MSC_VER +#if defined _MSC_VER && !defined __clang__ # pragma pack( push, 8 ) struct THREADNAME_INFO { @@ -149,7 +149,7 @@ TRACY_API void SetThreadName( const char* name ) } else { -# if defined _MSC_VER +# if defined _MSC_VER && !defined __clang__ THREADNAME_INFO info; info.dwType = 0x1000; info.szName = name; diff --git a/public/common/tracy_lz4.cpp b/public/common/tracy_lz4.cpp index 6c26639c..15d0990f 100644 --- a/public/common/tracy_lz4.cpp +++ b/public/common/tracy_lz4.cpp @@ -128,11 +128,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