Add ox_assert to ox/std
This commit is contained in:
parent
85c747ad1a
commit
b616d9c0f2
2
deps/ox/src/ox/std/CMakeLists.txt
vendored
2
deps/ox/src/ox/std/CMakeLists.txt
vendored
@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
add_library(
|
||||
OxStd
|
||||
assert.cpp
|
||||
memops.cpp
|
||||
random.cpp
|
||||
strops.cpp
|
||||
@ -16,6 +17,7 @@ set_property(
|
||||
|
||||
install(
|
||||
FILES
|
||||
assert.hpp
|
||||
bitops.hpp
|
||||
byteswap.hpp
|
||||
memops.hpp
|
||||
|
19
deps/ox/src/ox/std/assert.cpp
vendored
Normal file
19
deps/ox/src/ox/std/assert.cpp
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright 2015 - 2018 gtalent2@gmail.com
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#if defined(OX_USE_STDLIB)
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
void oxAssert(const char *file, int line, bool pass, const char *msg) {
|
||||
if (!pass) {
|
||||
std::cerr << '(' << file << ':' << line << "): " << msg << std::endl;
|
||||
std::abort();
|
||||
}
|
||||
}
|
17
deps/ox/src/ox/std/assert.hpp
vendored
Normal file
17
deps/ox/src/ox/std/assert.hpp
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright 2015 - 2018 gtalent2@gmail.com
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
void oxAssert(const char *file, int line, bool pass, const char *msg);
|
||||
|
||||
#ifdef NDEBUG
|
||||
#define ox_assert(pass, msg) oxAssert(__FILE__, __LINE__, pass, msg)
|
||||
#else
|
||||
#define ox_assert(pass, msg)
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user