lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20250210-clang-format-fixes-v2-2-37894413bbee@collabora.com>
Date: Thu, 10 Apr 2025 22:58:54 +0200
From: Michael Riesch via B4 Relay <devnull+michael.riesch.collabora.com@...nel.org>
To: Miguel Ojeda <ojeda@...nel.org>, Nathan Chancellor <nathan@...nel.org>, 
 Bill Wendling <morbo@...gle.com>, Justin Stitt <justinstitt@...gle.com>, 
 Nick Desaulniers <nick.desaulniers+lkml@...il.com>
Cc: Collabora Kernel Team <kernel@...labora.com>, 
 linux-kernel@...r.kernel.org, llvm@...ts.linux.dev, 
 Michael Riesch <michael.riesch@...fvision.net>, 
 Michael Riesch <michael.riesch@...labora.com>
Subject: [PATCH v2 2/2] clang-format: align consecutive macros

From: Michael Riesch <michael.riesch@...fvision.net>

clang-format 9 introduced the option "AlignConsecutiveMacros".
Set it to "AcrossEmptyLinesAndComments" in order to avoid macro
definitions of the form:

    #define MAGIC_REGISTER_1 0x42
    #define MAGIC_REGISTER_BIT_FLIP BIT(2)
    /* important comment */
    #define MAGIC_REGISTER_BIT_ENABLE BIT(12)

    #define MAGIC_REGISTER_2 0x43

With the option set to "AcrossEmptyLinesAndComments", they will
be converted to

    #define MAGIC_REGISTER_1	      0x42
    #define MAGIC_REGISTER_BIT_FLIP   BIT(2)
    /* important comment */
    #define MAGIC_REGISTER_BIT_ENABLE BIT(12)

    #define MAGIC_REGISTER_2	      0x43

which seems to be the convention in the kernel code base.

Signed-off-by: Michael Riesch <michael.riesch@...fvision.net>
Reviewed-by: Nathan Chancellor <nathan@...nel.org>
Signed-off-by: Michael Riesch <michael.riesch@...labora.com>
---
 .clang-format | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.clang-format b/.clang-format
index 8040b516185b..30d09cb88170 100644
--- a/.clang-format
+++ b/.clang-format
@@ -13,6 +13,7 @@ AccessModifierOffset: -4
 AlignAfterOpenBracket: Align
 AlignConsecutiveAssignments: false
 AlignConsecutiveDeclarations: false
+AlignConsecutiveMacros: AcrossEmptyLinesAndComments
 AlignEscapedNewlines: Left
 AlignOperands: true
 AlignTrailingComments: false

-- 
2.39.5



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