Skip to content

Commit 2bf7ac7

Browse files
committed
Merge pull request #106456 from Repiteo/style/remove-DEBUG_METHODS_ENABLED
Style: Remove redundant `DEBUG_METHODS_ENABLED` macro
2 parents 3cfe5f9 + d237e31 commit 2bf7ac7

25 files changed

+328
-337
lines changed

core/config/project_settings.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,18 +232,18 @@ void ProjectSettings::set_as_internal(const String &p_name, bool p_internal) {
232232

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

240240
bool ProjectSettings::get_ignore_value_in_docs(const String &p_name) const {
241241
ERR_FAIL_COND_V_MSG(!props.has(p_name), false, vformat("Request for nonexistent project setting: '%s'.", p_name));
242-
#ifdef DEBUG_METHODS_ENABLED
242+
#ifdef DEBUG_ENABLED
243243
return props[p_name].ignore_value_in_docs;
244244
#else
245245
return false;
246-
#endif
246+
#endif // DEBUG_ENABLED
247247
}
248248

249249
void ProjectSettings::add_hidden_prefix(const String &p_prefix) {

core/config/project_settings.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ class ProjectSettings : public Object {
7474
Variant initial;
7575
bool hide_from_editor = false;
7676
bool restart_if_changed = false;
77-
#ifdef DEBUG_METHODS_ENABLED
77+
#ifdef DEBUG_ENABLED
7878
bool ignore_value_in_docs = false;
79-
#endif
79+
#endif // DEBUG_ENABLED
8080

8181
VariantContainer() {}
8282

core/core_bind.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ bool OS::is_debug_build() const {
661661
return true;
662662
#else
663663
return false;
664-
#endif
664+
#endif // DEBUG_ENABLED
665665
}
666666

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

16711671
for (const MethodInfo &E : methods) {
1672-
#ifdef DEBUG_METHODS_ENABLED
1672+
#ifdef DEBUG_ENABLED
16731673
ret.push_back(E.operator Dictionary());
16741674
#else
16751675
Dictionary dict;
16761676
dict["name"] = E.name;
16771677
ret.push_back(dict);
1678-
#endif
1678+
#endif // DEBUG_ENABLED
16791679
}
16801680

16811681
return ret;

core/core_constants.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,17 @@
3636
#include "core/variant/variant.h"
3737

3838
struct _CoreConstant {
39-
#ifdef DEBUG_METHODS_ENABLED
39+
#ifdef DEBUG_ENABLED
4040
bool ignore_value_in_docs = false;
4141
bool is_bitfield = false;
42-
#endif
42+
#endif // DEBUG_ENABLED
4343
StringName enum_name;
4444
const char *name = nullptr;
4545
int64_t value = 0;
4646

4747
_CoreConstant() {}
4848

49-
#ifdef DEBUG_METHODS_ENABLED
49+
#ifdef DEBUG_ENABLED
5050
_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) :
5151
ignore_value_in_docs(p_ignore_value_in_docs),
5252
is_bitfield(p_is_bitfield),
@@ -60,14 +60,14 @@ struct _CoreConstant {
6060
name(p_name),
6161
value(p_value) {
6262
}
63-
#endif
63+
#endif // DEBUG_ENABLED
6464
};
6565

6666
static Vector<_CoreConstant> _global_constants;
6767
static HashMap<StringName, int> _global_constants_map;
6868
static HashMap<StringName, Vector<_CoreConstant>> _global_enums;
6969

70-
#ifdef DEBUG_METHODS_ENABLED
70+
#ifdef DEBUG_ENABLED
7171

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

252-
#endif
252+
#endif // DEBUG_ENABLED
253253

254254
void register_global_constants() {
255255
BIND_CORE_ENUM_CONSTANT(SIDE_LEFT);
@@ -816,7 +816,7 @@ StringName CoreConstants::get_global_constant_enum(int p_idx) {
816816
return _global_constants[p_idx].enum_name;
817817
}
818818

819-
#ifdef DEBUG_METHODS_ENABLED
819+
#ifdef DEBUG_ENABLED
820820
bool CoreConstants::is_global_constant_bitfield(int p_idx) {
821821
return _global_constants[p_idx].is_bitfield;
822822
}
@@ -832,7 +832,7 @@ bool CoreConstants::is_global_constant_bitfield(int p_idx) {
832832
bool CoreConstants::get_ignore_value_in_docs(int p_idx) {
833833
return false;
834834
}
835-
#endif
835+
#endif // DEBUG_ENABLED
836836

837837
const char *CoreConstants::get_global_constant_name(int p_idx) {
838838
return _global_constants[p_idx].name;

core/extension/gdextension.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,15 @@ class GDExtensionMethodBind : public MethodBind {
8787
virtual bool is_valid() const override { return valid; }
8888
#endif
8989

90-
#ifdef DEBUG_METHODS_ENABLED
90+
#ifdef DEBUG_ENABLED
9191
virtual GodotTypeInfo::Metadata get_argument_meta(int p_arg) const override {
9292
if (p_arg < 0) {
9393
return return_value_metadata;
9494
} else {
9595
return arguments_metadata.get(p_arg);
9696
}
9797
}
98-
#endif
98+
#endif // DEBUG_ENABLED
9999

100100
virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) const override {
101101
#ifdef TOOLS_ENABLED
@@ -219,9 +219,9 @@ class GDExtensionMethodBind : public MethodBind {
219219
_set_returns(p_method_info->has_return_value);
220220
_set_const(p_method_info->method_flags & GDEXTENSION_METHOD_FLAG_CONST);
221221
_set_static(p_method_info->method_flags & GDEXTENSION_METHOD_FLAG_STATIC);
222-
#ifdef DEBUG_METHODS_ENABLED
222+
#ifdef DEBUG_ENABLED
223223
_generate_argument_types(p_method_info->argument_count);
224-
#endif
224+
#endif // DEBUG_ENABLED
225225
set_argument_count(p_method_info->argument_count);
226226

227227
Vector<Variant> defargs;

core/object/callable_method_pointer.h

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ class CallableCustomMethodPointerBase : public CallableCustom {
4040
uint32_t *comp_ptr = nullptr;
4141
uint32_t comp_size;
4242
uint32_t h;
43-
#ifdef DEBUG_METHODS_ENABLED
43+
#ifdef DEBUG_ENABLED
4444
const char *text = "";
45-
#endif
45+
#endif // DEBUG_ENABLED
4646
static bool compare_equal(const CallableCustom *p_a, const CallableCustom *p_b);
4747
static bool compare_less(const CallableCustom *p_a, const CallableCustom *p_b);
4848

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

5252
public:
5353
virtual StringName get_method() const {
54-
#ifdef DEBUG_METHODS_ENABLED
54+
#ifdef DEBUG_ENABLED
5555
return StringName(text);
5656
#else
5757
return StringName();
58-
#endif
58+
#endif // DEBUG_ENABLED
5959
}
6060

61-
#ifdef DEBUG_METHODS_ENABLED
61+
#ifdef DEBUG_ENABLED
6262
void set_text(const char *p_text) {
6363
text = p_text;
6464
}
@@ -69,7 +69,7 @@ class CallableCustomMethodPointerBase : public CallableCustom {
6969
virtual String get_as_text() const {
7070
return String();
7171
}
72-
#endif
72+
#endif // DEBUG_ENABLED
7373
virtual CompareEqualFunc get_compare_equal_func() const;
7474
virtual CompareLessFunc get_compare_less_func() const;
7575

@@ -117,29 +117,29 @@ class CallableCustomMethodPointer : public CallableCustomMethodPointerBase {
117117

118118
template <typename T, typename... P>
119119
Callable create_custom_callable_function_pointer(T *p_instance,
120-
#ifdef DEBUG_METHODS_ENABLED
120+
#ifdef DEBUG_ENABLED
121121
const char *p_func_text,
122-
#endif
122+
#endif // DEBUG_ENABLED
123123
void (T::*p_method)(P...)) {
124124
typedef CallableCustomMethodPointer<T, void, P...> CCMP; // Messes with memnew otherwise.
125125
CCMP *ccmp = memnew(CCMP(p_instance, p_method));
126-
#ifdef DEBUG_METHODS_ENABLED
126+
#ifdef DEBUG_ENABLED
127127
ccmp->set_text(p_func_text + 1); // Try to get rid of the ampersand.
128-
#endif
128+
#endif // DEBUG_ENABLED
129129
return Callable(ccmp);
130130
}
131131

132132
template <typename T, typename R, typename... P>
133133
Callable create_custom_callable_function_pointer(T *p_instance,
134-
#ifdef DEBUG_METHODS_ENABLED
134+
#ifdef DEBUG_ENABLED
135135
const char *p_func_text,
136-
#endif
136+
#endif // DEBUG_ENABLED
137137
R (T::*p_method)(P...)) {
138138
typedef CallableCustomMethodPointer<T, R, P...> CCMP; // Messes with memnew otherwise.
139139
CCMP *ccmp = memnew(CCMP(p_instance, p_method));
140-
#ifdef DEBUG_METHODS_ENABLED
140+
#ifdef DEBUG_ENABLED
141141
ccmp->set_text(p_func_text + 1); // Try to get rid of the ampersand.
142-
#endif
142+
#endif // DEBUG_ENABLED
143143
return Callable(ccmp);
144144
}
145145

@@ -186,37 +186,37 @@ class CallableCustomMethodPointerC : public CallableCustomMethodPointerBase {
186186

187187
template <typename T, typename... P>
188188
Callable create_custom_callable_function_pointer(T *p_instance,
189-
#ifdef DEBUG_METHODS_ENABLED
189+
#ifdef DEBUG_ENABLED
190190
const char *p_func_text,
191-
#endif
191+
#endif // DEBUG_ENABLED
192192
void (T::*p_method)(P...) const) {
193193
typedef CallableCustomMethodPointerC<T, void, P...> CCMP; // Messes with memnew otherwise.
194194
CCMP *ccmp = memnew(CCMP(p_instance, p_method));
195-
#ifdef DEBUG_METHODS_ENABLED
195+
#ifdef DEBUG_ENABLED
196196
ccmp->set_text(p_func_text + 1); // Try to get rid of the ampersand.
197-
#endif
197+
#endif // DEBUG_ENABLED
198198
return Callable(ccmp);
199199
}
200200

201201
template <typename T, typename R, typename... P>
202202
Callable create_custom_callable_function_pointer(T *p_instance,
203-
#ifdef DEBUG_METHODS_ENABLED
203+
#ifdef DEBUG_ENABLED
204204
const char *p_func_text,
205205
#endif
206206
R (T::*p_method)(P...) const) {
207207
typedef CallableCustomMethodPointerC<T, R, P...> CCMP; // Messes with memnew otherwise.
208208
CCMP *ccmp = memnew(CCMP(p_instance, p_method));
209-
#ifdef DEBUG_METHODS_ENABLED
209+
#ifdef DEBUG_ENABLED
210210
ccmp->set_text(p_func_text + 1); // Try to get rid of the ampersand.
211-
#endif
211+
#endif // DEBUG_ENABLED
212212
return Callable(ccmp);
213213
}
214214

215-
#ifdef DEBUG_METHODS_ENABLED
215+
#ifdef DEBUG_ENABLED
216216
#define callable_mp(I, M) create_custom_callable_function_pointer(I, #M, M)
217217
#else
218218
#define callable_mp(I, M) create_custom_callable_function_pointer(I, M)
219-
#endif
219+
#endif // DEBUG_ENABLED
220220

221221
// STATIC VERSIONS
222222

@@ -257,33 +257,33 @@ class CallableCustomStaticMethodPointer : public CallableCustomMethodPointerBase
257257

258258
template <typename... P>
259259
Callable create_custom_callable_static_function_pointer(
260-
#ifdef DEBUG_METHODS_ENABLED
260+
#ifdef DEBUG_ENABLED
261261
const char *p_func_text,
262-
#endif
262+
#endif // DEBUG_ENABLED
263263
void (*p_method)(P...)) {
264264
typedef CallableCustomStaticMethodPointer<void, P...> CCMP; // Messes with memnew otherwise.
265265
CCMP *ccmp = memnew(CCMP(p_method));
266-
#ifdef DEBUG_METHODS_ENABLED
266+
#ifdef DEBUG_ENABLED
267267
ccmp->set_text(p_func_text + 1); // Try to get rid of the ampersand.
268-
#endif
268+
#endif // DEBUG_ENABLED
269269
return Callable(ccmp);
270270
}
271271

272272
template <typename R, typename... P>
273273
Callable create_custom_callable_static_function_pointer(
274-
#ifdef DEBUG_METHODS_ENABLED
274+
#ifdef DEBUG_ENABLED
275275
const char *p_func_text,
276-
#endif
276+
#endif // DEBUG_ENABLED
277277
R (*p_method)(P...)) {
278278
typedef CallableCustomStaticMethodPointer<R, P...> CCMP; // Messes with memnew otherwise.
279279
CCMP *ccmp = memnew(CCMP(p_method));
280-
#ifdef DEBUG_METHODS_ENABLED
280+
#ifdef DEBUG_ENABLED
281281
ccmp->set_text(p_func_text + 1); // Try to get rid of the ampersand.
282-
#endif
282+
#endif // DEBUG_ENABLED
283283
return Callable(ccmp);
284284
}
285285

286-
#ifdef DEBUG_METHODS_ENABLED
286+
#ifdef DEBUG_ENABLED
287287
#define callable_mp_static(M) create_custom_callable_static_function_pointer(#M, M)
288288
#else
289289
#define callable_mp_static(M) create_custom_callable_static_function_pointer(M)

0 commit comments

Comments
 (0)