Commit 3551e622 authored by kgardas's avatar kgardas

refactor test for __builtin_unreachable into Rts.h macro RTS_UNREACHABLE

Summary:
This patch refactors GNU C version test (for 4.5 and more modern)
due to usage of __builtin_unreachable done in the CNF.c code directly
into the new RTS_UNREACHABLE macro placed into Rts.h

Reviewers: bgamari, austin, simonmar, erikd

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2457
parent fc1432aa
......@@ -61,6 +61,13 @@ extern "C" {
#define RTS_UNLIKELY(p) p
#endif
/* __builtin_unreachable is supported since GNU C 4.5 */
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
#define RTS_UNREACHABLE __builtin_unreachable()
#else
#define RTS_UNREACHABLE abort()
#endif
/* Fix for mingw stat problem (done here so it's early enough) */
#ifdef mingw32_HOST_OS
#define __MSVCRT__ 1
......
......@@ -164,11 +164,8 @@ compactAllocateBlockInternal(Capability *cap,
default:
#ifdef DEBUG
ASSERT(!"code should not be reached");
#elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
/* __builtin_unreachable is supported since GNU C 4.5 */
__builtin_unreachable();
#else
abort();
RTS_UNREACHABLE;
#endif
}
RELEASE_SM_LOCK;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment