AlignAfterOpenBracket/BinPack*: multi-parameter breaks for N>1 (template, function param, init lists, etc.) do not support 1-element-per-line; closing bracket on newline missing (H)
NamespaceIndentation: Inner is not exactly what we do (+)
double-newline after include blocks is not enforced, but MaxEmptyLinesToKeep: 2 keeps it
can not enforce empty newlines between function/class, etc. blocks: SO
IndentPPDirectives: Hash: works but does not count the hash as space (+)
Draft of a
.clang-format
rule for our projects, based onclang-format 6.0+
.CC @psychocoderHPC, @C0nsultant, @BenjaminW3 https://github.com/ComputationalRadiationPhysics/alpaka/issues/419
Most Important Limitations
AlignAfterOpenBracket/BinPack*
: multi-parameter breaks for N>1 (template, function param, init lists, etc.) do not support 1-element-per-line; closing bracket on newline missing (H)NamespaceIndentation: Inner
is not exactly what we do (+)MaxEmptyLinesToKeep: 2
keeps itIndentPPDirectives: Hash
: works but does not count the hash as space (+)desc.add_options()()()...
syntax inboost::program_options
looks weird - but we should switch to, e.g. CL11 anyway: https://github.com/ComputationalRadiationPhysics/picongpu/issues/2421(H) probably some work to add & upstream but quite central in our style (+) easy to add, maybe something to upstream?
Misc Notes
the
IncludeCategories:
block is project specific, example is shown for PIConGPUonline tool: https://zed0.co.uk/clang-format-configurator/ (currently not up-to-date with clang 6.0: https://github.com/zed0/clang-format-configurator/issues/15)
references: https://clang.llvm.org/docs/ClangFormat.html https://clang.llvm.org/docs/ClangFormatStyleOptions.html