1
0
mirror of synced 2024-09-25 12:08:26 +02:00

sys: Replace __builtin_unreachable() with hex::unreachable()

This commit is contained in:
WerWolv 2022-03-22 09:08:34 +01:00
parent ea848dbfc0
commit 98dfc2e286
4 changed files with 24 additions and 10 deletions

View File

@ -0,0 +1,11 @@
#pragma once
#include <hex/helpers/concepts.hpp>
namespace hex {
[[noreturn]] void unreachable() {
__builtin_unreachable();
}
}

View File

@ -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;

View File

@ -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>

View File

@ -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