[ox/std] Make oxDebug trigger build failure if OX_NODEBUG is set to ON

This commit is contained in:
Gary Talent 2021-03-12 01:20:49 -06:00
parent 15d169dd12
commit 582cbf2041
3 changed files with 16 additions and 6 deletions

View File

@ -38,12 +38,11 @@ if(NOT OX_BARE_METAL)
) )
endif() endif()
if(OX_USE_STDLIB) target_compile_definitions(
target_compile_definitions( OxStd PUBLIC
OxStd PUBLIC $<$<BOOL:${OX_USE_STDLIB}>:OX_USE_STDLIB>
OX_USE_STDLIB $<$<BOOL:$ENV{OX_NODEBUG}>:OX_NODEBUG>
) )
endif()
target_link_libraries( target_link_libraries(
OxStd PUBLIC OxStd PUBLIC

View File

@ -10,6 +10,12 @@
namespace ox::defines { namespace ox::defines {
#if defined(OX_NODEBUG)
constexpr bool NoDebug = true;
#else
constexpr bool NoDebug = false;
#endif
#if defined(OX_USE_STDLIB) #if defined(OX_USE_STDLIB)
constexpr auto UseStdLib = true; constexpr auto UseStdLib = true;
#else #else

View File

@ -175,5 +175,10 @@ void init();
#define oxTracef(ch, fmt, ...) ox::trace::TraceStream(__FILE__, __LINE__, ch, ox::detail::fmtSegments<ox::detail::argCount(fmt)+1>(fmt), ##__VA_ARGS__) #define oxTracef(ch, fmt, ...) ox::trace::TraceStream(__FILE__, __LINE__, ch, ox::detail::fmtSegments<ox::detail::argCount(fmt)+1>(fmt), ##__VA_ARGS__)
#endif #endif
#ifndef OX_NODEBUG
#define oxDebug(...) oxTrace("debug", __VA_ARGS__) #define oxDebug(...) oxTrace("debug", __VA_ARGS__)
#define oxDebugf(...) oxTracef("debug", __VA_ARGS__) #define oxDebugf(...) oxTracef("debug", __VA_ARGS__)
#else
#define oxDebug(...) static_assert(false, "Debug prints were checked in."); oxTrace("debug", __VA_ARGS__)
#define oxDebugf(...) static_assert(false, "Debug prints were checked in."); oxTracef("debug", __VA_ARGS__)
#endif