From 26e9145c26e6a6c2794300a4a7cf5b19e8b6be37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 23 Sep 2022 14:49:11 +0200 Subject: SCons: Cleanup `DEBUG`, `_DEBUG` and `NDEBUG` defines - `_DEBUG` is MSVC specific so it didn't make much sense to define for Android and iOS builds. - iOS was the only platform to define `DEBUG`. We don't use it anywhere outside thirdparty code, which we usually don't intend to debug, so it seems better to be consistent with other platforms. - Consistently define `NDEBUG` to disable assert behavior in both `release` and `release_debug` targets. This used to be set for `release` for all platforms, and `release_debug` for Android and iOS only. - Due to the above, I removed the only use we made of `assert()` in Godot code, which was only implemented for Unix anyway, should have been `DEV_ENABLED`, and is in PoolAllocator which we don't actually use. - The denoise and recast modules keep defining `NDEBUG` even for the `debug` target as we don't want OIDN and Embree asserting all over the place. --- core/os/os.cpp | 4 ---- core/os/os.h | 2 -- core/os/pool_allocator.cpp | 8 -------- 3 files changed, 14 deletions(-) (limited to 'core/os') diff --git a/core/os/os.cpp b/core/os/os.cpp index 526b31ae7e..ee8da21751 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -54,10 +54,6 @@ double OS::get_unix_time() const { return 0; } -void OS::debug_break() { - // something -} - void OS::_set_logger(CompositeLogger *p_logger) { if (_logger) { memdelete(_logger); diff --git a/core/os/os.h b/core/os/os.h index 0f79ff1a23..aa45a3b8a8 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -287,8 +287,6 @@ public: virtual Error move_to_trash(const String &p_path) { return FAILED; } - virtual void debug_break(); - virtual int get_exit_code() const; // `set_exit_code` should only be used from `SceneTree` (or from a similar // level, e.g. from the `Main::start` if leaving without creating a `SceneTree`). diff --git a/core/os/pool_allocator.cpp b/core/os/pool_allocator.cpp index f622e2c7c5..e7f2cff7c5 100644 --- a/core/os/pool_allocator.cpp +++ b/core/os/pool_allocator.cpp @@ -35,8 +35,6 @@ #include "core/os/os.h" #include "core/string/print_string.h" -#include - #define COMPACT_CHUNK(m_entry, m_to_pos) \ do { \ void *_dst = &((unsigned char *)pool)[m_to_pos]; \ @@ -169,11 +167,6 @@ bool PoolAllocator::find_entry_index(EntryIndicesPos *p_map_pos, const Entry *p_ PoolAllocator::ID PoolAllocator::alloc(int p_size) { ERR_FAIL_COND_V(p_size < 1, POOL_ALLOCATOR_INVALID_ID); -#ifdef DEBUG_ENABLED - if (p_size > free_mem) { - OS::get_singleton()->debug_break(); - } -#endif ERR_FAIL_COND_V(p_size > free_mem, POOL_ALLOCATOR_INVALID_ID); mt_lock(); @@ -482,7 +475,6 @@ void *PoolAllocator::get(ID p_mem) { ERR_FAIL_COND_V(!e, nullptr); } if (e->lock == 0) { - //assert(0); mt_unlock(); ERR_PRINT("e->lock == 0"); return nullptr; -- cgit v1.2.3