Hi @tech,

Currently the prevailing style in the kernel seems to have identifiers
(minus
their pointers) aligned. style(9) however indicates that the first
qualifiers
should be aligned. This patch fixes the style guide to match the predominant
style. I tried to give it a bit more of an OpenBSD flavor :) I also have a
.clang-format file that very carefully fits the style guide as such,
however a
bug in clang-format that's fixed in clang 13 prevents it from being much
use,
but I can submit it nonetheless!

Best Regards,
Charlie Burnett

Index: style.9
===================================================================
RCS file: /cvs/src/share/man/man9/style.9,v
retrieving revision 1.77
diff -u -p -r1.77 style.9
--- style.9 22 Jan 2021 14:13:57 -0000 1.77
+++ style.9 1 Jul 2021 04:39:25 -0000
@@ -202,13 +202,18 @@ Major structures should be declared at t
 are used, or in separate header files if they are used in multiple
 source files.
 Use of the structures should be by separate declarations and should be
-.Dq Li extern
-if they are declared in a header file.
+.Dq Li extern
+if they are declared in a header file. Consecutive declarations should be
+formatted such that the column of the rightmost character in the
Consecutive
+declarations should be formatted such that the furthest left character of
the
+identifier (pointers and references included) is at least one space away
from
+the furthest right qualifier.
 .Bd -literal -offset indent
-struct foo {
- struct foo *next; /* List of active foo */
- struct mumble amumble; /* Comment for mumble */
- int bar;
+struct humppa {
+ struct song  *next; /* Pointer to the next song */
+ struct band   band_info; /* Comment for author */
+ const char  **lyrics; /* Array of song lines */
+ int      nlines;
 };
 struct foo *foohead; /* Head of global foo list */
 .Ed

Reply via email to