xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libxl: CODING_STYLE: Forbid if (...) { stmt; } else stmt;
@ 2016-08-08 10:21 Ian Jackson
  2016-08-08 10:31 ` Wei Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Jackson @ 2016-08-08 10:21 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, Ian Jackson

And clarify that the rule about omitting braces for single statements
is optional (it is even contradicted by the example).

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
---
 tools/libxl/CODING_STYLE | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/CODING_STYLE b/tools/libxl/CODING_STYLE
index 01ee25b..32170ef 100644
--- a/tools/libxl/CODING_STYLE
+++ b/tools/libxl/CODING_STYLE
@@ -294,8 +294,10 @@ Libxenlight coding style is super simple.  Avoid tricky expressions.
 
 5. Block structure
 
-Every indented statement is braced, except blocks that contain just
-one statement.
+Every indented statement is braced, but blocks that contain just one
+statement may have the braces omitted.  To avoid confusion, either all
+the blocks in an if...else chain have braces, or none of them do.
+
 The opening brace is on the line that contains the control flow
 statement that introduces the new block; the closing brace is on the
 same line as the else keyword, or on a line by itself if there is no
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] libxl: CODING_STYLE: Forbid if (...) { stmt; } else stmt;
  2016-08-08 10:21 [PATCH] libxl: CODING_STYLE: Forbid if (...) { stmt; } else stmt; Ian Jackson
@ 2016-08-08 10:31 ` Wei Liu
  2016-08-08 11:06   ` Wei Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Liu @ 2016-08-08 10:31 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel, Wei Liu

On Mon, Aug 08, 2016 at 11:21:31AM +0100, Ian Jackson wrote:
> And clarify that the rule about omitting braces for single statements
> is optional (it is even contradicted by the example).
> 
> Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
> CC: Wei Liu <wei.liu2@citrix.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libxl: CODING_STYLE: Forbid if (...) { stmt; } else stmt;
  2016-08-08 10:31 ` Wei Liu
@ 2016-08-08 11:06   ` Wei Liu
  0 siblings, 0 replies; 3+ messages in thread
From: Wei Liu @ 2016-08-08 11:06 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel, Wei Liu

On Mon, Aug 08, 2016 at 11:31:46AM +0100, Wei Liu wrote:
> On Mon, Aug 08, 2016 at 11:21:31AM +0100, Ian Jackson wrote:
> > And clarify that the rule about omitting braces for single statements
> > is optional (it is even contradicted by the example).
> > 
> > Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
> > CC: Wei Liu <wei.liu2@citrix.com>
> 
> Acked-by: Wei Liu <wei.liu2@citrix.com>

Pushed.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-08-08 11:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-08 10:21 [PATCH] libxl: CODING_STYLE: Forbid if (...) { stmt; } else stmt; Ian Jackson
2016-08-08 10:31 ` Wei Liu
2016-08-08 11:06   ` Wei Liu

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).