From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Andreas Faerber <afaerber@suse.de>,
Eduardo Habkost <ehabkost@redhat.com>,
Markus Armbruster <armbru@redhat.com>
Subject: [Qemu-devel] [PATCH 1/4] CODING_STYLE: update mixed declaration rules
Date: Mon, 7 Sep 2015 11:53:01 +0200 [thread overview]
Message-ID: <1441619584-17992-2-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1441619584-17992-1-git-send-email-pbonzini@redhat.com>
Mixed declarations also do exist at the top of #ifdef blocks.
Reluctantly allow this particular usage and suggest an alternative.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
CODING_STYLE | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/CODING_STYLE b/CODING_STYLE
index d46cfa5..3c6978f 100644
--- a/CODING_STYLE
+++ b/CODING_STYLE
@@ -87,10 +87,15 @@ Furthermore, it is the QEMU coding style.
5. Declarations
-Mixed declarations (interleaving statements and declarations within blocks)
-are not allowed; declarations should be at the beginning of blocks. In other
-words, the code should not generate warnings if using GCC's
--Wdeclaration-after-statement option.
+Mixed declarations (interleaving statements and declarations within
+blocks) are generally not allowed; declarations should be at the beginning
+of blocks.
+
+Every now and then, an exception is made for declarations inside a
+#ifdef or #ifndef block: if the code looks nicer, such declarations can
+be placed at the top of the block even if there are statements above.
+On the other hand, however, it's often best to move that #ifdef/#ifndef
+block to a separate function altogether.
6. Conditional statements
--
2.4.3
next prev parent reply other threads:[~2015-09-07 9:53 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-07 9:53 [Qemu-devel] [PATCH 0/4] updates to coding style and checkpatch Paolo Bonzini
2015-09-07 9:53 ` Paolo Bonzini [this message]
2015-09-09 9:20 ` [Qemu-devel] [PATCH 1/4] CODING_STYLE: update mixed declaration rules Stefan Hajnoczi
2015-09-09 10:43 ` Alex Bennée
2015-09-07 9:53 ` [Qemu-devel] [PATCH 2/4] CODING_STYLE, checkpatch: update line length rules Paolo Bonzini
2015-09-07 13:18 ` Thomas Huth
2015-09-07 14:22 ` Paolo Bonzini
2015-09-07 14:37 ` Thomas Huth
2015-09-07 15:23 ` Markus Armbruster
2015-09-07 16:06 ` Paolo Bonzini
2015-09-07 17:05 ` Markus Armbruster
2015-09-09 16:26 ` John Snow
2015-09-09 17:22 ` Peter Maydell
2015-09-09 19:23 ` Eduardo Habkost
2015-09-09 20:28 ` Paolo Bonzini
2015-09-09 19:09 ` Eduardo Habkost
2015-09-07 17:02 ` Thomas Huth
2015-09-09 18:45 ` Eduardo Habkost
2015-09-07 15:17 ` Markus Armbruster
2015-09-07 15:54 ` Paolo Bonzini
2015-09-07 16:59 ` Markus Armbruster
2015-09-07 9:53 ` [Qemu-devel] [PATCH 3/4] checkpatch: adapt some tests to QEMU Paolo Bonzini
2015-09-09 9:22 ` Stefan Hajnoczi
2015-09-17 14:24 ` Peter Maydell
2015-09-17 16:00 ` Paolo Bonzini
2015-09-17 16:16 ` Peter Maydell
2015-09-17 16:32 ` Paolo Bonzini
2015-09-17 16:44 ` Eric Blake
2015-09-18 6:53 ` Markus Armbruster
2015-10-04 18:44 ` Peter Maydell
2015-10-05 18:11 ` Eduardo Habkost
2015-10-05 18:47 ` Peter Maydell
2015-10-05 19:27 ` Paolo Bonzini
2015-09-07 9:53 ` [Qemu-devel] [PATCH 4/4] checkpatch: remove tests that are not relevant outside the kernel Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1441619584-17992-2-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=afaerber@suse.de \
--cc=armbru@redhat.com \
--cc=ehabkost@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).