Added clang-tidy config and cleaned up the code a little.

This commit is contained in:
2024-08-18 13:30:40 +02:00
parent 9f011952c2
commit 6d111904d4
7 changed files with 142 additions and 65 deletions

View File

@@ -6,7 +6,6 @@
#include <array>
#include <atomic>
#include <cassert>
#include <cstddef>
namespace mijin
@@ -32,8 +31,9 @@ private:
using byte_type = std::conditional_t<threadSafe, std::atomic_uint8_t, std::uint8_t>;
std::array<byte_type, (numBits + 7) / 8> bytes;
public:
[[nodiscard]] bool get(std::size_t index) const {
assert(index < numBits);
[[nodiscard]] bool get(std::size_t index) const
{
MIJIN_ASSERT(index < numBits, "BitArray: index out of range.");
return (bytes[index / 8] & (1 << (index % 8)));
}
void set(std::size_t index, bool value)

View File

@@ -51,13 +51,13 @@ Result<LibraryHandle> openSharedLibrary(std::string_view libraryFile) noexcept
{
#if MIJIN_TARGET_OS == MIJIN_OS_LINUX
const std::unique_lock dlErrorLock(gDlErrorMutex);
dlerror();
dlerror(); // NOLINT(concurrency-mt-unsafe) we take care of that
const fs::path libraryPath = fs::absolute(libraryFile);
void* ptr = dlopen(libraryPath.c_str(), RTLD_NOW);
if (ptr == nullptr)
{
return ResultError(dlerror());
return ResultError(dlerror()); // NOLINT(concurrency-mt-unsafe) we take care of that
}
return LibraryHandle{.data = dlopen(libraryPath.c_str(), RTLD_NOW)};
#elif MIJIN_TARGET_OS == MIJIN_OS_WINDOWS