-
Notifications
You must be signed in to change notification settings - Fork 151
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
clang-format 18 #1113
base: main
Are you sure you want to change the base?
clang-format 18 #1113
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1113 +/- ##
=======================================
Coverage 83.12% 83.12%
=======================================
Files 56 56
Lines 5754 5754
=======================================
Hits 4783 4783
Misses 971 971 ☔ View full report in Codecov by Sentry. |
/* clang-format off */ | ||
/* reenable formatting once we're all using 18.1.5+ */ | ||
|
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.
Having to do this across 20 different repos and any new code we write is going to be annoying. Can we look into getting 18.1.5 in CI? Some options that I can think of
- A docker image in builder and use that.
- Install clang-format from pip https://pypi.org/project/clang-format/.
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.
Interesting: You can use pipx to run clang-format, as well. For example, pipx run clang-format <args> will run clang-format without any previous install required on any machine with pipx (including all default GitHub Actions / Azure runners, avoiding requiring a pre-install step or even actions/setup-python).
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 already fixed up all the other repos on my machine. There's just one code pattern that's causing all these differences between 18.1.3 and 18.1.5. It's when we use a macro to init the fields of a structure. aws-c-common has way more instances of this than any other repo
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 look into the pip
thing...
Issue:
We used clang-format 9 since forever, but it's not easy for people to get such an old version anymore.
Description of Changes:
jidicula/clang-format-action
Github Action in CI, instead ofDoozyX/clang-format-lint-action
which doesn't support 18 yet-i
option toformat-check
script, to edit files inplacejidicula/clang-format-action
and by the VSCode C/C++ extension) and clang-format 18.1.5 (default in Homebrew on Mac). I turned off formatting for those bits where they disagree.Updating your Machine:
brew uninstall llvm@9
brew install clang-format
Research:
We want to update to the newest version that can easily be installed on the platforms/IDEs we develop on:
8
,11
,18
(default) via homebrew18
is available via VSCode extension11
only viayum install clang-tools-extra
15
only viadnf install clang-tools-extra
18
viaapt install clang-format
18
is bundled into theC/C++
extension, and it's what gets used if you don't haveclang-format
installed~/.vscode/extensions/ms-vscode.cpptools-1.20.5-darwin-x64/LLVM/bin/clang-format
.Since 18 is latest, and easily available on all platforms via the VSCode extension, let's use that.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.