Skip to content
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]: Feature Request: AlignConsecutiveDeclarations option to ignore function prototypes #74320

Closed
bradh352 opened this issue Dec 4, 2023 · 2 comments · Fixed by #108241
Labels
clang-format enhancement Improving things as opposed to bug fixing, e.g. new or missing feature

Comments

@bradh352
Copy link
Contributor

bradh352 commented Dec 4, 2023

We recently started using clang-format in the c-ares project: https://github.com/c-ares/c-ares/blob/main/.clang-format

We have "AlignConsecutiveDeclarations" enabled, which yields nicely formatted variable declarations. However, since we have a coding style requirement of 80 columns, function prototype alignment actually appears to cause more harm than good from a readability standpoint. Due to the line limit restrictions, the formatting is inconsistent at best, aligning some parameter members and not others.

Our feature request would be a flag to disable function prototypes from this alignment option.

@EugeneZelenko EugeneZelenko added the enhancement Improving things as opposed to bug fixing, e.g. new or missing feature label Dec 4, 2023
@huiskes
Copy link

huiskes commented Feb 2, 2024

I would like to second this request. Based on the documentation you would also not expect the alignment of function parameter declarations in the first place.

@bradh352
Copy link
Contributor Author

just checking in on this request :)

owenca pushed a commit that referenced this issue Oct 7, 2024
…rations (#108241)

Enabling AlignConsecutiveDeclarations also aligns function prototypes
or declarations.  This is often unexpected as typically function
prototypes, especially in public headers, don't use any padding.

Setting AlignFunctionDeclarations to false will skip this alignment.
It is by default set to true to keep compatibility with prior
versions to not make unexpected changes.

Fixes #74320
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang-format enhancement Improving things as opposed to bug fixing, e.g. new or missing feature
Projects
None yet
3 participants