Commit Graph

12 Commits

Author SHA1 Message Date
Gonglei 2bb0020cf9 CODING_STYLE: Section about conditional statement
Yoda conditions lack readability, and QEMU has a
strict compiler configuration for checking a common
mistake like "if (dev = NULL)". Make it a written rule.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2014-08-15 18:54:06 +04:00
Eduardo Habkost e939c6ed61 CODING_STYLE: Section about mixed declarations
We had an unwritten rule about declarations having to be at beginning of
blocks. Make it a written rule.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2014-03-27 19:22:49 +04:00
Stefan Weil 6576b74b0b Replace Qemu by QEMU in internal documentation
The official spelling is QEMU.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-07 13:58:25 +00:00
Peter Maydell e3c52bf2e5 CODING_STYLE: Clarify style for enum and function type names
Clarify that enum type names and function type names should follow
the CamelCase style used for structured type names.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-02-10 10:44:51 +00:00
Avi Kivity 5f070c5fb7 CODING_STYLE: explicitly allow braceless 'else if'
It's already allowed by the example; there are about 1800 instances in the
tree; and disallowing it would lead to

    if (a) {
        ...
    } else {
        if (b) {
            ...
        } else {
            if (c) {
                ...
            } else {
                if (d) {
                    ...
                } else {
                    ...
                }
            }
        }
    }

instead of

    if (a) {
        ...
    } else if (b) {
        ...
    } else if (c) {
        ...
    } else if (d) {
        ...
    } else {
        ...
    }

which is more readable.

Acked-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-07-29 09:33:56 -05:00
Blue Swirl b646968336 checkpatch: adjust to QEMUisms
Change checkpatch.pl for QEMU use:
 - Root directory detection
 - Forbid tabs
 - Indent at 4 spaces
 - Allow typedefs
 - Enforce brace use even for single statement blocks
 - Don't suggest nonexistent cleanup tools

Mention the script in CODING_STYLE.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-01-20 20:58:56 +00:00
Blue Swirl 84174436a6 HACKING: add C type rules
Add C type rules, adapted from libvirt HACKING. Also include
a description of special QEMU scalar types.

Move typedef rule from CODING_STYLE rule 3 to HACKING rule 6
where it belongs.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-10 18:47:31 +00:00
Avi Kivity 77ac486263 CODING_STYLE: Reserve qemu_ prefix for library wrappers
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-19 15:27:27 -05:00
Anthony Liguori c227f0995e Revert "Get rid of _t suffix"
In the very least, a change like this requires discussion on the list.

The naming convention is goofy and it causes a massive merge problem.  Something
like this _must_ be presented on the list first so people can provide input
and cope with it.

This reverts commit 99a0949b72.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-01 16:12:16 -05:00
malc 99a0949b72 Get rid of _t suffix
Some not so obvious bits, slirp and Xen were left alone for the time
being.

Signed-off-by: malc <av1474@comtv.ru>
2009-10-01 22:45:02 +04:00
edgar_igl 1cb499fa26 Remove potentially offensive humor.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7014 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-07 02:10:16 +00:00
aliguori e68b98dc72 Document QEMU coding style (v2) (Avi Kivity)
With the help of some Limoncino I noted several aspects of the QEMU coding
style, particularly where it differs from the Linux coding style as many
contributors work on both projects.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6976 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-05 17:40:34 +00:00