+ codingstyle-proscribe-do-while-without-braces.patch added to -mm tree

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

 



The patch titled
     CodingStyle: proscribe do-while without braces.
has been added to the -mm tree.  Its filename is
     codingstyle-proscribe-do-while-without-braces.patch

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: CodingStyle: proscribe do-while without braces.
From: Josh Triplett <josht@xxxxxxxxxxxxxxxxxx>

Sparse warns about do-while loops without braces; Linus's rationale from the
Sparse Git changelog:

> Add warning message for naked do-while
>
> Does it necessarily make sense? Dunno, but it does tend to be bad
> practice, or at least result in code that can be hard to mentally parse.
>
> Maybe that mental parsing is just me.	 Or maybe it should be warned
> about. You decide.

Signed-off-by: Josh Triplett <josh@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 Documentation/CodingStyle |    7 +++++++
 1 file changed, 7 insertions(+)

diff -puN Documentation/CodingStyle~codingstyle-proscribe-do-while-without-braces Documentation/CodingStyle
--- a/Documentation/CodingStyle~codingstyle-proscribe-do-while-without-braces
+++ a/Documentation/CodingStyle
@@ -175,6 +175,13 @@ if (condition) {
 	otherwise();
 }
 
+This also does not apply to a do-while loop; always use braces with a do-while,
+even if it contains a single statement:
+
+do {
+	this();
+} while(condition);
+
 		3.1:  Spaces
 
 Linux kernel style for use of spaces depends (mostly) on
_

Patches currently in -mm which might be from josht@xxxxxxxxxxxxxxxxxx are

codingstyle-proscribe-do-while-without-braces.patch
i386-mark-pit_clockevent-static.patch

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

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux