Mailing List Archive

[xen master] CODING_STYLE: list further brace placement exceptions
commit e9a78d2dc2343321f7e8b55bcbb16405b0d40cfe
Author: Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Dec 5 13:40:43 2022 +0100
Commit: Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 5 13:40:43 2022 +0100

CODING_STYLE: list further brace placement exceptions

For easy spotting of struct/union/enum definitions we already commonly
place the opening braces on the initial line of such a definition.

We also often don't place the opening brace of an initializer on a
separate line.

And finally for compound literals placing the braces on separate lines
often makes the code more difficult to read, so it should (and in
practice does) typically go on the same line as well. The placement of
the closing brace often depends on how large such a compound literal is.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
CODING_STYLE | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/CODING_STYLE b/CODING_STYLE
index 7d75debcbf..ced3ade5a6 100644
--- a/CODING_STYLE
+++ b/CODING_STYLE
@@ -80,8 +80,13 @@ Bracing
-------

Braces ('{' and '}') are usually placed on a line of their own, except
-for the do/while loop. This is unlike the Linux coding style and
-unlike K&R. do/while loops are an exception. e.g.:
+for
+- the do/while loop
+- the opening brace in definitions of enum, struct, and union
+- the opening brace in initializers
+- compound literals
+This is unlike the Linux coding style and unlike K&R. do/while loops
+are one exception. e.g.:

if ( condition )
{
--
generated by git-patchbot for /home/xen/git/xen.git#master