qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v3 3/3] util/uri.c: add brackets to `if` stateme


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v3 3/3] util/uri.c: add brackets to `if` statements
Date: Sat, 24 Feb 2018 13:09:22 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

On 02/24/2018 06:56 AM, 苏航 wrote:
Hi, when I try to change
`while (cond) ;`
to
`while (cond) {
}`
checkpatch.pl complains about this:
'''
ERROR: suspect code indent for conditional statements (8, 8)
#1506: FILE: uri.c:1506:
+        while ((*tmp++ = *segp++) != 0) {
[...]
+        }

ERROR: suspect code indent for conditional statements (8, 8)
#1512: FILE: uri.c:1512:
+        while ((segp > path) && ((--segp)[0] == '/')) {
[...]
+        }
'''

When I add a semicolon, checkpatch.pl stop complaining.
`while (cond) {
     ;
}`
What should I do now?

Keeping a semicolon is one option, another is a well-placed comment:

while (cond) {
    /* No further work */
}


And in general, we try to avoid top-posting on this list.

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]