From 0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 14 May 2020 13:23:58 +0200 Subject: Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027. --- core/print_string.cpp | 9 --------- 1 file changed, 9 deletions(-) (limited to 'core/print_string.cpp') diff --git a/core/print_string.cpp b/core/print_string.cpp index 8eb1d9e86a..b7903b6880 100644 --- a/core/print_string.cpp +++ b/core/print_string.cpp @@ -39,7 +39,6 @@ bool _print_line_enabled = true; bool _print_error_enabled = true; void add_print_handler(PrintHandlerList *p_handler) { - _global_lock(); p_handler->next = print_handler_list; print_handler_list = p_handler; @@ -47,16 +46,13 @@ void add_print_handler(PrintHandlerList *p_handler) { } void remove_print_handler(PrintHandlerList *p_handler) { - _global_lock(); PrintHandlerList *prev = nullptr; PrintHandlerList *l = print_handler_list; while (l) { - if (l == p_handler) { - if (prev) prev->next = l->next; else @@ -73,7 +69,6 @@ void remove_print_handler(PrintHandlerList *p_handler) { } void print_line(String p_string) { - if (!_print_line_enabled) return; @@ -82,7 +77,6 @@ void print_line(String p_string) { _global_lock(); PrintHandlerList *l = print_handler_list; while (l) { - l->printfunc(l->userdata, p_string, false); l = l->next; } @@ -91,7 +85,6 @@ void print_line(String p_string) { } void print_error(String p_string) { - if (!_print_error_enabled) return; @@ -100,7 +93,6 @@ void print_error(String p_string) { _global_lock(); PrintHandlerList *l = print_handler_list; while (l) { - l->printfunc(l->userdata, p_string, true); l = l->next; } @@ -109,7 +101,6 @@ void print_error(String p_string) { } void print_verbose(String p_string) { - if (OS::get_singleton()->is_stdout_verbose()) { print_line(p_string); } -- cgit v1.2.3 From 0ee0fa42e6639b6fa474b7cf6afc6b1a78142185 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 14 May 2020 16:41:43 +0200 Subject: Style: Enforce braces around if blocks and loops Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html --- core/print_string.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'core/print_string.cpp') diff --git a/core/print_string.cpp b/core/print_string.cpp index b7903b6880..54de229471 100644 --- a/core/print_string.cpp +++ b/core/print_string.cpp @@ -53,10 +53,11 @@ void remove_print_handler(PrintHandlerList *p_handler) { while (l) { if (l == p_handler) { - if (prev) + if (prev) { prev->next = l->next; - else + } else { print_handler_list = l->next; + } break; } prev = l; @@ -69,8 +70,9 @@ void remove_print_handler(PrintHandlerList *p_handler) { } void print_line(String p_string) { - if (!_print_line_enabled) + if (!_print_line_enabled) { return; + } OS::get_singleton()->print("%s\n", p_string.utf8().get_data()); @@ -85,8 +87,9 @@ void print_line(String p_string) { } void print_error(String p_string) { - if (!_print_error_enabled) + if (!_print_error_enabled) { return; + } OS::get_singleton()->printerr("%s\n", p_string.utf8().get_data()); -- cgit v1.2.3