[ox/std] Fix several issues found compiling on FreeBSD
This commit is contained in:
parent
2b60c04f1a
commit
238bc58f66
4
deps/ox/src/ox/std/assert.cpp
vendored
4
deps/ox/src/ox/std/assert.cpp
vendored
@ -18,7 +18,7 @@
|
||||
namespace ox {
|
||||
|
||||
template<>
|
||||
void _assert<bool>([[maybe_unused]]const char *file, [[maybe_unused]]int line, [[maybe_unused]]bool pass, [[maybe_unused]]const char *msg) {
|
||||
void assertFunc<bool>([[maybe_unused]]const char *file, [[maybe_unused]]int line, [[maybe_unused]]bool pass, [[maybe_unused]]const char *msg) {
|
||||
#if defined(OX_USE_STDLIB)
|
||||
if (!pass) {
|
||||
std::cerr << "\033[31;1;1mASSERT FAILURE:\033[0m (" << file << ':' << line << "): " << msg << std::endl;
|
||||
@ -29,7 +29,7 @@ void _assert<bool>([[maybe_unused]]const char *file, [[maybe_unused]]int line, [
|
||||
}
|
||||
|
||||
template<>
|
||||
void _assert<Error>([[maybe_unused]]const char *file, [[maybe_unused]]int line, [[maybe_unused]]Error err, [[maybe_unused]]const char *msg) {
|
||||
void assertFunc<Error>([[maybe_unused]]const char *file, [[maybe_unused]]int line, [[maybe_unused]]Error err, [[maybe_unused]]const char *msg) {
|
||||
#if defined(OX_USE_STDLIB)
|
||||
if (err) {
|
||||
auto ei = ErrorInfo(err);
|
||||
|
8
deps/ox/src/ox/std/assert.hpp
vendored
8
deps/ox/src/ox/std/assert.hpp
vendored
@ -14,19 +14,19 @@
|
||||
namespace ox {
|
||||
|
||||
template<typename T>
|
||||
void _assert(const char*, int, T, const char*) {
|
||||
void assertFunc(const char*, int, T, const char*) {
|
||||
}
|
||||
|
||||
template<>
|
||||
void _assert<bool>(const char *file, int line, bool pass, const char *msg);
|
||||
void assertFunc<bool>(const char *file, int line, bool pass, const char *msg);
|
||||
|
||||
template<>
|
||||
void _assert<Error>(const char *file, int line, Error err, const char*);
|
||||
void assertFunc<Error>(const char *file, int line, Error err, const char*);
|
||||
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define oxAssert(pass, msg) ox::_assert<decltype(pass)>(__FILE__, __LINE__, pass, msg)
|
||||
#define oxAssert(pass, msg) ox::assertFunc<decltype(pass)>(__FILE__, __LINE__, pass, msg)
|
||||
#else
|
||||
#define oxAssert(pass, msg)
|
||||
#endif
|
||||
|
4
deps/ox/src/ox/std/new.cpp
vendored
4
deps/ox/src/ox/std/new.cpp
vendored
@ -10,11 +10,11 @@
|
||||
|
||||
#include "types.hpp"
|
||||
|
||||
void *operator new(std::size_t, void *addr) {
|
||||
void *operator new(std::size_t, void *addr) noexcept {
|
||||
return addr;
|
||||
}
|
||||
|
||||
void *operator new[](std::size_t, void *addr) {
|
||||
void *operator new[](std::size_t, void *addr) noexcept {
|
||||
return addr;
|
||||
}
|
||||
|
||||
|
4
deps/ox/src/ox/std/new.hpp
vendored
4
deps/ox/src/ox/std/new.hpp
vendored
@ -15,14 +15,14 @@
|
||||
#include <malloc.h>
|
||||
#define ox_alloca(size) _alloca(size)
|
||||
#elif OX_USE_STDLIB
|
||||
#include <alloca.h>
|
||||
#include <stdlib.h>
|
||||
#define ox_alloca(size) alloca(size)
|
||||
#else
|
||||
#define ox_alloca(size) __builtin_alloca(size)
|
||||
#endif
|
||||
|
||||
|
||||
void *operator new(std::size_t, void*);
|
||||
void *operator new(std::size_t, void*) noexcept;
|
||||
|
||||
|
||||
/**
|
||||
|
2
deps/ox/src/ox/std/stacktrace.cpp
vendored
2
deps/ox/src/ox/std/stacktrace.cpp
vendored
@ -20,7 +20,7 @@ namespace ox {
|
||||
void printStackTrace([[maybe_unused]]int shave) {
|
||||
#if defined(OX_USE_STDLIB)
|
||||
std::array<void*, 100> frames;
|
||||
auto size = backtrace(frames.data(), frames.size());
|
||||
auto size = static_cast<int>(backtrace(frames.data(), frames.size()));
|
||||
if (size > shave) {
|
||||
std::cout << "\nStacktrace:\n";
|
||||
backtrace_symbols_fd(frames.data() + shave, size - shave, STDERR_FILENO);
|
||||
|
2
deps/ox/src/ox/std/trace.cpp
vendored
2
deps/ox/src/ox/std/trace.cpp
vendored
@ -20,7 +20,7 @@ namespace ox::trace {
|
||||
#if defined(OX_USE_STDLIB)
|
||||
static const auto OxPrintTrace = std::getenv("OXTRACE");
|
||||
#else
|
||||
static const auto OxPrintTrace = false;
|
||||
constexpr auto OxPrintTrace = false;
|
||||
#endif
|
||||
|
||||
namespace gdblogger {
|
||||
|
Loading…
Reference in New Issue
Block a user