mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-26 18:21:04 +00:00
Replace _IRR_DEBUG_BREAK_IF
with assertions
This commit is contained in:
parent
2f464843cb
commit
5f1ff453c9
22 changed files with 96 additions and 91 deletions
|
@ -5,6 +5,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <cassert>
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
@ -65,22 +66,6 @@ typedef char fschar_t;
|
|||
|
||||
} // end namespace irr
|
||||
|
||||
//! define a break macro for debugging.
|
||||
#if defined(_DEBUG)
|
||||
#if defined(_IRR_WINDOWS_API_) && defined(_MSC_VER)
|
||||
#include <crtdbg.h>
|
||||
#define _IRR_DEBUG_BREAK_IF(_CONDITION_) \
|
||||
if (_CONDITION_) { \
|
||||
_CrtDbgBreak(); \
|
||||
}
|
||||
#else
|
||||
#include <assert.h>
|
||||
#define _IRR_DEBUG_BREAK_IF(_CONDITION_) assert(!(_CONDITION_));
|
||||
#endif
|
||||
#else
|
||||
#define _IRR_DEBUG_BREAK_IF(_CONDITION_)
|
||||
#endif
|
||||
|
||||
//! deprecated macro for virtual function override
|
||||
/** prefer to use the override keyword for new code */
|
||||
#define _IRR_OVERRIDE_ override
|
||||
|
@ -89,13 +74,13 @@ typedef char fschar_t;
|
|||
// Note: an assert(false) is included first to catch this in debug builds
|
||||
#if defined(__cpp_lib_unreachable)
|
||||
#include <utility>
|
||||
#define IRR_CODE_UNREACHABLE() do { _IRR_DEBUG_BREAK_IF(1) std::unreachable(); } while(0)
|
||||
#define IRR_CODE_UNREACHABLE() do { assert(false); std::unreachable(); } while(0)
|
||||
#elif defined(__has_builtin)
|
||||
#if __has_builtin(__builtin_unreachable)
|
||||
#define IRR_CODE_UNREACHABLE() do { _IRR_DEBUG_BREAK_IF(1) __builtin_unreachable(); } while(0)
|
||||
#define IRR_CODE_UNREACHABLE() do { assert(false); __builtin_unreachable(); } while(0)
|
||||
#endif
|
||||
#elif defined(_MSC_VER)
|
||||
#define IRR_CODE_UNREACHABLE() do { _IRR_DEBUG_BREAK_IF(1) __assume(false); } while(0)
|
||||
#define IRR_CODE_UNREACHABLE() do { assert(false); __assume(false); } while(0)
|
||||
#endif
|
||||
#ifndef IRR_CODE_UNREACHABLE
|
||||
#define IRR_CODE_UNREACHABLE() (void)0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue