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. --- platform/osx/display_server_osx.mm | 5 ----- 1 file changed, 5 deletions(-) (limited to 'platform/osx/display_server_osx.mm') diff --git a/platform/osx/display_server_osx.mm b/platform/osx/display_server_osx.mm index 71e4584dac..46ddc23d8a 100644 --- a/platform/osx/display_server_osx.mm +++ b/platform/osx/display_server_osx.mm @@ -921,7 +921,6 @@ static void _mouseDownEvent(DisplayServer::WindowID window_id, NSEvent *event, i } static bool isNumpadKey(unsigned int key) { - static const unsigned int table[] = { 0x41, /* kVK_ANSI_KeypadDecimal */ 0x43, /* kVK_ANSI_KeypadMultiply */ @@ -954,7 +953,6 @@ static bool isNumpadKey(unsigned int key) { // Translates a OS X keycode to a Godot keycode // static int translateKey(unsigned int key) { - // Keyboard symbol translation table static const unsigned int table[128] = { /* 00 */ KEY_A, @@ -3011,7 +3009,6 @@ DisplayServerOSX::LatinKeyboardVariant DisplayServerOSX::get_latin_keyboard_vari static LatinKeyboardVariant layout = LATIN_KEYBOARD_QWERTY; if (keyboard_layout_dirty) { - layout = LATIN_KEYBOARD_QWERTY; CGKeyCode keys[] = { kVK_ANSI_Q, kVK_ANSI_W, kVK_ANSI_E, kVK_ANSI_R, kVK_ANSI_T, kVK_ANSI_Y }; @@ -3553,7 +3550,6 @@ DisplayServerOSX::DisplayServerOSX(const String &p_rendering_driver, WindowMode #endif #if defined(VULKAN_ENABLED) if (rendering_driver == "vulkan") { - context_vulkan = memnew(VulkanContextOSX); if (context_vulkan->initialize() != OK) { memdelete(context_vulkan); @@ -3613,7 +3609,6 @@ DisplayServerOSX::~DisplayServerOSX() { //destroy drivers #if defined(VULKAN_ENABLED) if (rendering_driver == "vulkan") { - if (rendering_device_vulkan) { rendering_device_vulkan->finalize(); memdelete(rendering_device_vulkan); -- cgit v1.2.3 From 07bc4e2f96f8f47991339654ff4ab16acc19d44f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 14 May 2020 14:29:06 +0200 Subject: Style: Enforce separation line between function definitions I couldn't find a tool that enforces it, so I went the manual route: ``` find -name "thirdparty" -prune \ -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \ -o -name "*.glsl" > files perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files) misc/scripts/fix_style.sh -c ``` This adds a newline after all `}` on the first column, unless they are followed by `#` (typically `#endif`). This leads to having lots of places with two lines between function/class definitions, but clang-format then fixes it as we enforce max one line of separation. This doesn't fix potential occurrences of function definitions which are indented (e.g. for a helper class defined in a .cpp), but it's better than nothing. Also can't be made to run easily on CI/hooks so we'll have to be careful with new code. Part of #33027. --- platform/osx/display_server_osx.mm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'platform/osx/display_server_osx.mm') diff --git a/platform/osx/display_server_osx.mm b/platform/osx/display_server_osx.mm index 46ddc23d8a..1cdcdbcaf5 100644 --- a/platform/osx/display_server_osx.mm +++ b/platform/osx/display_server_osx.mm @@ -149,6 +149,7 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) { Variant meta; bool checkable; } + @end @implementation GlobalMenuItem @@ -1422,6 +1423,7 @@ inline void sendPanEvent(DisplayServer::WindowID window_id, double dx, double dy @interface GodotWindow : NSWindow { } + @end @implementation GodotWindow -- cgit v1.2.3