[PATCH] Documentation: CodingStyle: add alignment rule for breaking statements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>
Cc: Gustavo Padovan <gustavo@xxxxxxxxxxx>
Cc: linux-bluetooth@xxxxxxxxxxxxxxx
Cc: linux-wireless@xxxxxxxxxxxxxxx
Signed-off-by: Arend van Spriel <arend@xxxxxxxxxxxx>
---
 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


--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux