Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions core/config/project_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,18 +232,18 @@ void ProjectSettings::set_as_internal(const String &p_name, bool p_internal) {

void ProjectSettings::set_ignore_value_in_docs(const String &p_name, bool p_ignore) {
ERR_FAIL_COND_MSG(!props.has(p_name), vformat("Request for nonexistent project setting: '%s'.", p_name));
#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
props[p_name].ignore_value_in_docs = p_ignore;
#endif
#endif // DEBUG_ENABLED
}

bool ProjectSettings::get_ignore_value_in_docs(const String &p_name) const {
ERR_FAIL_COND_V_MSG(!props.has(p_name), false, vformat("Request for nonexistent project setting: '%s'.", p_name));
#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
return props[p_name].ignore_value_in_docs;
#else
return false;
#endif
#endif // DEBUG_ENABLED
}

void ProjectSettings::add_hidden_prefix(const String &p_prefix) {
Expand Down
4 changes: 2 additions & 2 deletions core/config/project_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ class ProjectSettings : public Object {
Variant initial;
bool hide_from_editor = false;
bool restart_if_changed = false;
#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
bool ignore_value_in_docs = false;
#endif
#endif // DEBUG_ENABLED

VariantContainer() {}

Expand Down
6 changes: 3 additions & 3 deletions core/core_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ bool OS::is_debug_build() const {
return true;
#else
return false;
#endif
#endif // DEBUG_ENABLED
}

String OS::get_system_dir(SystemDir p_dir, bool p_shared_storage) const {
Expand Down Expand Up @@ -1669,13 +1669,13 @@ TypedArray<Dictionary> ClassDB::class_get_method_list(const StringName &p_class,
TypedArray<Dictionary> ret;

for (const MethodInfo &E : methods) {
#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
ret.push_back(E.operator Dictionary());
#else
Dictionary dict;
dict["name"] = E.name;
ret.push_back(dict);
#endif
#endif // DEBUG_ENABLED
}

return ret;
Expand Down
16 changes: 8 additions & 8 deletions core/core_constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@
#include "core/variant/variant.h"

struct _CoreConstant {
#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
bool ignore_value_in_docs = false;
bool is_bitfield = false;
#endif
#endif // DEBUG_ENABLED
StringName enum_name;
const char *name = nullptr;
int64_t value = 0;

_CoreConstant() {}

#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
_CoreConstant(const StringName &p_enum_name, const char *p_name, int64_t p_value, bool p_ignore_value_in_docs = false, bool p_is_bitfield = false) :
ignore_value_in_docs(p_ignore_value_in_docs),
is_bitfield(p_is_bitfield),
Expand All @@ -60,14 +60,14 @@ struct _CoreConstant {
name(p_name),
value(p_value) {
}
#endif
#endif // DEBUG_ENABLED
};

static Vector<_CoreConstant> _global_constants;
static HashMap<StringName, int> _global_constants_map;
static HashMap<StringName, Vector<_CoreConstant>> _global_enums;

#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED

#define BIND_CORE_CONSTANT(m_constant) \
_global_constants.push_back(_CoreConstant(StringName(), #m_constant, m_constant)); \
Expand Down Expand Up @@ -249,7 +249,7 @@ static HashMap<StringName, Vector<_CoreConstant>> _global_enums;
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
}

#endif
#endif // DEBUG_ENABLED

void register_global_constants() {
BIND_CORE_ENUM_CONSTANT(SIDE_LEFT);
Expand Down Expand Up @@ -816,7 +816,7 @@ StringName CoreConstants::get_global_constant_enum(int p_idx) {
return _global_constants[p_idx].enum_name;
}

#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
bool CoreConstants::is_global_constant_bitfield(int p_idx) {
return _global_constants[p_idx].is_bitfield;
}
Expand All @@ -832,7 +832,7 @@ bool CoreConstants::is_global_constant_bitfield(int p_idx) {
bool CoreConstants::get_ignore_value_in_docs(int p_idx) {
return false;
}
#endif
#endif // DEBUG_ENABLED

const char *CoreConstants::get_global_constant_name(int p_idx) {
return _global_constants[p_idx].name;
Expand Down
8 changes: 4 additions & 4 deletions core/extension/gdextension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ class GDExtensionMethodBind : public MethodBind {
virtual bool is_valid() const override { return valid; }
#endif

#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
virtual GodotTypeInfo::Metadata get_argument_meta(int p_arg) const override {
if (p_arg < 0) {
return return_value_metadata;
} else {
return arguments_metadata.get(p_arg);
}
}
#endif
#endif // DEBUG_ENABLED

virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) const override {
#ifdef TOOLS_ENABLED
Expand Down Expand Up @@ -219,9 +219,9 @@ class GDExtensionMethodBind : public MethodBind {
_set_returns(p_method_info->has_return_value);
_set_const(p_method_info->method_flags & GDEXTENSION_METHOD_FLAG_CONST);
_set_static(p_method_info->method_flags & GDEXTENSION_METHOD_FLAG_STATIC);
#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
_generate_argument_types(p_method_info->argument_count);
#endif
#endif // DEBUG_ENABLED
set_argument_count(p_method_info->argument_count);

Vector<Variant> defargs;
Expand Down
64 changes: 32 additions & 32 deletions core/object/callable_method_pointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ class CallableCustomMethodPointerBase : public CallableCustom {
uint32_t *comp_ptr = nullptr;
uint32_t comp_size;
uint32_t h;
#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
const char *text = "";
#endif
#endif // DEBUG_ENABLED
static bool compare_equal(const CallableCustom *p_a, const CallableCustom *p_b);
static bool compare_less(const CallableCustom *p_a, const CallableCustom *p_b);

Expand All @@ -51,14 +51,14 @@ class CallableCustomMethodPointerBase : public CallableCustom {

public:
virtual StringName get_method() const {
#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
return StringName(text);
#else
return StringName();
#endif
#endif // DEBUG_ENABLED
}

#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
void set_text(const char *p_text) {
text = p_text;
}
Expand All @@ -69,7 +69,7 @@ class CallableCustomMethodPointerBase : public CallableCustom {
virtual String get_as_text() const {
return String();
}
#endif
#endif // DEBUG_ENABLED
virtual CompareEqualFunc get_compare_equal_func() const;
virtual CompareLessFunc get_compare_less_func() const;

Expand Down Expand Up @@ -117,29 +117,29 @@ class CallableCustomMethodPointer : public CallableCustomMethodPointerBase {

template <typename T, typename... P>
Callable create_custom_callable_function_pointer(T *p_instance,
#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
const char *p_func_text,
#endif
#endif // DEBUG_ENABLED
void (T::*p_method)(P...)) {
typedef CallableCustomMethodPointer<T, void, P...> CCMP; // Messes with memnew otherwise.
CCMP *ccmp = memnew(CCMP(p_instance, p_method));
#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
ccmp->set_text(p_func_text + 1); // Try to get rid of the ampersand.
#endif
#endif // DEBUG_ENABLED
return Callable(ccmp);
}

template <typename T, typename R, typename... P>
Callable create_custom_callable_function_pointer(T *p_instance,
#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
const char *p_func_text,
#endif
#endif // DEBUG_ENABLED
R (T::*p_method)(P...)) {
typedef CallableCustomMethodPointer<T, R, P...> CCMP; // Messes with memnew otherwise.
CCMP *ccmp = memnew(CCMP(p_instance, p_method));
#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
ccmp->set_text(p_func_text + 1); // Try to get rid of the ampersand.
#endif
#endif // DEBUG_ENABLED
return Callable(ccmp);
}

Expand Down Expand Up @@ -186,37 +186,37 @@ class CallableCustomMethodPointerC : public CallableCustomMethodPointerBase {

template <typename T, typename... P>
Callable create_custom_callable_function_pointer(T *p_instance,
#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
const char *p_func_text,
#endif
#endif // DEBUG_ENABLED
void (T::*p_method)(P...) const) {
typedef CallableCustomMethodPointerC<T, void, P...> CCMP; // Messes with memnew otherwise.
CCMP *ccmp = memnew(CCMP(p_instance, p_method));
#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
ccmp->set_text(p_func_text + 1); // Try to get rid of the ampersand.
#endif
#endif // DEBUG_ENABLED
return Callable(ccmp);
}

template <typename T, typename R, typename... P>
Callable create_custom_callable_function_pointer(T *p_instance,
#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
const char *p_func_text,
#endif
R (T::*p_method)(P...) const) {
typedef CallableCustomMethodPointerC<T, R, P...> CCMP; // Messes with memnew otherwise.
CCMP *ccmp = memnew(CCMP(p_instance, p_method));
#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
ccmp->set_text(p_func_text + 1); // Try to get rid of the ampersand.
#endif
#endif // DEBUG_ENABLED
return Callable(ccmp);
}

#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
#define callable_mp(I, M) create_custom_callable_function_pointer(I, #M, M)
#else
#define callable_mp(I, M) create_custom_callable_function_pointer(I, M)
#endif
#endif // DEBUG_ENABLED

// STATIC VERSIONS

Expand Down Expand Up @@ -257,33 +257,33 @@ class CallableCustomStaticMethodPointer : public CallableCustomMethodPointerBase

template <typename... P>
Callable create_custom_callable_static_function_pointer(
#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
const char *p_func_text,
#endif
#endif // DEBUG_ENABLED
void (*p_method)(P...)) {
typedef CallableCustomStaticMethodPointer<void, P...> CCMP; // Messes with memnew otherwise.
CCMP *ccmp = memnew(CCMP(p_method));
#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
ccmp->set_text(p_func_text + 1); // Try to get rid of the ampersand.
#endif
#endif // DEBUG_ENABLED
return Callable(ccmp);
}

template <typename R, typename... P>
Callable create_custom_callable_static_function_pointer(
#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
const char *p_func_text,
#endif
#endif // DEBUG_ENABLED
R (*p_method)(P...)) {
typedef CallableCustomStaticMethodPointer<R, P...> CCMP; // Messes with memnew otherwise.
CCMP *ccmp = memnew(CCMP(p_method));
#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
ccmp->set_text(p_func_text + 1); // Try to get rid of the ampersand.
#endif
#endif // DEBUG_ENABLED
return Callable(ccmp);
}

#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
#define callable_mp_static(M) create_custom_callable_static_function_pointer(#M, M)
#else
#define callable_mp_static(M) create_custom_callable_static_function_pointer(M)
Expand Down
Loading