/src/glaze/include/glaze/util/utility.hpp
Line | Count | Source (jump to first uncovered line) |
1 | | // Glaze Library |
2 | | // For the license information refer to glaze.hpp |
3 | | |
4 | | #pragma once |
5 | | |
6 | | #include <cstddef> |
7 | | |
8 | | namespace glz |
9 | | { |
10 | | // TODO: replace with std::unreachable |
11 | | [[noreturn]] inline void unreachable() noexcept |
12 | 0 | { |
13 | 0 | // Uses compiler specific extensions if possible. |
14 | 0 | // Even if no extension is used, undefined behavior is still raised by |
15 | 0 | // an empty function body and the noreturn attribute. |
16 | 0 | #ifdef __GNUC__ |
17 | 0 | // GCC, Clang, ICC |
18 | 0 | __builtin_unreachable(); |
19 | 0 | #else |
20 | 0 | #ifdef _MSC_VER |
21 | 0 | // MSVC |
22 | 0 | __assume(false); |
23 | 0 | #endif |
24 | 0 | #endif |
25 | 0 | } |
26 | | } |