sys: Replace __builtin_unreachable() with hex::unreachable()
This commit is contained in:
parent
ea848dbfc0
commit
98dfc2e286
11
lib/libimhex/include/hex/helpers/intrinsics.hpp
Normal file
11
lib/libimhex/include/hex/helpers/intrinsics.hpp
Normal file
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <hex/helpers/concepts.hpp>
|
||||
|
||||
namespace hex {
|
||||
|
||||
[[noreturn]] void unreachable() {
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
}
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include <hex/helpers/concepts.hpp>
|
||||
#include <hex/helpers/fs.hpp>
|
||||
#include <hex/helpers/intrinsics.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <bit>
|
||||
@ -128,7 +129,7 @@ namespace hex {
|
||||
swapped = (u128(__builtin_bswap64(unswapped & 0xFFFF'FFFF'FFFF'FFFF)) << 64) | __builtin_bswap64(u128(unswapped) >> 64);
|
||||
break;
|
||||
default:
|
||||
__builtin_unreachable();
|
||||
hex::unreachable();
|
||||
}
|
||||
|
||||
T result;
|
||||
@ -168,7 +169,7 @@ namespace hex {
|
||||
swapped = (u128(__builtin_bswap64(unswapped & 0xFFFF'FFFF'FFFF'FFFF)) << 64) | __builtin_bswap64(u128(unswapped) >> 64);
|
||||
break;
|
||||
default:
|
||||
__builtin_unreachable();
|
||||
hex::unreachable();
|
||||
}
|
||||
|
||||
T result = 0;
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <hex.hpp>
|
||||
#include <hex/helpers/utils.hpp>
|
||||
#include <hex/helpers/intrinsics.hpp>
|
||||
|
||||
#include <hex/pattern_language/error.hpp>
|
||||
#include <hex/pattern_language/token.hpp>
|
||||
@ -189,7 +190,7 @@ namespace hex::pl {
|
||||
else if constexpr (S == Not)
|
||||
return false;
|
||||
else
|
||||
__builtin_unreachable();
|
||||
hex::unreachable();
|
||||
}
|
||||
|
||||
template<Setting S = Normal>
|
||||
@ -220,7 +221,7 @@ namespace hex::pl {
|
||||
partReset();
|
||||
return false;
|
||||
} else
|
||||
__builtin_unreachable();
|
||||
hex::unreachable();
|
||||
}
|
||||
|
||||
template<Setting S = Normal>
|
||||
@ -235,7 +236,7 @@ namespace hex::pl {
|
||||
else if constexpr (S == Not)
|
||||
return true;
|
||||
else
|
||||
__builtin_unreachable();
|
||||
hex::unreachable();
|
||||
}
|
||||
|
||||
template<Setting S = Normal>
|
||||
@ -245,7 +246,7 @@ namespace hex::pl {
|
||||
else if constexpr (S == Not)
|
||||
return sequenceImpl<Not>(type, value) && oneOfImpl(args...);
|
||||
else
|
||||
__builtin_unreachable();
|
||||
hex::unreachable();
|
||||
}
|
||||
|
||||
template<Setting S = Normal>
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/helpers/fs_macos.h>
|
||||
#include <hex/helpers/file.hpp>
|
||||
#include <hex/helpers/intrinsics.hpp>
|
||||
|
||||
#include <xdg.hpp>
|
||||
|
||||
@ -72,7 +73,7 @@ namespace hex::fs {
|
||||
result = NFD::PickFolder(outPath, defaultPath.c_str());
|
||||
break;
|
||||
default:
|
||||
__builtin_unreachable();
|
||||
hex::unreachable();
|
||||
}
|
||||
|
||||
if (result == NFD_OKAY) {
|
||||
@ -174,7 +175,7 @@ namespace hex::fs {
|
||||
});
|
||||
break;
|
||||
default:
|
||||
__builtin_unreachable();
|
||||
hex::unreachable();
|
||||
}
|
||||
#elif defined(OS_MACOS)
|
||||
// Get path to special directories
|
||||
@ -219,7 +220,7 @@ namespace hex::fs {
|
||||
result.push_back((applicationSupportDir / "logs").string());
|
||||
break;
|
||||
default:
|
||||
__builtin_unreachable();
|
||||
hex::unreachable();
|
||||
}
|
||||
#else
|
||||
std::vector<std::fs::path> configDirs = xdg::ConfigDirs();
|
||||
@ -276,7 +277,7 @@ namespace hex::fs {
|
||||
std::transform(dataDirs.begin(), dataDirs.end(), std::back_inserter(result), [](auto p) { return (p / "logs").string(); });
|
||||
break;
|
||||
default:
|
||||
__builtin_unreachable();
|
||||
hex::unreachable();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user