1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-13 13:31:48 +00:00

Style: Remove redundant DEBUG_METHODS_ENABLED

• Replaced with functionally identical and far more ubiquitous `DEBUG_ENABLED`
This commit is contained in:
Thaddeus Crews
2025-05-15 13:09:41 -05:00
parent 5e27318b6c
commit d237e31a89
25 changed files with 328 additions and 337 deletions

View File

@@ -1158,11 +1158,11 @@ struct _VariantCall {
HashMap<StringName, int64_t> value;
#ifdef DEBUG_ENABLED
List<StringName> value_ordered;
#endif
#endif // DEBUG_ENABLED
HashMap<StringName, Variant> variant_value;
#ifdef DEBUG_ENABLED
List<StringName> variant_value_ordered;
#endif
#endif // DEBUG_ENABLED
};
static ConstantData *constant_data;
@@ -1172,18 +1172,18 @@ struct _VariantCall {
ERR_FAIL_COND(constant_data[p_type].value.has(p_constant_name));
ERR_FAIL_COND(enum_data[p_type].value.has(p_constant_name));
ERR_FAIL_COND(enum_data[p_type].value_to_enum.has(p_constant_name));
#endif
#endif // DEBUG_ENABLED
constant_data[p_type].value[p_constant_name] = p_constant_value;
#ifdef DEBUG_ENABLED
constant_data[p_type].value_ordered.push_back(p_constant_name);
#endif
#endif // DEBUG_ENABLED
}
static void add_variant_constant(int p_type, const StringName &p_constant_name, const Variant &p_constant_value) {
constant_data[p_type].variant_value[p_constant_name] = p_constant_value;
#ifdef DEBUG_ENABLED
constant_data[p_type].variant_value_ordered.push_back(p_constant_name);
#endif
#endif // DEBUG_ENABLED
}
struct EnumData {
@@ -1198,7 +1198,7 @@ struct _VariantCall {
ERR_FAIL_COND(constant_data[p_type].value.has(p_enumeration_name));
ERR_FAIL_COND(enum_data[p_type].value.has(p_enumeration_name));
ERR_FAIL_COND(enum_data[p_type].value_to_enum.has(p_enumeration_name));
#endif
#endif // DEBUG_ENABLED
enum_data[p_type].value[p_enum_type_name][p_enumeration_name] = p_enum_value;
enum_data[p_type].value_to_enum[p_enumeration_name] = p_enum_type_name;
}
@@ -1246,11 +1246,11 @@ struct VariantBuiltInMethodInfo {
for (int i = 0; i < argument_count; i++) {
PropertyInfo pi;
#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
pi.name = argument_names[i];
#else
pi.name = "arg" + itos(i + 1);
#endif
#endif // DEBUG_ENABLED
pi.type = (*get_argument_type)(i);
if (pi.type == Variant::NIL) {
pi.usage |= PROPERTY_USAGE_NIL_IS_VARIANT;
@@ -1290,9 +1290,9 @@ static void register_builtin_method(const Vector<String> &p_argnames, const Vect
imi.return_type = T::get_return_type();
imi.argument_count = T::get_argument_count();
imi.get_argument_type = T::get_argument_type;
#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
ERR_FAIL_COND(!imi.is_vararg && imi.argument_count != imi.argument_names.size());
#endif
#endif // DEBUG_ENABLED
builtin_method_info[T::get_base_type()].insert(name, imi);
builtin_method_names[T::get_base_type()].push_back(name);
@@ -1312,7 +1312,7 @@ void Variant::callp(const StringName &p_method, const Variant **p_args, int p_ar
return;
}
#endif
#endif // DEBUG_ENABLED
r_ret = _get_obj().obj->callp(p_method, p_args, p_argcount, r_error);
} else {
@@ -1343,7 +1343,7 @@ void Variant::call_const(const StringName &p_method, const Variant **p_args, int
return;
}
#endif
#endif // DEBUG_ENABLED
r_ret = _get_obj().obj->call_const(p_method, p_args, p_argcount, r_error);
//else if (type==Variant::METHOD) {
@@ -1442,12 +1442,12 @@ String Variant::get_builtin_method_argument_name(Variant::Type p_type, const Str
ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, String());
const VariantBuiltInMethodInfo *method = builtin_method_info[p_type].lookup_ptr(p_method);
ERR_FAIL_NULL_V(method, String());
#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
ERR_FAIL_INDEX_V(p_argument, method->argument_count, String());
return method->argument_names[p_argument];
#else
return "arg" + itos(p_argument + 1);
#endif
#endif // DEBUG_ENABLED
}
Vector<Variant> Variant::get_builtin_method_default_arguments(Variant::Type p_type, const StringName &p_method) {
@@ -1549,7 +1549,7 @@ void Variant::get_constants_for_type(Variant::Type p_type, List<StringName> *p_c
#else
for (const KeyValue<StringName, int64_t> &E : cd.value) {
p_constants->push_back(E.key);
#endif
#endif // DEBUG_ENABLED
}
#ifdef DEBUG_ENABLED
@@ -1558,7 +1558,7 @@ void Variant::get_constants_for_type(Variant::Type p_type, List<StringName> *p_c
#else
for (const KeyValue<StringName, Variant> &E : cd.variant_value) {
p_constants->push_back(E.key);
#endif
#endif // DEBUG_ENABLED
}
}
@@ -1667,7 +1667,7 @@ StringName Variant::get_enum_for_enumeration(Variant::Type p_type, const StringN
return (enum_name == nullptr) ? StringName() : *enum_name;
}
#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
#define bind_method(m_type, m_method, m_arg_names, m_default_args) \
METHOD_CLASS(m_type, m_method, &m_type::m_method); \
register_builtin_method<Method_##m_type##_##m_method>(m_arg_names, m_default_args);
@@ -1675,9 +1675,9 @@ StringName Variant::get_enum_for_enumeration(Variant::Type p_type, const StringN
#define bind_method(m_type, m_method, m_arg_names, m_default_args) \
METHOD_CLASS(m_type, m_method, &m_type ::m_method); \
register_builtin_method<Method_##m_type##_##m_method>(sarray(), m_default_args);
#endif
#endif // DEBUG_ENABLED
#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
#define bind_convert_method(m_type_from, m_type_to, m_method, m_arg_names, m_default_args) \
CONVERT_METHOD_CLASS(m_type_from, m_method, &m_type_to::m_method); \
register_builtin_method<Method_##m_type_from##_##m_method>(m_arg_names, m_default_args);
@@ -1685,9 +1685,9 @@ StringName Variant::get_enum_for_enumeration(Variant::Type p_type, const StringN
#define bind_convert_method(m_type_from, m_type_to, m_method, m_arg_names, m_default_args) \
CONVERT_METHOD_CLASS(m_type_from, m_method, &m_type_to ::m_method); \
register_builtin_method<Method_##m_type_from##_##m_method>(sarray(), m_default_args);
#endif
#endif // DEBUG_ENABLED
#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
#define bind_static_method(m_type, m_method, m_arg_names, m_default_args) \
STATIC_METHOD_CLASS(m_type, m_method, m_type::m_method); \
register_builtin_method<Method_##m_type##_##m_method>(m_arg_names, m_default_args);
@@ -1695,9 +1695,9 @@ StringName Variant::get_enum_for_enumeration(Variant::Type p_type, const StringN
#define bind_static_method(m_type, m_method, m_arg_names, m_default_args) \
STATIC_METHOD_CLASS(m_type, m_method, m_type ::m_method); \
register_builtin_method<Method_##m_type##_##m_method>(sarray(), m_default_args);
#endif
#endif // DEBUG_ENABLED
#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
#define bind_methodv(m_type, m_name, m_method, m_arg_names, m_default_args) \
METHOD_CLASS(m_type, m_name, m_method); \
register_builtin_method<Method_##m_type##_##m_name>(m_arg_names, m_default_args);
@@ -1705,9 +1705,9 @@ StringName Variant::get_enum_for_enumeration(Variant::Type p_type, const StringN
#define bind_methodv(m_type, m_name, m_method, m_arg_names, m_default_args) \
METHOD_CLASS(m_type, m_name, m_method); \
register_builtin_method<Method_##m_type##_##m_name>(sarray(), m_default_args);
#endif
#endif // DEBUG_ENABLED
#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
#define bind_convert_methodv(m_type_from, m_type_to, m_name, m_method, m_arg_names, m_default_args) \
CONVERT_METHOD_CLASS(m_type_from, m_name, m_method); \
register_builtin_method<Method_##m_type_from##_##m_name>(m_arg_names, m_default_args);
@@ -1715,9 +1715,9 @@ StringName Variant::get_enum_for_enumeration(Variant::Type p_type, const StringN
#define bind_convert_methodv(m_type_from, m_type_to, m_name, m_method, m_arg_names, m_default_args) \
CONVERT_METHOD_CLASS(m_type_from, m_name, m_method); \
register_builtin_method<Method_##m_type_from##_##m_name>(sarray(), m_default_args);
#endif
#endif // DEBUG_ENABLED
#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
#define bind_function(m_type, m_name, m_method, m_arg_names, m_default_args) \
FUNCTION_CLASS(m_type, m_name, m_method, true); \
register_builtin_method<Method_##m_type##_##m_name>(m_arg_names, m_default_args);
@@ -1725,9 +1725,9 @@ StringName Variant::get_enum_for_enumeration(Variant::Type p_type, const StringN
#define bind_function(m_type, m_name, m_method, m_arg_names, m_default_args) \
FUNCTION_CLASS(m_type, m_name, m_method, true); \
register_builtin_method<Method_##m_type##_##m_name>(sarray(), m_default_args);
#endif
#endif // DEBUG_ENABLED
#ifdef DEBUG_METHODS_ENABLED
#ifdef DEBUG_ENABLED
#define bind_functionnc(m_type, m_name, m_method, m_arg_names, m_default_args) \
FUNCTION_CLASS(m_type, m_name, m_method, false); \
register_builtin_method<Method_##m_type##_##m_name>(m_arg_names, m_default_args);
@@ -1735,7 +1735,7 @@ StringName Variant::get_enum_for_enumeration(Variant::Type p_type, const StringN
#define bind_functionnc(m_type, m_name, m_method, m_arg_names, m_default_args) \
FUNCTION_CLASS(m_type, m_name, m_method, false); \
register_builtin_method<Method_##m_type##_##m_name>(sarray(), m_default_args);
#endif
#endif // DEBUG_ENABLED
#define bind_string_method(m_method, m_arg_names, m_default_args) \
bind_method(String, m_method, m_arg_names, m_default_args); \