From: Daan De Meyer Date: Mon, 28 Apr 2025 12:17:05 +0000 (+0200) Subject: clang-format: Add include sorting directives X-Git-Tag: v258-rc1~718^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5eaf4c1006a8b11fcb6fc3a4cd2990ca567afe22;p=thirdparty%2Fsystemd.git clang-format: Add include sorting directives Let's make sure clang-format sorts includes according to our style guide. --- diff --git a/.clang-format b/.clang-format index 5377abc23ee..5d1bdc52ab8 100644 --- a/.clang-format +++ b/.clang-format @@ -107,6 +107,27 @@ ForEachMacros: - STRV_FOREACH - STRV_FOREACH_BACKWARDS - STRV_FOREACH_PAIR +IncludeBlocks: Regroup +IncludeCategories: + # "vmlinux.h" must always be included first in BPF programs before anything else. + - Regex: '^"vmlinux.h"$' + Priority: 1 + # headers must be included after by design. + - Regex: '^$' + Priority: 2 + SortPriority: 3 + - Regex: '^<.*\.h>$' + Priority: 2 + - Regex: '^"_?sd-.*\.h"$' + Priority: 4 + - Regex: '^"libudev\.h"$' + Priority: 4 + - Regex: '^"audit_type-to-name.h"$' + Priority: 6 + - Regex: '.*' + Priority: 5 +# Make sure the "main header" is not treated any differently than other headers. +IncludeIsMainRegex: '^$' IndentPPDirectives: AfterHash IndentWidth: 8 IndentWrappedFunctionNames: true