From 238bc58f6653c850d8bc63e52d600ca91928641b Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Fri, 14 Jun 2019 19:36:46 -0500 Subject: [PATCH] [ox/std] Fix several issues found compiling on FreeBSD --- deps/ox/src/ox/std/assert.cpp | 4 ++-- deps/ox/src/ox/std/assert.hpp | 8 ++++---- deps/ox/src/ox/std/new.cpp | 4 ++-- deps/ox/src/ox/std/new.hpp | 4 ++-- deps/ox/src/ox/std/stacktrace.cpp | 2 +- deps/ox/src/ox/std/trace.cpp | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/deps/ox/src/ox/std/assert.cpp b/deps/ox/src/ox/std/assert.cpp index cdbaaae8..dae1c747 100644 --- a/deps/ox/src/ox/std/assert.cpp +++ b/deps/ox/src/ox/std/assert.cpp @@ -18,7 +18,7 @@ namespace ox { template<> -void _assert([[maybe_unused]]const char *file, [[maybe_unused]]int line, [[maybe_unused]]bool pass, [[maybe_unused]]const char *msg) { +void assertFunc([[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([[maybe_unused]]const char *file, [[maybe_unused]]int line, [ } template<> -void _assert([[maybe_unused]]const char *file, [[maybe_unused]]int line, [[maybe_unused]]Error err, [[maybe_unused]]const char *msg) { +void assertFunc([[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); diff --git a/deps/ox/src/ox/std/assert.hpp b/deps/ox/src/ox/std/assert.hpp index 291333ef..31a1cc1b 100644 --- a/deps/ox/src/ox/std/assert.hpp +++ b/deps/ox/src/ox/std/assert.hpp @@ -14,19 +14,19 @@ namespace ox { template -void _assert(const char*, int, T, const char*) { +void assertFunc(const char*, int, T, const char*) { } template<> -void _assert(const char *file, int line, bool pass, const char *msg); +void assertFunc(const char *file, int line, bool pass, const char *msg); template<> -void _assert(const char *file, int line, Error err, const char*); +void assertFunc(const char *file, int line, Error err, const char*); } #ifndef NDEBUG -#define oxAssert(pass, msg) ox::_assert(__FILE__, __LINE__, pass, msg) +#define oxAssert(pass, msg) ox::assertFunc(__FILE__, __LINE__, pass, msg) #else #define oxAssert(pass, msg) #endif diff --git a/deps/ox/src/ox/std/new.cpp b/deps/ox/src/ox/std/new.cpp index 12421c28..d68c833e 100644 --- a/deps/ox/src/ox/std/new.cpp +++ b/deps/ox/src/ox/std/new.cpp @@ -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; } diff --git a/deps/ox/src/ox/std/new.hpp b/deps/ox/src/ox/std/new.hpp index be14c078..b7900f6e 100644 --- a/deps/ox/src/ox/std/new.hpp +++ b/deps/ox/src/ox/std/new.hpp @@ -15,14 +15,14 @@ #include #define ox_alloca(size) _alloca(size) #elif OX_USE_STDLIB -#include +#include #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; /** diff --git a/deps/ox/src/ox/std/stacktrace.cpp b/deps/ox/src/ox/std/stacktrace.cpp index 7657ea6e..3eeffada 100644 --- a/deps/ox/src/ox/std/stacktrace.cpp +++ b/deps/ox/src/ox/std/stacktrace.cpp @@ -20,7 +20,7 @@ namespace ox { void printStackTrace([[maybe_unused]]int shave) { #if defined(OX_USE_STDLIB) std::array frames; - auto size = backtrace(frames.data(), frames.size()); + auto size = static_cast(backtrace(frames.data(), frames.size())); if (size > shave) { std::cout << "\nStacktrace:\n"; backtrace_symbols_fd(frames.data() + shave, size - shave, STDERR_FILENO); diff --git a/deps/ox/src/ox/std/trace.cpp b/deps/ox/src/ox/std/trace.cpp index 937e5274..546f95f7 100644 --- a/deps/ox/src/ox/std/trace.cpp +++ b/deps/ox/src/ox/std/trace.cpp @@ -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 {