From e2ce5485895f95ac35e36ee440bf1ba48b51fc16 Mon Sep 17 00:00:00 2001 From: Lacey <61335367+pnyaa@users.noreply.github.com> Date: Sat, 14 Nov 2026 11:43:39 +0000 Subject: [PATCH] :bug: Guard for clang-cl When cross compiling for windows msvc from linux using xwin and clang-cl the compiler doesn't define __GNUC__ like it does when using regular clang for linux target. However the windows headers are still included, and breaks __declspec(noreturn) in the sdk headers. --- src/unity_internals.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/unity_internals.h b/src/unity_internals.h index 562f5b6da..aa19a41f5 100644 --- a/src/unity_internals.h +++ b/src/unity_internals.h @@ -75,8 +75,10 @@ /* https://en.cppreference.com/w/c/language/_Noreturn */ #define UNITY_NORETURN _Noreturn #else /* Using newer Windows SDK or not MSVC compiler */ - #if defined(__GNUC__) + #if defined(__GNUC__) || (defined(__clang__) && defined(_MSC_VER)) /* The header collides with __attribute(noreturn)__ from GCC. */ + /* Clang-cl doesn't define __GNUC__ like regular clang, but still supports _Noreturn */ + /* would break __declspec(noreturn) in the Windows sdk headers.*/ #define UNITY_NORETURN _Noreturn #else #include