* [Qemu-devel] [PATCH] vnc: Add break statement
@ 2012-02-25 13:57 Stefan Weil
2012-02-25 14:18 ` Eric Blake
2012-02-25 15:57 ` Andreas Färber
0 siblings, 2 replies; 6+ messages in thread
From: Stefan Weil @ 2012-02-25 13:57 UTC (permalink / raw)
To: QEMU Trivial; +Cc: Stefan Weil, Anthony Liguori, qemu-devel
This was not a bug, but it is not common practice to omit the break statement
from the last case statement before an empty default case.
Any change of the default case would introduce a bug.
This was reported as a warning by splint.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
ui/vnc-enc-hextile-template.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/ui/vnc-enc-hextile-template.h b/ui/vnc-enc-hextile-template.h
index b9f9f5e..a7310e1 100644
--- a/ui/vnc-enc-hextile-template.h
+++ b/ui/vnc-enc-hextile-template.h
@@ -175,6 +175,7 @@ static void CONCAT(send_hextile_tile_, NAME)(VncState *vs,
/* we really don't have to invalidate either the bg or fg
but we've lost the old values. oh well. */
}
+ break;
default:
break;
}
--
1.7.9
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] vnc: Add break statement
2012-02-25 13:57 [Qemu-devel] [PATCH] vnc: Add break statement Stefan Weil
@ 2012-02-25 14:18 ` Eric Blake
2012-02-25 14:38 ` Stefan Weil
2012-02-25 15:57 ` Andreas Färber
1 sibling, 1 reply; 6+ messages in thread
From: Eric Blake @ 2012-02-25 14:18 UTC (permalink / raw)
To: Stefan Weil; +Cc: QEMU Trivial, Anthony Liguori, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1063 bytes --]
On 02/25/2012 06:57 AM, Stefan Weil wrote:
> This was not a bug, but it is not common practice to omit the break statement
> from the last case statement before an empty default case.
>
> Any change of the default case would introduce a bug.
>
> This was reported as a warning by splint.
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
> ui/vnc-enc-hextile-template.h | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/ui/vnc-enc-hextile-template.h b/ui/vnc-enc-hextile-template.h
> index b9f9f5e..a7310e1 100644
> --- a/ui/vnc-enc-hextile-template.h
> +++ b/ui/vnc-enc-hextile-template.h
> @@ -175,6 +175,7 @@ static void CONCAT(send_hextile_tile_, NAME)(VncState *vs,
> /* we really don't have to invalidate either the bg or fg
> but we've lost the old values. oh well. */
> }
> + break;
TABs vs. space looks odd. Does this file also need a whitespace cleanup?
--
Eric Blake eblake@redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 620 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] vnc: Add break statement
2012-02-25 14:18 ` Eric Blake
@ 2012-02-25 14:38 ` Stefan Weil
0 siblings, 0 replies; 6+ messages in thread
From: Stefan Weil @ 2012-02-25 14:38 UTC (permalink / raw)
To: Eric Blake; +Cc: QEMU Trivial, Anthony Liguori, qemu-devel
Am 25.02.2012 15:18, schrieb Eric Blake:
> On 02/25/2012 06:57 AM, Stefan Weil wrote:
>> This was not a bug, but it is not common practice to omit the break statement
>> from the last case statement before an empty default case.
>>
>> Any change of the default case would introduce a bug.
>>
>> This was reported as a warning by splint.
>>
>> Signed-off-by: Stefan Weil<sw@weilnetz.de>
>> ---
>> ui/vnc-enc-hextile-template.h | 1 +
>> 1 files changed, 1 insertions(+), 0 deletions(-)
>>
>> diff --git a/ui/vnc-enc-hextile-template.h b/ui/vnc-enc-hextile-template.h
>> index b9f9f5e..a7310e1 100644
>> --- a/ui/vnc-enc-hextile-template.h
>> +++ b/ui/vnc-enc-hextile-template.h
>> @@ -175,6 +175,7 @@ static void CONCAT(send_hextile_tile_, NAME)(VncState *vs,
>> /* we really don't have to invalidate either the bg or fg
>> but we've lost the old values. oh well. */
>> }
>> + break;
> TABs vs. space looks odd. Does this file also need a whitespace cleanup?
2 times yes.
It's not the only file with tabs instead of spaces.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] vnc: Add break statement
2012-02-25 13:57 [Qemu-devel] [PATCH] vnc: Add break statement Stefan Weil
2012-02-25 14:18 ` Eric Blake
@ 2012-02-25 15:57 ` Andreas Färber
2012-02-25 16:09 ` Stefan Weil
1 sibling, 1 reply; 6+ messages in thread
From: Andreas Färber @ 2012-02-25 15:57 UTC (permalink / raw)
To: Stefan Weil; +Cc: QEMU Trivial, Anthony Liguori, qemu-devel
Am 25.02.2012 14:57, schrieb Stefan Weil:
> This was not a bug, but it is not common practice to omit the break statement
> from the last case statement before an empty default case.
>
> Any change of the default case would introduce a bug.
>
> This was reported as a warning by splint.
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
> ui/vnc-enc-hextile-template.h | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/ui/vnc-enc-hextile-template.h b/ui/vnc-enc-hextile-template.h
> index b9f9f5e..a7310e1 100644
> --- a/ui/vnc-enc-hextile-template.h
> +++ b/ui/vnc-enc-hextile-template.h
> @@ -175,6 +175,7 @@ static void CONCAT(send_hextile_tile_, NAME)(VncState *vs,
> /* we really don't have to invalidate either the bg or fg
> but we've lost the old values. oh well. */
> }
> + break;
> default:
Doesn't that require a fallthrough comment for other tools then?
Andreas
> break;
> }
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] vnc: Add break statement
2012-02-25 15:57 ` Andreas Färber
@ 2012-02-25 16:09 ` Stefan Weil
2012-02-25 16:18 ` Andreas Färber
0 siblings, 1 reply; 6+ messages in thread
From: Stefan Weil @ 2012-02-25 16:09 UTC (permalink / raw)
To: Andreas Färber; +Cc: QEMU Trivial, Anthony Liguori, qemu-devel
Am 25.02.2012 16:57, schrieb Andreas Färber:
> Am 25.02.2012 14:57, schrieb Stefan Weil:
>> This was not a bug, but it is not common practice to omit the break
>> statement
>> from the last case statement before an empty default case.
>>
>> Any change of the default case would introduce a bug.
>>
>> This was reported as a warning by splint.
>>
>> Signed-off-by: Stefan Weil <sw@weilnetz.de>
>> ---
>> ui/vnc-enc-hextile-template.h | 1 +
>> 1 files changed, 1 insertions(+), 0 deletions(-)
>>
>> diff --git a/ui/vnc-enc-hextile-template.h
>> b/ui/vnc-enc-hextile-template.h
>> index b9f9f5e..a7310e1 100644
>> --- a/ui/vnc-enc-hextile-template.h
>> +++ b/ui/vnc-enc-hextile-template.h
>> @@ -175,6 +175,7 @@ static void CONCAT(send_hextile_tile_,
>> NAME)(VncState *vs,
>> /* we really don't have to invalidate either the bg or fg
>> but we've lost the old values. oh well. */
>> }
>> + break;
>> default:
>
> Doesn't that require a fallthrough comment for other tools then?
>
> Andreas
It was a fall through (so a comment would have satisfied static code
analyzers), but with the added 'break' it no longer is.
As I tried to explain in the commit message, a fall through would
not be reasonable in this special case.
Cheers, Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] vnc: Add break statement
2012-02-25 16:09 ` Stefan Weil
@ 2012-02-25 16:18 ` Andreas Färber
0 siblings, 0 replies; 6+ messages in thread
From: Andreas Färber @ 2012-02-25 16:18 UTC (permalink / raw)
To: Stefan Weil; +Cc: QEMU Trivial, Anthony Liguori, qemu-devel
Am 25.02.2012 17:09, schrieb Stefan Weil:
> Am 25.02.2012 16:57, schrieb Andreas Färber:
>> Am 25.02.2012 14:57, schrieb Stefan Weil:
>>> This was not a bug, but it is not common practice to omit the break
>>> statement
>>> from the last case statement before an empty default case.
>>>
>>> Any change of the default case would introduce a bug.
>>>
>>> This was reported as a warning by splint.
>>>
>>> Signed-off-by: Stefan Weil <sw@weilnetz.de>
>>> ---
>>> ui/vnc-enc-hextile-template.h | 1 +
>>> 1 files changed, 1 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/ui/vnc-enc-hextile-template.h
>>> b/ui/vnc-enc-hextile-template.h
>>> index b9f9f5e..a7310e1 100644
>>> --- a/ui/vnc-enc-hextile-template.h
>>> +++ b/ui/vnc-enc-hextile-template.h
>>> @@ -175,6 +175,7 @@ static void CONCAT(send_hextile_tile_,
>>> NAME)(VncState *vs,
>>> /* we really don't have to invalidate either the bg or fg
>>> but we've lost the old values. oh well. */
>>> }
>>> + break;
>>> default:
>>
>> Doesn't that require a fallthrough comment for other tools then?
>>
>> Andreas
>
> It was a fall through (so a comment would have satisfied static code
> analyzers), but with the added 'break' it no longer is.
>
> As I tried to explain in the commit message, a fall through would
> not be reasonable in this special case.
Ah sorry, my comment was based on reading "omit break before default" in
the commit message; tired, should've looked more closely. FWIW:
Reviewed-by: Andreas Färber <afaerber@suse.de>
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-02-25 16:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-25 13:57 [Qemu-devel] [PATCH] vnc: Add break statement Stefan Weil
2012-02-25 14:18 ` Eric Blake
2012-02-25 14:38 ` Stefan Weil
2012-02-25 15:57 ` Andreas Färber
2012-02-25 16:09 ` Stefan Weil
2012-02-25 16:18 ` Andreas Färber
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).