Skip to content

Commit

Permalink
Define __UNREACHABLE for MSVC
Browse files Browse the repository at this point in the history
An implementation may use this to optimize impossible code branches
away, typically, in optimized builds.
  • Loading branch information
jserv committed Oct 5, 2023
1 parent 2672969 commit 3a113f7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
*/
#if defined(__GNUC__) || defined(__clang__)
#define __UNREACHABLE __builtin_unreachable()
#elif defined(_MSC_VER)
#define __UNREACHABLE __assume(false)
#else /* unspported compilers */
/* clang-format off */
#define __UNREACHABLE do { /* nop */ } while (0)
Expand Down

0 comments on commit 3a113f7

Please sign in to comment.