Skip to content

Commit 3957267

Browse files
pks-tgitster
authored andcommitted
clang-format: fix indentation width for preprocessor directives
In [1], we have improved our clang-format configuration to also specify the style for how to indent preprocessor directives. But while we have settled the question of where to put the indentation, either before or after the hash sign, we didn't specify exactly how to indent. With the current configuration, clang-format uses tabs to indent each level of nested preprocessor directives, which is in fact unintentional and never done in our codebase. Instead, we use a mixture of indenting by either one or two spaces, where using a single space is somewhat more common. Adapt our clang-format configuration accordingly by specifying an indentation width of one space. [1]: <[email protected]> Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b4e8a8c commit 3957267

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

.clang-format

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,13 @@ BreakStringLiterals: false
100100
# Switch statement body is always indented one level more than case labels.
101101
IndentCaseLabels: false
102102

103-
# Indents directives before the hash.
103+
# Indents directives before the hash. Each level uses a single space for
104+
# indentation.
104105
# #if FOO
105-
# # include <foo>
106+
# # include <foo>
106107
# #endif
107108
IndentPPDirectives: AfterHash
109+
PPIndentWidth: 1
108110

109111
# Don't indent a function definition or declaration if it is wrapped after the
110112
# type

0 commit comments

Comments
 (0)