Skip to content

Commit 8c29ef3

Browse files
dustdfgdalexeev
andcommitted
Add some comments to #endif's where it will easier life
Also added some new line to improve readability Signed-off-by: Yevhen Babiichuk (DustDFG) <[email protected]> Co-authored-by: Danil Alexeev <[email protected]>
1 parent 44fa552 commit 8c29ef3

File tree

6 files changed

+24
-20
lines changed

6 files changed

+24
-20
lines changed

modules/gdscript/gdscript.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2546,11 +2546,11 @@ void GDScriptLanguage::reload_all_scripts() {
25462546
}
25472547
}
25482548
}
2549-
#endif
2549+
#endif // TOOLS_ENABLED
25502550
}
25512551

25522552
reload_scripts(scripts, true);
2553-
#endif
2553+
#endif // DEBUG_ENABLED
25542554
}
25552555

25562556
void GDScriptLanguage::reload_scripts(const Array &p_scripts, bool p_soft_reload) {
@@ -2620,7 +2620,7 @@ void GDScriptLanguage::reload_scripts(const Array &p_scripts, bool p_soft_reload
26202620
}
26212621
}
26222622

2623-
#endif
2623+
#endif // TOOLS_ENABLED
26242624

26252625
for (const KeyValue<ObjectID, List<Pair<StringName, Variant>>> &F : scr->pending_reload_state) {
26262626
map[F.key] = F.value; //pending to reload, use this one instead
@@ -2688,7 +2688,7 @@ void GDScriptLanguage::reload_scripts(const Array &p_scripts, bool p_soft_reload
26882688
//if instance states were saved, set them!
26892689
}
26902690

2691-
#endif
2691+
#endif // DEBUG_ENABLED
26922692
}
26932693

26942694
void GDScriptLanguage::reload_tool_script(const Ref<Script> &p_script, bool p_soft_reload) {

modules/gdscript/gdscript_analyzer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5867,7 +5867,7 @@ void GDScriptAnalyzer::is_shadowing(GDScriptParser::IdentifierNode *p_identifier
58675867
parent = ClassDB::get_parent_class(parent);
58685868
}
58695869
}
5870-
#endif
5870+
#endif // DEBUG_ENABLED
58715871

58725872
GDScriptParser::DataType GDScriptAnalyzer::get_operation_type(Variant::Operator p_operation, const GDScriptParser::DataType &p_a, bool &r_valid, const GDScriptParser::Node *p_source) {
58735873
// Unary version.

modules/gdscript/gdscript_editor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3534,13 +3534,13 @@ ::Error GDScriptLanguage::complete_code(const String &p_code, const String &p_pa
35343534
return OK;
35353535
}
35363536

3537-
#else
3537+
#else // !TOOLS_ENABLED
35383538

35393539
Error GDScriptLanguage::complete_code(const String &p_code, const String &p_path, Object *p_owner, List<ScriptLanguage::CodeCompletionOption> *r_options, bool &r_forced, String &r_call_hint) {
35403540
return OK;
35413541
}
35423542

3543-
#endif
3543+
#endif // TOOLS_ENABLED
35443544

35453545
//////// END COMPLETION //////////
35463546

@@ -4125,4 +4125,4 @@ ::Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symb
41254125
return ERR_CANT_RESOLVE;
41264126
}
41274127

4128-
#endif
4128+
#endif // TOOLS_ENABLED

modules/gdscript/gdscript_parser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ void GDScriptParser::apply_pending_warnings() {
244244

245245
pending_warnings.clear();
246246
}
247-
#endif
247+
#endif // DEBUG_ENABLED
248248

249249
void GDScriptParser::override_completion_context(const Node *p_for_node, CompletionType p_type, Node *p_node, int p_argument) {
250250
if (!for_completion) {

modules/gdscript/gdscript_utility_functions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@
7474
return; \
7575
}
7676

77-
#else
77+
#else // !DEBUG_ENABLED
7878

7979
#define VALIDATE_ARG_COUNT(m_count)
8080
#define VALIDATE_ARG_INT(m_arg)
8181
#define VALIDATE_ARG_NUM(m_arg)
8282

83-
#endif
83+
#endif // DEBUG_ENABLED
8484

8585
struct GDScriptUtilityFunctionsDefinitions {
8686
#ifndef DISABLE_DEPRECATED

modules/gdscript/gdscript_vm.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -397,32 +397,36 @@ void (*type_init_function_table[])(Variant *) = {
397397
#define OPCODES_OUT \
398398
OPSOUT:
399399
#define OPCODE_SWITCH(m_test) goto *switch_table_ops[m_test];
400+
400401
#ifdef DEBUG_ENABLED
401402
#define DISPATCH_OPCODE \
402403
last_opcode = _code_ptr[ip]; \
403404
goto *switch_table_ops[last_opcode]
404-
#else
405+
#else // !DEBUG_ENABLED
405406
#define DISPATCH_OPCODE goto *switch_table_ops[_code_ptr[ip]]
406-
#endif
407+
#endif // DEBUG_ENABLED
408+
407409
#define OPCODE_BREAK goto OPSEXIT
408410
#define OPCODE_OUT goto OPSOUT
409-
#else
411+
#else // !(defined(__GNUC__) || defined(__clang__))
410412
#define OPCODES_TABLE
411413
#define OPCODE(m_op) case m_op:
412414
#define OPCODE_WHILE(m_test) while (m_test)
413415
#define OPCODES_END
414416
#define OPCODES_OUT
415417
#define DISPATCH_OPCODE continue
418+
416419
#ifdef _MSC_VER
417420
#define OPCODE_SWITCH(m_test) \
418421
__assume(m_test <= OPCODE_END); \
419422
switch (m_test)
420-
#else
423+
#else // !_MSC_VER
421424
#define OPCODE_SWITCH(m_test) switch (m_test)
422-
#endif
425+
#endif // _MSC_VER
426+
423427
#define OPCODE_BREAK break
424428
#define OPCODE_OUT break
425-
#endif
429+
#endif // defined(__GNUC__) || defined(__clang__)
426430

427431
// Helpers for VariantInternal methods in macros.
428432
#define OP_GET_BOOL get_bool
@@ -663,7 +667,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
663667
OPCODE_BREAK; \
664668
}
665669

666-
#else
670+
#else // !DEBUG_ENABLED
667671
#define GD_ERR_BREAK(m_cond)
668672
#define CHECK_SPACE(m_space)
669673

@@ -676,7 +680,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
676680
OPCODE_BREAK; \
677681
}
678682

679-
#endif
683+
#endif // DEBUG_ENABLED
680684

681685
#define LOAD_INSTRUCTION_ARGS \
682686
int instr_arg_count = _code_ptr[ip + 1]; \
@@ -1965,7 +1969,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
19651969
err_text = _get_call_error("function '" + methodstr + (is_callable ? "" : "' in base '" + basestr) + "'", (const Variant **)argptrs, temp_ret, err);
19661970
OPCODE_BREAK;
19671971
}
1968-
#endif
1972+
#endif // DEBUG_ENABLED
19691973

19701974
ip += 3;
19711975
}

0 commit comments

Comments
 (0)