-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CI: Update clang-format
pre-commit hook to latest version
#93313
Conversation
Decided to expand the scope of this PR slightly to include that aforementioned semicolon fix, as there was fairly significant overlap between the files that would've been affected. |
Upgrading clang-format version might affect various workflows so I think it's something to take a deep look into, I think we shouldn't just focus on the hook but manual use and different possible targets and OSs running it as well |
Hmm, that's a fair point. I'll go back to my original idea and make the semicolon fix separate so this can focus on clang-format instead. |
I think doing that separately might be good, though it is a bit of a sweeping change but with blame ignoring it won't create noise so I think it's worth it (though it might create some annoying conflicts) |
I believe some form of update should happen regardless to clang-format, as right now the live hook version ( |
• Modernized `.clang-format` file against latest LLVM config settings
8d2b2bc
to
beca879
Compare
editor/gui/editor_title_bar.h
Outdated
@@ -43,7 +43,7 @@ class EditorTitleBar : public HBoxContainer { | |||
|
|||
protected: | |||
virtual void gui_input(const Ref<InputEvent> &p_event) override; | |||
static void _bind_methods(){}; | |||
static void _bind_methods() {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove these empty _bind_methods
? What's the point of overriding the virtual method to do nothing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Post from the past, seems like I had forgotten to send my review...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ehh, I'll leave it be; I'd rather keep all the changes strictly stylistic.
} | ||
material; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had missed that one in my own PR, but that's another new clang-format bug :\
It's always been hit and miss on our custom glsl with bits of invalid syntax we replace at compile time.
I think we've accepted to just live with it, though I wonder why this is now changing when it didn't before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One option if we don't want this to happen is to just disable clang-format around this layout definition:
diff --git a/servers/rendering/renderer_rd/shaders/canvas.glsl b/servers/rendering/renderer_rd/shaders/canvas.glsl
index e64dd17072..fb813c5ab2 100644
--- a/servers/rendering/renderer_rd/shaders/canvas.glsl
+++ b/servers/rendering/renderer_rd/shaders/canvas.glsl
@@ -41,10 +41,13 @@ layout(location = 3) out vec2 pixel_size_interp;
#endif
#ifdef MATERIAL_UNIFORMS_USED
+/* clang-format off */
layout(set = 1, binding = 0, std140) uniform MaterialUniforms {
+
#MATERIAL_UNIFORMS
-}
-material;
+
+} material;
+/* clang-format on */
#endif
#GLOBALS
We already do that in a number of places in .glsl shaders, e.g. in drivers/gles3/shaders/scene.glsl
:
/* clang-format off */
layout(std140) uniform MaterialUniforms { // ubo:3
#MATERIAL_UNIFORMS
};
/* clang-format on */
CC @clayjohn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll disable clang-format for those blocks. Really wish there was a way to ignore single lines like clang-tidy…
96a69d4
to
8389681
Compare
8389681
to
e90c5a4
Compare
Thanks! |
Accompanies #93271
Updates clang-format to the latest available version: 18.1.6. This will largely sync the hook with what is used in IDEs, as those tend to use the latest version when applicable. Additionally modernized the
.clang-format
file to sync with llvm's settings on the latest version. All uncommented rules remain as they were in the prior version, with the only difference being replacing the now-removedConstructorInitializerAllOnOneLineOrOnePerLine: true
with the modern equivalentPackConstructorInitializers: NextLine
.It seems some more default enforcements have been made since then, as well as general parsing improvements. As such, there's another commit applying clang-format across the repo (only whitespace changes) & excluding it in
.git-blame-ignore-revs
with a subsequent commit.