FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

clang-format: indent preprocessor directives after hash · gitgitgadget/git@e3ea432 · GitHub

forked from git/git

Commit e3ea432

Browse files
authored andcommitted
clang-format: indent preprocessor directives after hash
We do not have a rule around the indentation of preprocessor directives. This was also discussed on the list [1], noting how there is often inconsistency in the styling. While there was discussion, there was no conclusion around what is the preferred style here. One style being indenting after the hash: #if FOO # if BAR # include <foo> # endif #endif The other being before the hash: #if FOO #if BAR #include <foo> #endif #endif Let's pick the former and add 'IndentPPDirectives: AfterHash' value to our '.clang-format'. There is no clear reason to pick one over the other, but it would definitely be nicer to be consistent. [1]: https://lore.kernel.org/r/xmqqwmmm1bw6.fsf@gitster.g Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 557ae14 commit e3ea432

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎.clang-format‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ BreakStringLiterals: false
9696
# Switch statement body is always indented one level more than case labels.
9797
IndentCaseLabels: false
9898

99+
# Indents directives before the hash.
100+
# #if FOO
101+
# # include <foo>
102+
# #endif
103+
IndentPPDirectives: AfterHash
104+
99105
# Don't indent a function definition or declaration if it is wrapped after the
100106
# type
101107
IndentWrappedFunctionNames: false

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL