Skip to content

Commit 2948f0c

Browse files
committed
CODING_STYLE: Define our preferred form for multiline comments
The codebase has a bit of a mix of different multiline comment styles. State a preference for the Linux kernel style: /* * Star on the left for each line. * Leading slash-star and trailing star-slash * each go on a line of their own. */ Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Alex Williamson <alex.williamson@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20180611141716.3813-1-peter.maydell@linaro.org
1 parent 2d54f19 commit 2948f0c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

CODING_STYLE

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,23 @@ We use traditional C-style /* */ comments and avoid // comments.
124124
Rationale: The // form is valid in C99, so this is purely a matter of
125125
consistency of style. The checkpatch script will warn you about this.
126126

127+
Multiline comment blocks should have a row of stars on the left,
128+
and the initial /* and terminating */ both on their own lines:
129+
/*
130+
* like
131+
* this
132+
*/
133+
This is the same format required by the Linux kernel coding style.
134+
135+
(Some of the existing comments in the codebase use the GNU Coding
136+
Standards form which does not have stars on the left, or other
137+
variations; avoid these when writing new comments, but don't worry
138+
about converting to the preferred form unless you're editing that
139+
comment anyway.)
140+
141+
Rationale: Consistency, and ease of visually picking out a multiline
142+
comment from the surrounding code.
143+
127144
8. trace-events style
128145

129146
8.1 0x prefix

0 commit comments

Comments
 (0)