Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Update code style clang format - #7330

Open
gassmoeller wants to merge 3 commits into
geodynamics:mainfrom
gassmoeller:update_code_style_clang_format
Open

Update code style clang format#7330
gassmoeller wants to merge 3 commits into
geodynamics:mainfrom
gassmoeller:update_code_style_clang_format

Conversation

@gassmoeller

Copy link
Copy Markdown
Member

This is the alternative to #7326 using clang-format instead.

I adjusted the deal.II .clang-format slightly to reduce the amount of changes to ASPECTs source code, but a few unintentional changes remain:

  • function specifiers and return types (virtual double) will now always be put on the same line. The necessary config option to keep our current style is only available from clang-format 23 onwards (BreakBeforeReturnType).

  • some of our macros in the interface.h files are reformatted quite a bit, I dont think the new style is particularly better or worse, just different

  • clang-format is a bit more zealous in breaking parameters across lines (see e.g. parameters.cc). I actually like the new style more, but it is quite a lot of code change for little gain.

Downloading clang-format was very simple using deal.II's script, so this may be an even simpler workflow than installing astyle via candi (and it makes installing ASPECT slightly simpler). Also we could benefit from deal.II's infrastructure. I saw that deal.II installs the indent.py script, so maybe we can just use that instead of including it again in ASPECT.

This PR will need a bit more cleanup of integrating clang-format into our cmake system and removing astyle, but I would like to come to a decision which style we like more before finalizing either this or #7326. We could also decide we are happy with the current style of astyle 2.04, I dont want to force this if it is not better.

Personally I tend towards the clang-format solution, mostly to keep things as similar to deal.II as possible, but I also admit there is no pressing reason that we absolutely have to do this right now. Opinions?

@gassmoeller gassmoeller mentioned this pull request Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant