diff options
| author | Mathias Berchtold <mberchtold@gmail.com> | 2026-02-21 15:01:11 -0700 |
|---|---|---|
| committer | Hans Kristian Rosbach <hk-github@circlestorm.org> | 2026-03-06 14:50:13 +0100 |
| commit | e615eeeef2ce65cd156253e6068e2bce303ccfc8 (patch) | |
| tree | 31580598415871edaedbcca31f5a411e9b2cd96c | |
| parent | ced54ac89cb79d8df912d741c25ea7bce9061761 (diff) | |
| download | Project-Tick-e615eeeef2ce65cd156253e6068e2bce303ccfc8.tar.gz Project-Tick-e615eeeef2ce65cd156253e6068e2bce303ccfc8.zip | |
Add MSVC support for Z_UNREACHABLE macro
Add Z_UNREACHABLE fallback for MSVC, as the C23 unreachable macro is not yet defined in the Windows SDK's <stddef.h>.
| -rw-r--r-- | zbuild.h | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -53,7 +53,11 @@ /* Hint to compiler that a block of code is unreachable, typically in a switch default condition */ #ifndef Z_UNREACHABLE # if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L -# define Z_UNREACHABLE() unreachable() // C23 approach +# if !defined(unreachable) && defined(_MSC_VER) +# define Z_UNREACHABLE() __assume(0) +# else +# define Z_UNREACHABLE() unreachable() // C23 approach +# endif # elif (defined(__GNUC__) && (__GNUC__ >= 5)) || defined(__clang__) # define Z_UNREACHABLE() __builtin_unreachable() # else |
