qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3] CODING_STYLE: Section about mixed declarations
@ 2014-03-17 18:26 Eduardo Habkost
  2014-03-17 18:28 ` Peter Maydell
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Eduardo Habkost @ 2014-03-17 18:26 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial
  Cc: Peter Maydell, Paolo Bonzini, Andreas Färber, Stefan Weil

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>
---
Changes v3:
 * Wrap long lines

Changes v2:
 * s/be at beginning/be at the beginning/
---
 CODING_STYLE | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/CODING_STYLE b/CODING_STYLE
index dcbce28..4280945 100644
--- a/CODING_STYLE
+++ b/CODING_STYLE
@@ -84,3 +84,10 @@ and clarity it comes on a line by itself:
 Rationale: a consistent (except for functions...) bracing style reduces
 ambiguity and avoids needless churn when lines are added or removed.
 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.
-- 
1.8.5.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH v3] CODING_STYLE: Section about mixed declarations
  2014-03-17 18:26 [Qemu-devel] [PATCH v3] CODING_STYLE: Section about mixed declarations Eduardo Habkost
@ 2014-03-17 18:28 ` Peter Maydell
  2014-03-20 15:59 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
  2014-03-21 18:04 ` [Qemu-devel] " Fabien Chouteau
  2 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2014-03-17 18:28 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: QEMU Trivial, Paolo Bonzini, QEMU Developers, Andreas Färber,
	Stefan Weil

On 17 March 2014 18:26, Eduardo Habkost <ehabkost@redhat.com> wrote:
> 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>

-- PMM

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [Qemu-trivial] [PATCH v3] CODING_STYLE: Section about mixed declarations
  2014-03-17 18:26 [Qemu-devel] [PATCH v3] CODING_STYLE: Section about mixed declarations Eduardo Habkost
  2014-03-17 18:28 ` Peter Maydell
@ 2014-03-20 15:59 ` Michael Tokarev
  2014-03-21 18:04 ` [Qemu-devel] " Fabien Chouteau
  2 siblings, 0 replies; 5+ messages in thread
From: Michael Tokarev @ 2014-03-20 15:59 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: Peter Maydell, qemu-trivial, Stefan Weil, qemu-devel,
	Paolo Bonzini, Andreas Färber

17.03.2014 22:26, Eduardo Habkost wrote:
> We had an unwritten rule about declarations having to be at beginning of
> blocks. Make it a written rule.

Thanks, applied to -trivial.

/mjt

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH v3] CODING_STYLE: Section about mixed declarations
  2014-03-17 18:26 [Qemu-devel] [PATCH v3] CODING_STYLE: Section about mixed declarations Eduardo Habkost
  2014-03-17 18:28 ` Peter Maydell
  2014-03-20 15:59 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
@ 2014-03-21 18:04 ` Fabien Chouteau
  2014-03-21 18:17   ` Eduardo Habkost
  2 siblings, 1 reply; 5+ messages in thread
From: Fabien Chouteau @ 2014-03-21 18:04 UTC (permalink / raw)
  To: Eduardo Habkost, qemu-devel, qemu-trivial
  Cc: Peter Maydell, Stefan Weil, Andreas Färber, Paolo Bonzini

On 03/17/2014 07:26 PM, Eduardo Habkost wrote:
> We had an unwritten rule about declarations having to be at beginning of
> blocks. Make it a written rule.
> 

Hello Eduardo,

Is it possible to check this rule in script/checkpatch.pl? (or is it already?)

Regards,

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH v3] CODING_STYLE: Section about mixed declarations
  2014-03-21 18:04 ` [Qemu-devel] " Fabien Chouteau
@ 2014-03-21 18:17   ` Eduardo Habkost
  0 siblings, 0 replies; 5+ messages in thread
From: Eduardo Habkost @ 2014-03-21 18:17 UTC (permalink / raw)
  To: Fabien Chouteau
  Cc: Peter Maydell, qemu-trivial, Stefan Weil, qemu-devel,
	Paolo Bonzini, Andreas Färber

On Fri, Mar 21, 2014 at 07:04:08PM +0100, Fabien Chouteau wrote:
> On 03/17/2014 07:26 PM, Eduardo Habkost wrote:
> > We had an unwritten rule about declarations having to be at beginning of
> > blocks. Make it a written rule.
> > 
> 
> Hello Eduardo,
> 
> Is it possible to check this rule in script/checkpatch.pl? (or is it already?)

checkpatch.pl doesn't check it, currently. It is possible to check it,
if somebody writes the code to do that.

-- 
Eduardo

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-03-21 18:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-17 18:26 [Qemu-devel] [PATCH v3] CODING_STYLE: Section about mixed declarations Eduardo Habkost
2014-03-17 18:28 ` Peter Maydell
2014-03-20 15:59 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2014-03-21 18:04 ` [Qemu-devel] " Fabien Chouteau
2014-03-21 18:17   ` Eduardo Habkost

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).