qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v4 RFC 0/3] util/uri.c: Coding style format


From: no-reply
Subject: Re: [Qemu-devel] [PATCH v4 RFC 0/3] util/uri.c: Coding style format
Date: Sat, 24 Feb 2018 20:36:14 -0800 (PST)

Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: address@hidden
Subject: [Qemu-devel]  [PATCH v4 RFC 0/3] util/uri.c: Coding style format

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]               patchew/address@hidden -> patchew/address@hidden
Switched to a new branch 'test'
957d502227 util/uri.c: wrap single statement blocks with braces {}
fe53592725 util/uri.c: remove brackets that wrap `return` statement's content.
d00aae9b66 util/uri.c: Coding style check, Only whitespace involved. Using 
`clang-format -i util/uri.c` first, then change back few code manually, to make 
sure only whitespace involved.

=== OUTPUT BEGIN ===
Checking PATCH 1/3: util/uri.c: Coding style check, Only whitespace involved. 
Using `clang-format -i util/uri.c` first, then change back few code manually, 
to make sure only whitespace involved....
ERROR: return is not a function, parentheses are not required
#167: FILE: util/uri.c:215:
+        return (-1);

ERROR: return is not a function, parentheses are not required
#172: FILE: util/uri.c:219:
+        return (2);

ERROR: return is not a function, parentheses are not required
#186: FILE: util/uri.c:229:
+    return (0);

ERROR: braces {} are necessary for all arms of this statement
#208: FILE: util/uri.c:262:
+        if (uri->cleanup & 2)
[...]
+        else
[...]

ERROR: braces {} are necessary for all arms of this statement
#272: FILE: util/uri.c:359:
+            if (uri->cleanup & 2)
[...]
+            else
[...]

ERROR: return is not a function, parentheses are not required
#278: FILE: util/uri.c:365:
+        return (0);

ERROR: return is not a function, parentheses are not required
#281: FILE: util/uri.c:367:
+    return (1);

ERROR: return is not a function, parentheses are not required
#301: FILE: util/uri.c:389:
+        return (1);

ERROR: braces {} are necessary for all arms of this statement
#302: FILE: util/uri.c:390:
+    if (!ISA_DIGIT(cur + 1))
[...]
+    else if ((*cur != '0') && (ISA_DIGIT(cur + 1)) && (!ISA_DIGIT(cur + 2)))
[...]
     else if ((*cur == '1') && (ISA_DIGIT(cur + 1)) && (ISA_DIGIT(cur + 2)))
