1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-10-21 15:33:53 +03:00

syntax-check: Don't forbid curly braces around single line condition body

This syntax rule doesn't make much sense, especially if there are so
much exceptions to it. Just remove it and adjust the coding style.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa
2020-09-10 15:37:33 +02:00
parent b4d2cb58b2
commit 931c1d128d
2 changed files with 4 additions and 40 deletions

View File

@@ -258,15 +258,15 @@ comment, although use of a semicolon is not currently rejected.
Curly braces
------------
Omit the curly braces around an ``if``, ``while``, ``for`` etc.
body only when both that body and the condition itself occupy a
single line. In every other case we require the braces. This
Curly braces around an ``if``, ``while``, ``for`` etc. can be omitted if the
body and the condition itself occupy only a single line.
In every other case we require the braces. This
ensures that it is trivially easy to identify a
single-\ *statement* loop: each has only one *line* in its body.
::
while (expr) // single line body; {} is forbidden
while (expr) // single line body; {} is optional
single_line_stmt();
::