mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-22 11:56:49 +01:00
Ported: 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.
- akien-mga
b0b759e6da
This commit is contained in:
parent
0177a5f6ed
commit
91e598aa7b
@ -334,6 +334,9 @@ if env_base["target"] == "debug":
|
|||||||
# DEV_ENABLED enables *engine developer* code which should only be compiled for those
|
# DEV_ENABLED enables *engine developer* code which should only be compiled for those
|
||||||
# working on the engine itself.
|
# working on the engine itself.
|
||||||
env_base.Append(CPPDEFINES=["DEV_ENABLED"])
|
env_base.Append(CPPDEFINES=["DEV_ENABLED"])
|
||||||
|
else:
|
||||||
|
# Disable assert() for production targets (only used in thirdparty code).
|
||||||
|
env_base.Append(CPPDEFINES=["NDEBUG"])
|
||||||
|
|
||||||
# SCons speed optimization controlled by the `fast_unsafe` option, which provide
|
# SCons speed optimization controlled by the `fast_unsafe` option, which provide
|
||||||
# more than 10 s speed up for incremental rebuilds.
|
# more than 10 s speed up for incremental rebuilds.
|
||||||
@ -574,7 +577,6 @@ if selected_platform in platform_list:
|
|||||||
print(" Use `tools=no target=release` to build a release export template.")
|
print(" Use `tools=no target=release` to build a release export template.")
|
||||||
Exit(255)
|
Exit(255)
|
||||||
suffix += ".opt"
|
suffix += ".opt"
|
||||||
env.Append(CPPDEFINES=["NDEBUG"])
|
|
||||||
elif env["target"] == "release_debug":
|
elif env["target"] == "release_debug":
|
||||||
if env["tools"]:
|
if env["tools"]:
|
||||||
suffix += ".opt.tools"
|
suffix += ".opt.tools"
|
||||||
|
@ -205,11 +205,6 @@ int64_t OS::get_unix_time_from_datetime(const DateTime &datetime) const {
|
|||||||
return epoch;
|
return epoch;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OS::debug_break(){
|
|
||||||
|
|
||||||
// something
|
|
||||||
};
|
|
||||||
|
|
||||||
void OS::_set_logger(CompositeLogger *p_logger) {
|
void OS::_set_logger(CompositeLogger *p_logger) {
|
||||||
if (_logger) {
|
if (_logger) {
|
||||||
memdelete(_logger);
|
memdelete(_logger);
|
||||||
|
@ -546,8 +546,6 @@ public:
|
|||||||
virtual void enable_for_stealing_focus(ProcessID pid) {}
|
virtual void enable_for_stealing_focus(ProcessID pid) {}
|
||||||
virtual void move_window_to_foreground() {}
|
virtual void move_window_to_foreground() {}
|
||||||
|
|
||||||
virtual void debug_break();
|
|
||||||
|
|
||||||
virtual void release_rendering_thread();
|
virtual void release_rendering_thread();
|
||||||
virtual void make_rendering_thread();
|
virtual void make_rendering_thread();
|
||||||
virtual void swap_buffers();
|
virtual void swap_buffers();
|
||||||
|
@ -35,8 +35,6 @@
|
|||||||
#include "core/os/os.h"
|
#include "core/os/os.h"
|
||||||
#include "core/string/print_string.h"
|
#include "core/string/print_string.h"
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#define COMPACT_CHUNK(m_entry, m_to_pos) \
|
#define COMPACT_CHUNK(m_entry, m_to_pos) \
|
||||||
do { \
|
do { \
|
||||||
void *_dst = &((unsigned char *)pool)[m_to_pos]; \
|
void *_dst = &((unsigned char *)pool)[m_to_pos]; \
|
||||||
@ -169,11 +167,6 @@ bool PoolAllocator::find_entry_index(EntryIndicesPos *p_map_pos, Entry *p_entry)
|
|||||||
|
|
||||||
PoolAllocator::ID PoolAllocator::alloc(int p_size) {
|
PoolAllocator::ID PoolAllocator::alloc(int p_size) {
|
||||||
ERR_FAIL_COND_V(p_size < 1, POOL_ALLOCATOR_INVALID_ID);
|
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);
|
ERR_FAIL_COND_V(p_size > free_mem, POOL_ALLOCATOR_INVALID_ID);
|
||||||
|
|
||||||
mt_lock();
|
mt_lock();
|
||||||
@ -482,7 +475,6 @@ void *PoolAllocator::get(ID p_mem) {
|
|||||||
ERR_FAIL_COND_V(!e, nullptr);
|
ERR_FAIL_COND_V(!e, nullptr);
|
||||||
}
|
}
|
||||||
if (e->lock == 0) {
|
if (e->lock == 0) {
|
||||||
//assert(0);
|
|
||||||
mt_unlock();
|
mt_unlock();
|
||||||
ERR_PRINT("e->lock == 0");
|
ERR_PRINT("e->lock == 0");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -49,7 +49,6 @@
|
|||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
@ -87,10 +86,6 @@ static void _setup_clock() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void OS_Unix::debug_break() {
|
|
||||||
assert(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
static void handle_interrupt(int sig) {
|
static void handle_interrupt(int sig) {
|
||||||
if (ScriptDebugger::get_singleton() == nullptr) {
|
if (ScriptDebugger::get_singleton() == nullptr) {
|
||||||
return;
|
return;
|
||||||
|
@ -95,7 +95,6 @@ public:
|
|||||||
|
|
||||||
virtual int get_processor_count() const;
|
virtual int get_processor_count() const;
|
||||||
|
|
||||||
virtual void debug_break();
|
|
||||||
virtual void initialize_debugging();
|
virtual void initialize_debugging();
|
||||||
|
|
||||||
virtual String get_executable_path() const;
|
virtual String get_executable_path() const;
|
||||||
|
@ -236,7 +236,6 @@
|
|||||||
GCC_DYNAMIC_NO_PIC = NO;
|
GCC_DYNAMIC_NO_PIC = NO;
|
||||||
GCC_OPTIMIZATION_LEVEL = 0;
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
"DEBUG=1",
|
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
);
|
);
|
||||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||||
|
@ -120,13 +120,9 @@ def configure(env):
|
|||||||
env.Append(CCFLAGS=[opt])
|
env.Append(CCFLAGS=[opt])
|
||||||
elif env["optimize"] == "size": # optimize for size
|
elif env["optimize"] == "size": # optimize for size
|
||||||
env.Append(CCFLAGS=["-Oz"])
|
env.Append(CCFLAGS=["-Oz"])
|
||||||
|
|
||||||
env.Append(CPPDEFINES=["NDEBUG"])
|
|
||||||
elif env["target"] == "debug":
|
elif env["target"] == "debug":
|
||||||
env.Append(LINKFLAGS=["-O0"])
|
env.Append(LINKFLAGS=["-O0"])
|
||||||
env.Append(CCFLAGS=["-O0", "-g", "-fno-limit-debug-info"])
|
env.Append(CCFLAGS=["-O0", "-g"])
|
||||||
env.Append(CPPDEFINES=["_DEBUG"])
|
|
||||||
env.Append(CPPFLAGS=["-UNDEBUG"])
|
|
||||||
|
|
||||||
# LTO
|
# LTO
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ def configure(env):
|
|||||||
## Build type
|
## Build type
|
||||||
|
|
||||||
if env["target"].startswith("release"):
|
if env["target"].startswith("release"):
|
||||||
env.Append(CPPDEFINES=["NDEBUG", ("NS_BLOCK_ASSERTIONS", 1)])
|
env.Append(CPPDEFINES=[("NS_BLOCK_ASSERTIONS", 1)])
|
||||||
if env["optimize"] == "speed": # optimize for speed (default)
|
if env["optimize"] == "speed": # optimize for speed (default)
|
||||||
# `-O2` is more friendly to debuggers than `-O3`, leading to better crash backtraces
|
# `-O2` is more friendly to debuggers than `-O3`, leading to better crash backtraces
|
||||||
# when using `target=release_debug`.
|
# when using `target=release_debug`.
|
||||||
@ -61,8 +61,7 @@ def configure(env):
|
|||||||
env.Append(LINKFLAGS=["-Os"])
|
env.Append(LINKFLAGS=["-Os"])
|
||||||
|
|
||||||
elif env["target"] == "debug":
|
elif env["target"] == "debug":
|
||||||
env.Append(CCFLAGS=["-gdwarf-2", "-O0"])
|
env.Append(CCFLAGS=["-g", "-O0"])
|
||||||
env.Append(CPPDEFINES=["_DEBUG", ("DEBUG", 1)])
|
|
||||||
|
|
||||||
## LTO
|
## LTO
|
||||||
|
|
||||||
|
@ -193,7 +193,6 @@ def configure_msvc(env, manual_msvc_config):
|
|||||||
|
|
||||||
elif env["target"] == "debug":
|
elif env["target"] == "debug":
|
||||||
env.AppendUnique(CCFLAGS=["/Zi", "/FS", "/Od"])
|
env.AppendUnique(CCFLAGS=["/Zi", "/FS", "/Od"])
|
||||||
# Allow big objects. Only needed for debug, see MinGW branch for rationale.
|
|
||||||
env.Append(LINKFLAGS=["/DEBUG"])
|
env.Append(LINKFLAGS=["/DEBUG"])
|
||||||
|
|
||||||
if env["windows_subsystem"] == "gui":
|
if env["windows_subsystem"] == "gui":
|
||||||
|
Loading…
Reference in New Issue
Block a user