[...]
-    else if ((*cur == '2') && (*(cur + 1) >= '0') &&
[...]
-    else if ((*cur == '2') && (*(cur + 1) == '5') &&
[...]
+        cur += 3;
[...]

ERROR: braces {} are necessary for all arms of this statement
#304: FILE: util/uri.c:392:
+    else if ((*cur != '0') && (ISA_DIGIT(cur + 1)) && (!ISA_DIGIT(cur + 2)))
[...]
     else if ((*cur == '1') && (ISA_DIGIT(cur + 1)) && (ISA_DIGIT(cur + 2)))
[...]
-    else if ((*cur == '2') && (*(cur + 1) >= '0') &&
[...]
-    else if ((*cur == '2') && (*(cur + 1) == '5') &&
[...]
+        cur += 3;
[...]

ERROR: braces {} are necessary for all arms of this statement
#315: FILE: util/uri.c:396:
+    else if ((*cur == '2') && (*(cur + 1) >= '0') && (*(cur + 1) <= '4') &&
[...]
+    else if ((*cur == '2') && (*(cur + 1) == '5') && (*(cur + 2) >= '0') &&
[...]
     else
[...]

ERROR: braces {} are necessary for all arms of this statement
#318: FILE: util/uri.c:399:
+    else if ((*cur == '2') && (*(cur + 1) == '5') && (*(cur + 2) >= '0') &&
[...]
     else
[...]

ERROR: return is not a function, parentheses are not required
#323: FILE: util/uri.c:403:
+        return (1);

ERROR: return is not a function, parentheses are not required
#326: FILE: util/uri.c:405:
+    return (0);

ERROR: braces {} are necessary even for single statement blocks
#350: FILE: util/uri.c:433:
+        while ((*cur != ']') && (*cur != 0))
+            cur++;

ERROR: braces {} are necessary for all arms of this statement
#352: FILE: util/uri.c:435:
+        if (*cur != ']')
[...]

ERROR: return is not a function, parentheses are not required
#353: FILE: util/uri.c:436:
+            return (1);

ERROR: braces {} are necessary for all arms of this statement
#367: FILE: util/uri.c:446:
+        if (*cur != '.')
[...]

ERROR: braces {} are necessary for all arms of this statement
#375: FILE: util/uri.c:451:
+        if (*cur != '.')
[...]

ERROR: braces {} are necessary for all arms of this statement
#382: FILE: util/uri.c:455:
+        if (*cur != '.')
[...]

ERROR: braces {} are necessary for all arms of this statement
#408: FILE: util/uri.c:473:
+        if (cur != host) {
[...]
+        } else
[...]

ERROR: braces {} are necessary for all arms of this statement
#409: FILE: util/uri.c:474:
+            if (uri->cleanup & 2)
[...]
+            else
[...]

ERROR: return is not a function, parentheses are not required
#418: FILE: util/uri.c:482:
+    return (0);

ERROR: braces {} are necessary for all arms of this statement
#437: FILE: util/uri.c:512:
+    if (ret != 0)
[...]

ERROR: return is not a function, parentheses are not required
#438: FILE: util/uri.c:513:
+        return (ret);

ERROR: braces {} are necessary for all arms of this statement
#443: FILE: util/uri.c:517:
+        if (ret != 0)
[...]

ERROR: return is not a function, parentheses are not required
#444: FILE: util/uri.c:518:
+            return (ret);

ERROR: return is not a function, parentheses are not required
#448: FILE: util/uri.c:521:
+    return (0);

ERROR: return is not a function, parentheses are not required
#467: FILE: util/uri.c:547:
+            return (0);

ERROR: return is not a function, parentheses are not required
#468: FILE: util/uri.c:548:
+        return (1);

ERROR: return is not a function, parentheses are not required
#490: FILE: util/uri.c:579:
+            return (ret);

ERROR: return is not a function, parentheses are not required
#509: FILE: util/uri.c:616:
+        return (1);

ERROR: return is not a function, parentheses are not required
#522: FILE: util/uri.c:624:
+                return (ret);

ERROR: braces {} are necessary for all arms of this statement
#542: FILE: util/uri.c:662:
+    if (ret != 0)
[...]

ERROR: return is not a function, parentheses are not required
#543: FILE: util/uri.c:663:
+        return (ret);

ERROR: return is not a function, parentheses are not required
#550: FILE: util/uri.c:668:
+            return (ret);

ERROR: braces {} are necessary for all arms of this statement
#569: FILE: util/uri.c:705:
+    if (ret != 0)
[...]

ERROR: return is not a function, parentheses are not required
#570: FILE: util/uri.c:706:
+        return (ret);

ERROR: return is not a function, parentheses are not required
#577: FILE: util/uri.c:711:
+            return (ret);

ERROR: braces {} are necessary for all arms of this statement
#602: FILE: util/uri.c:753:
+        if (ret != 0)
[...]

ERROR: return is not a function, parentheses are not required
#603: FILE: util/uri.c:754:
+            return (ret);

ERROR: braces {} are necessary for all arms of this statement
#605: FILE: util/uri.c:756:
+        if (ret != 0)
[...]

ERROR: return is not a function, parentheses are not required
#606: FILE: util/uri.c:757:
+            return (ret);

ERROR: return is not a function, parentheses are not required
#608: FILE: util/uri.c:759:
+        return (0);

ERROR: braces {} are necessary for all arms of this statement
#612: FILE: util/uri.c:762:
+        if (ret != 0)
[...]

ERROR: return is not a function, parentheses are not required
#613: FILE: util/uri.c:763:
+            return (ret);

ERROR: braces {} are necessary for all arms of this statement
#617: FILE: util/uri.c:766:
+        if (ret != 0)
[...]

ERROR: return is not a function, parentheses are not required
#618: FILE: util/uri.c:767:
+            return (ret);

ERROR: braces {} are necessary for all arms of this statement
#649: FILE: util/uri.c:802:
+        if (ret != 0)
[...]

ERROR: return is not a function, parentheses are not required
#650: FILE: util/uri.c:803:
+            return (ret);

ERROR: braces {} are necessary for all arms of this statement
#652: FILE: util/uri.c:805:
+        if (ret != 0)
[...]

ERROR: return is not a function, parentheses are not required
#653: FILE: util/uri.c:806:
+            return (ret);

ERROR: braces {} are necessary for all arms of this statement
#658: FILE: util/uri.c:809:
+        if (ret != 0)
[...]

ERROR: return is not a function, parentheses are not required
#659: FILE: util/uri.c:810:
+            return (ret);

ERROR: braces {} are necessary for all arms of this statement
#663: FILE: util/uri.c:813:
+        if (ret != 0)
[...]

ERROR: return is not a function, parentheses are not required
#664: FILE: util/uri.c:814:
+            return (ret);

ERROR: braces {} are necessary for all arms of this statement
#683: FILE: util/uri.c:826:
+        if (ret != 0)
[...]

ERROR: return is not a function, parentheses are not required
#684: FILE: util/uri.c:827:
+            return (ret);

ERROR: braces {} are necessary for all arms of this statement
#692: FILE: util/uri.c:832:
+        if (ret != 0)
[...]

ERROR: return is not a function, parentheses are not required
#693: FILE: util/uri.c:833:
+            return (ret);

ERROR: return is not a function, parentheses are not required
#699: FILE: util/uri.c:837:
+        return (1);

ERROR: return is not a function, parentheses are not required
#702: FILE: util/uri.c:839:
+    return (0);

ERROR: braces {} are necessary for all arms of this statement
#721: FILE: util/uri.c:859:
+    if (ret != 0)
[...]

ERROR: return is not a function, parentheses are not required
#722: FILE: util/uri.c:860:
+        return (ret);

ERROR: return is not a function, parentheses are not required
#725: FILE: util/uri.c:862:
+        return (1);

ERROR: braces {} are necessary for all arms of this statement
#730: FILE: util/uri.c:866:
+    if (ret != 0)
[...]

ERROR: return is not a function, parentheses are not required
#731: FILE: util/uri.c:867:
+        return (ret);

ERROR: braces {} are necessary for all arms of this statement
#738: FILE: util/uri.c:871:
+        if (ret != 0)
[...]

ERROR: return is not a function, parentheses are not required
#739: FILE: util/uri.c:872:
+            return (ret);

ERROR: braces {} are necessary for all arms of this statement
#747: FILE: util/uri.c:877:
+        if (ret != 0)
[...]

ERROR: return is not a function, parentheses are not required
#748: FILE: util/uri.c:878:
+            return (ret);

ERROR: return is not a function, parentheses are not required
#754: FILE: util/uri.c:882:
+        return (1);

ERROR: return is not a function, parentheses are not required
#757: FILE: util/uri.c:884:
+    return (0);

ERROR: return is not a function, parentheses are not required
#773: FILE: util/uri.c:904:
+        return (-1);

ERROR: return is not a function, parentheses are not required
#790: FILE: util/uri.c:917:
+            return (ret);

ERROR: return is not a function, parentheses are not required
#794: FILE: util/uri.c:920:
+    return (0);

ERROR: return is not a function, parentheses are not required
#811: FILE: util/uri.c:939:
+        return (NULL);

ERROR: return is not a function, parentheses are not required
#817: FILE: util/uri.c:944:
+        return (NULL);

ERROR: return is not a function, parentheses are not required
#820: FILE: util/uri.c:946:
+    return (uri);

ERROR: return is not a function, parentheses are not required
#833: FILE: util/uri.c:963:
+    return (rfc3986_parse_uri_reference(uri, str));

ERROR: return is not a function, parentheses are not required
#850: FILE: util/uri.c:983:
+        return (NULL);

ERROR: return is not a function, parentheses are not required
#859: FILE: util/uri.c:991:
+        return (NULL);

ERROR: return is not a function, parentheses are not required
#862: FILE: util/uri.c:993:
+    return (uri);

ERROR: return is not a function, parentheses are not required
#887: FILE: util/uri.c:1014:
+    return (ret);

ERROR: return is not a function, parentheses are not required
#906: FILE: util/uri.c:1031:
+    return (temp);

ERROR: braces {} are necessary for all arms of this statement
#926: FILE: util/uri.c:1050:
+    if (uri == NULL)
[...]

ERROR: return is not a function, parentheses are not required
#927: FILE: util/uri.c:1051:
+        return (NULL);

ERROR: braces {} are necessary for all arms of this statement
#979: FILE: util/uri.c:1079:
+            if (IS_RESERVED(*(p)) || IS_UNRESERVED(*(p)))
[...]
+            else {
[...]

ERROR: braces {} are necessary for all arms of this statement
#1029: FILE: util/uri.c:1104:
+                    if ((IS_UNRESERVED(*(p))) || ((*(p) == ';')) ||
[...]
+                    else {
[...]

ERROR: braces {} are necessary for all arms of this statement
#1113: FILE: util/uri.c:1150:
+                if ((IS_UNRESERVED(*(p))) || ((*(p) == '$')) ||
[...]
+                else {
[...]

ERROR: braces {} are necessary for all arms of this statement
#1183: FILE: util/uri.c:1194:
+                if ((IS_UNRESERVED(*(p))) || ((*(p) == '/')) ||
[...]
-               else {
[...]

ERROR: braces {} are necessary for all arms of this statement
#1265: FILE: util/uri.c:1236:
+            if ((IS_UNRESERVED(*(p))) || (IS_RESERVED(*(p))))
[...]
+            else {
[...]

ERROR: return is not a function, parentheses are not required
#1282: FILE: util/uri.c:1252:
+    return (ret);

ERROR: braces {} are necessary for all arms of this statement
#1295: FILE: util/uri.c:1263:
+    if (uri == NULL)
[...]

ERROR: return is not a function, parentheses are not required
#1334: FILE: util/uri.c:1318:
+        return (-1);

ERROR: return is not a function, parentheses are not required
#1345: FILE: util/uri.c:1327:
+        return (0);

ERROR: braces {} are necessary even for single statement blocks
#1371: FILE: util/uri.c:1343:
+            while (cur[0] == '/')
+                cur++;

ERROR: braces {} are necessary for all arms of this statement
#1386: FILE: util/uri.c:1352:
+        if ((cur[0] == '.') && (cur[1] == '\0'))
[...]

ERROR: braces {} are necessary even for single statement blocks
#1404: FILE: util/uri.c:1362:
+        while ((cur[0] == '/') && (cur[1] == '/'))
+            cur++;

ERROR: return is not a function, parentheses are not required
#1420: FILE: util/uri.c:1375:
+        return (0);

ERROR: braces {} are necessary even for single statement blocks
#1513: FILE: util/uri.c:1482:
+            while (cur[0] != '\0')
+                (out++)[0] = (cur++)[0];

ERROR: return is not a function, parentheses are not required
#1520: FILE: util/uri.c:1488:
+    return (0);

ERROR: braces {} are necessary for all arms of this statement
#1528: FILE: util/uri.c:1493:
+    if (((c >= '0') && (c <= '9')) || ((c >= 'a') && (c <= 'f')) ||
[...]

ERROR: return is not a function, parentheses are not required
#1532: FILE: util/uri.c:1495:
+        return (1);

ERROR: return is not a function, parentheses are not required
#1533: FILE: util/uri.c:1496:
+    return (0);

ERROR: return is not a function, parentheses are not required
#1555: FILE: util/uri.c:1519:
+        return (NULL);

ERROR: braces {} are necessary for all arms of this statement
#1556: FILE: util/uri.c:1520:
+    if (len <= 0)
[...]

ERROR: braces {} are necessary for all arms of this statement
#1558: FILE: util/uri.c:1522:
+    if (len < 0)
[...]

ERROR: return is not a function, parentheses are not required
#1559: FILE: util/uri.c:1523:
+        return (NULL);

ERROR: braces {} are necessary for all arms of this statement
#1595: FILE: util/uri.c:1534:
+            if ((*in >= '0') && (*in <= '9'))
[...]
+            else if ((*in >= 'a') && (*in <= 'f'))
[...]
+            else if ((*in >= 'A') && (*in <= 'F'))
[...]

ERROR: braces {} are necessary for all arms of this statement
#1597: FILE: util/uri.c:1536:
+            else if ((*in >= 'a') && (*in <= 'f'))
[...]
+            else if ((*in >= 'A') && (*in <= 'F'))
[...]

ERROR: braces {} are necessary for all arms of this statement
#1599: FILE: util/uri.c:1538:
+            else if ((*in >= 'A') && (*in <= 'F'))
[...]

ERROR: braces {} are necessary for all arms of this statement
#1602: FILE: util/uri.c:1541:
+            if ((*in >= '0') && (*in <= '9'))
[...]
+            else if ((*in >= 'a') && (*in <= 'f'))
[...]
+            else if ((*in >= 'A') && (*in <= 'F'))
[...]

ERROR: braces {} are necessary for all arms of this statement
#1604: FILE: util/uri.c:1543:
+            else if ((*in >= 'a') && (*in <= 'f'))
[...]
+            else if ((*in >= 'A') && (*in <= 'F'))
[...]

ERROR: braces {} are necessary for all arms of this statement
#1606: FILE: util/uri.c:1545:
+            else if ((*in >= 'A') && (*in <= 'F'))
[...]

ERROR: return is not a function, parentheses are not required
#1618: FILE: util/uri.c:1556:
+    return (ret);

ERROR: return is not a function, parentheses are not required
#1637: FILE: util/uri.c:1577:
+        return (NULL);

ERROR: return is not a function, parentheses are not required
#1640: FILE: util/uri.c:1579:
+        return (g_strdup(str));

ERROR: braces {} are necessary for all arms of this statement
#1643: FILE: util/uri.c:1581:
+    if (!(len > 0))
[...]

ERROR: return is not a function, parentheses are not required
#1644: FILE: util/uri.c:1582:
+        return (NULL);

ERROR: braces {} are necessary for all arms of this statement
#1685: FILE: util/uri.c:1600:
+            if (val <= 9)
[...]
+            else
[...]

ERROR: braces {} are necessary for all arms of this statement
#1690: FILE: util/uri.c:1605:
+            if (val <= 9)
[...]
+            else
[...]

ERROR: return is not a function, parentheses are not required
#1701: FILE: util/uri.c:1615:
+    return (ret);

ERROR: braces {} are necessary for all arms of this statement
#1738: FILE: util/uri.c:1658:
+        if (*uri) {
[...]
+        } else
[...]

ERROR: braces {} are necessary for all arms of this statement
#1772: FILE: util/uri.c:1680:
+        if (ref)
[...]

ERROR: braces {} are necessary for all arms of this statement
#1802: FILE: util/uri.c:1710:
+        if (bas->authority != NULL)
[...]
+        else if (bas->server != NULL) {
[...]

ERROR: braces {} are necessary for all arms of this statement
#1842: FILE: util/uri.c:1750:
+        if (ref->authority != NULL)
[...]
+        else {
[...]

ERROR: braces {} are necessary even for single statement blocks
#1901: FILE: util/uri.c:1802:
+            while ((bas->path[cur] != 0) && (bas->path[cur] != '/'))
+                cur++;

ERROR: braces {} are necessary for all arms of this statement
#1903: FILE: util/uri.c:1804:
+            if (bas->path[cur] == 0)
[...]

ERROR: braces {} are necessary for all arms of this statement
#1938: FILE: util/uri.c:1825:
+        if ((out == 0) && (bas->server != NULL))
[...]

ERROR: return is not a function, parentheses are not required
#1959: FILE: util/uri.c:1854:
+    return (val);

ERROR: braces {} are necessary for all arms of this statement
#1991: FILE: util/uri.c:1912:
+        if (ret != 0)
[...]

ERROR: braces {} are necessary for all arms of this statement
#2013: FILE: util/uri.c:1927:
+        if (ret != 0)
[...]

ERROR: braces {} are necessary for all arms of this statement
#2069: FILE: util/uri.c:1965:
+            if (*uptr == '/')
[...]

ERROR: braces {} are necessary for all arms of this statement
#2085: FILE: util/uri.c:1975:
+            if (bptr[ix] == '/')
[...]

ERROR: braces {} are necessary for all arms of this statement
#2098: FILE: util/uri.c:1984:
+        if ((ref->path[pos] == '.') && (ref->path[pos + 1] == '/'))
[...]

ERROR: braces {} are necessary for all arms of this statement
#2101: FILE: util/uri.c:1986:
+        if ((*bptr == '.') && (bptr[1] == '/'))
[...]
-       else if ((*bptr == '/') && (ref->path[pos] != '/'))
[...]

ERROR: braces {} are necessary for all arms of this statement
#2107: FILE: util/uri.c:1988:
+        else if ((*bptr == '/') && (ref->path[pos] != '/'))
[...]

ERROR: braces {} are necessary even for single statement blocks
#2109: FILE: util/uri.c:1990:
+        while ((bptr[pos] == ref->path[pos]) && (bptr[pos] != 0))
+            pos++;

ERROR: braces {} are necessary for all arms of this statement
#2145: FILE: util/uri.c:2003:
+        if ((ref->path[ix] == '/') && (ix > 0))
[...]
+        else if ((ref->path[ix] == 0) && (ix > 1) && (ref->path[ix - 1] == 
'/'))
[...]

ERROR: braces {} are necessary for all arms of this statement
#2147: FILE: util/uri.c:2005:
+        else if ((ref->path[ix] == 0) && (ix > 1) && (ref->path[ix - 1] == 
'/'))
[...]

ERROR: braces {} are necessary for all arms of this statement
#2150: FILE: util/uri.c:2008:
+            if (ref->path[ix] == '/')
[...]

ERROR: braces {} are necessary for all arms of this statement
#2175: FILE: util/uri.c:2023:
+                if (bptr[ix] == '/')
[...]

ERROR: braces {} are necessary for all arms of this statement
#2187: FILE: util/uri.c:2031:
+        if (uptr != NULL)
[...]

ERROR: braces {} are necessary for all arms of this statement
#2268: FILE: util/uri.c:2096:
+    if (init_alloc <= 0)
[...]

ERROR: braces {} are necessary for all arms of this statement
#2337: FILE: util/uri.c:2159:
+        if (eq && eq >= end)
[...]

ERROR: braces {} are necessary for all arms of this statement
#2379: FILE: util/uri.c:2199:
+        if (*query)
[...]

total: 147 errors, 0 warnings, 2299 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 2/3: util/uri.c: remove brackets that wrap `return` statement's 
content....
Checking PATCH 3/3: util/uri.c: wrap single statement blocks with braces {}...
=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to address@hidden

reply via email to

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