[v3,08/11] Add mention of fall-through comments

Submitted by Christophe de Dinechin on Feb. 8, 2018, 11:25 a.m.

Details

Message ID 20180208112531.19601-9-christophe@dinechin.org
State New
Headers show
Series "Updates to the style guide" ( rev: 2 1 ) in Spice

Not browsing as part of any series.

Commit Message

Christophe de Dinechin Feb. 8, 2018, 11:25 a.m.
From: Christophe de Dinechin <dinechin@redhat.com>

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
---
 docs/spice_style.txt | 5 +++++
 1 file changed, 5 insertions(+)

Patch hide | download patch | download mbox

diff --git a/docs/spice_style.txt b/docs/spice_style.txt
index 68dbeeef..eb2ee252 100644
--- a/docs/spice_style.txt
+++ b/docs/spice_style.txt
@@ -128,6 +128,11 @@  goto
 
 Using goto is allowed in C code for error handling. In any other case it will be used only as a special exception.
 
+switch fall-through
+-------------------
+
+If a switch case falls through (i.e. does not end with a `break`), annotate it with a /* Fall through */ comment. Some compilers will emit a warning otherwise.
+
 Defining Constant values
 ------------------------
 

Comments

> 
> From: Christophe de Dinechin <dinechin@redhat.com>
> 
> Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
> ---
>  docs/spice_style.txt | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/docs/spice_style.txt b/docs/spice_style.txt
> index 68dbeeef..eb2ee252 100644
> --- a/docs/spice_style.txt
> +++ b/docs/spice_style.txt
> @@ -128,6 +128,11 @@ goto
>  
>  Using goto is allowed in C code for error handling. In any other case it
>  will be used only as a special exception.
>  
> +switch fall-through
> +-------------------

I would just use the "switch" title, but not strong about it.

> +
> +If a switch case falls through (i.e. does not end with a `break`), annotate
> it with a /* Fall through */ comment. Some compilers will emit a warning
> otherwise.
> +

I would quote the code comment with `/* fall through */` so gets monospace
font. Also I'd use lower case.

>  Defining Constant values
>  ------------------------
>  

Otherwise,
Acked-by: Frediano Ziglio <fziglio@redhat.com>

Frediano