[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 28/43] CODING_STYLE: update mixed declaration rules
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 28/43] CODING_STYLE: update mixed declaration rules |
Date: |
Wed, 9 Sep 2015 15:49:58 +0200 |
Mixed declarations do come in handy at the top of #ifdef blocks.
Reluctantly allow this particular usage and suggest an alternative.
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
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
- [Qemu-devel] [PULL 13/43] tcg: synchronize cpu->exit_request and cpu->tcg_exit_req accesses, (continued)
- [Qemu-devel] [PULL 13/43] tcg: synchronize cpu->exit_request and cpu->tcg_exit_req accesses, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 16/43] tcg: signal-free qemu_cpu_kick, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 12/43] tcg: assign cpu->current_tb in a simpler place, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 18/43] Makefile.target: include top level build dir in vpath, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 17/43] Move RAMBlock and ram_list to ram_addr.h, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 22/43] translate-all: remove obsolete comment about l1_map, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 20/43] rcu: fix comment with s/rcu_gp_lock/rcu_registry_lock/, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 21/43] linux-user: call rcu_(un)register_thread on pthread_(exit|create), Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 19/43] rcu: init rcu_registry_lock after fork, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 23/43] cutils: Add qemu_strtol() wrapper, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 28/43] CODING_STYLE: update mixed declaration rules,
Paolo Bonzini <=
- [Qemu-devel] [PULL 26/43] cutils: Add qemu_strtoull() wrapper, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 24/43] cutils: Add qemu_strtoul() wrapper, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 27/43] qmp: Add example usage of strto*l() qemu wrapper, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 25/43] cutils: Add qemu_strtoll() wrapper, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 29/43] checkpatch: adapt some tests to QEMU, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 30/43] checkpatch: remove tests that are not relevant outside the kernel, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 31/43] vhost-scsi: fix wrong vhost-scsi firmware path, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 32/43] configure: factor out adding disas configure, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 34/43] configure: Add support for jemalloc, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 35/43] scripts/dump-guest-memory.py: fix after RAMBlock change, Paolo Bonzini, 2015/09/09