From: "Arend van Spriel" <arend@broadcom.com>
To: "Rob Landley" <rob@landley.net>
Cc: linux-doc@vger.kernel.org,
"Arend van Spriel" <arend@broadcom.com>,
"David S. Miller" <davem@davemloft.net>,
"Gustavo Padovan" <gustavo@padovan.org>,
linux-bluetooth@vger.kernel.org, linux-wireless@vger.kernel.org
Subject: [PATCH] Documentation: CodingStyle: add alignment rule for breaking statements
Date: Mon, 7 May 2012 12:51:32 +0200 [thread overview]
Message-ID: <1336387892-3730-1-git-send-email-arend@broadcom.com> (raw)
The coding style document does cover breaking lines that are hitting
the 80 column boundary. However, how to format the portions is not
in the document. The submitted patches mostly align them on the same
column so that seems the consensus on it and in recent thread [1] this
lead to push-back on patches by David Miller. As the script checkpatch
already validate patches against this alignment rule it seems time to
add the rule to the coding style so people can not use the argument
that it is not there.
[1] http://article.gmane.org/gmane.linux.bluez.kernel/24759
Cc: David S. Miller <davem@davemloft.net>
Cc: Gustavo Padovan <gustavo@padovan.org>
Cc: linux-bluetooth@vger.kernel.org
Cc: linux-wireless@vger.kernel.org
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
Documentation/CodingStyle | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
index c58b236..bfb9008 100644
--- a/Documentation/CodingStyle
+++ b/Documentation/CodingStyle
@@ -87,6 +87,18 @@ are placed substantially to the right. The same applies to function headers
with a long argument list. However, never break user-visible strings such as
printk messages, because that breaks the ability to grep for them.
+When breaking statements you should align the sensible chunks to the same
+column. This may involve adding a couple of spaces behind the tabs of the
+next line(s), eg.:
+
+static inline const struct device *chunk_device(struct device *parent,
+ bool sensible_device_chunks)
+{
+ if (parent)
+ if (somewhat_lengthy_global_logical_condition &&
+ sensible_device_chunks)
+ perform_the_jobs(parent);
+}
Chapter 3: Placing Braces and Spaces
--
1.7.9.5
reply other threads:[~2012-05-07 10:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1336387892-3730-1-git-send-email-arend@broadcom.com \
--to=arend@broadcom.com \
--cc=davem@davemloft.net \
--cc=gustavo@padovan.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=rob@landley.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).