[ox/std] Fix problems in building with GCC 12
This commit is contained in:
parent
fd0d15b28e
commit
9417307a8e
10
deps/ox/src/ox/std/algorithm.hpp
vendored
10
deps/ox/src/ox/std/algorithm.hpp
vendored
@ -20,4 +20,14 @@ constexpr It find(It begin, It end, const T &value) {
|
||||
return end;
|
||||
}
|
||||
|
||||
template<typename It>
|
||||
constexpr It find_if(It begin, It end, auto predicate) {
|
||||
for (; begin != end; ++begin) {
|
||||
if (predicate(*begin)) {
|
||||
return begin;
|
||||
}
|
||||
}
|
||||
return end;
|
||||
}
|
||||
|
||||
}
|
24
deps/ox/src/ox/std/assert.cpp
vendored
24
deps/ox/src/ox/std/assert.cpp
vendored
@ -15,21 +15,17 @@ namespace ox {
|
||||
|
||||
void panic([[maybe_unused]]const char *file, [[maybe_unused]]int line, [[maybe_unused]]const char *panicMsg, [[maybe_unused]]const Error &err) noexcept {
|
||||
#ifdef OX_USE_STDLIB
|
||||
if (!std::is_constant_evaluated()) {
|
||||
oxErrf("\033[31;1;1mPANIC:\033[0m [{}:{}]: {}\n", file, line, panicMsg);
|
||||
if (err.msg) {
|
||||
oxErrf("\tError Message:\t{}\n", err.msg);
|
||||
}
|
||||
oxErrf("\tError Code:\t{}\n", static_cast<ErrorCode>(err));
|
||||
if (err.file != nullptr) {
|
||||
oxErrf("\tError Location:\t{}:{}\n", err.file, err.line);
|
||||
}
|
||||
printStackTrace(2);
|
||||
oxTrace("panic").del("") << "Panic: " << panicMsg << " (" << file << ":" << line << ")";
|
||||
std::abort();
|
||||
} else {
|
||||
assert(false);
|
||||
oxErrf("\033[31;1;1mPANIC:\033[0m [{}:{}]: {}\n", file, line, panicMsg);
|
||||
if (err.msg) {
|
||||
oxErrf("\tError Message:\t{}\n", err.msg);
|
||||
}
|
||||
oxErrf("\tError Code:\t{}\n", static_cast<ErrorCode>(err));
|
||||
if (err.file != nullptr) {
|
||||
oxErrf("\tError Location:\t{}:{}\n", err.file, err.line);
|
||||
}
|
||||
printStackTrace(2);
|
||||
oxTrace("panic").del("") << "Panic: " << panicMsg << " (" << file << ":" << line << ")";
|
||||
std::abort();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
11
deps/ox/src/ox/std/strops.cpp
vendored
11
deps/ox/src/ox/std/strops.cpp
vendored
@ -28,3 +28,14 @@ static_assert([] {
|
||||
retval |= !(ox_lastIndexOf(testStr, 'a', ox_strlen(testStr)) == 3);
|
||||
return retval == 0;
|
||||
}(), "ox_lastIndexOf aaaa a");
|
||||
|
||||
#ifndef OX_USE_STDLIB
|
||||
|
||||
extern "C"
|
||||
std::size_t strlen(const char *str) {
|
||||
std::size_t len = 0;
|
||||
for (; str[len]; len++);
|
||||
return len;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
1
deps/ox/src/ox/std/vector.hpp
vendored
1
deps/ox/src/ox/std/vector.hpp
vendored
@ -9,6 +9,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "bit.hpp"
|
||||
#include "error.hpp"
|
||||
#include "initializerlist.hpp"
|
||||
#include "iterator.hpp"
|
||||
#include "math.hpp"
|
||||
|
Loading…
Reference in New Issue
Block a user