vnc: Add break statement
PATCH 1/1 vnc: Add break statement
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.
--- ui/vnc-enc-hextile-template.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
ui/vnc-enc-hextile-template.h +1 -0
@@ -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 ; }
Signature · 1 line
1.7.9
Quoted 17 lines · 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 <[email protected]>--- ui/vnc-enc-hextile-template.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)ui/vnc-enc-hextile-template.h +0
-0
ui/vnc-enc-hextile-template.h static void CONCAT(send_hextile_tile_, NAME)(VncState *vs, · line 178
Quoted 4 lines
ui/vnc-enc-hextile-template.h +1
-0@@ -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?
Signature · 2 lines
Eric Blake [email protected] +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Am 25.02.2012 15:18, schrieb Eric Blake:
Quoted 13 lines · Stefan Weil
Quoted 12 lines
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<[email protected]>--- ui/vnc-enc-hextile-template.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
Quoted 10 lines
ui/vnc-enc-hextile-template.h static void CONCAT(send_hextile_tile_, NAME)(VncState *vs, · line 178
Quoted 9 lines
ui/vnc-enc-hextile-template.h +1
-0@@ -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.
Am 25.02.2012 14:57, schrieb Stefan Weil:
Quoted 17 lines
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 <[email protected]>--- ui/vnc-enc-hextile-template.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)ui/vnc-enc-hextile-template.h +0
-0
ui/vnc-enc-hextile-template.h static void CONCAT(send_hextile_tile_, NAME)(VncState *vs, · line 179
Quoted 5 lines
ui/vnc-enc-hextile-template.h +1
-0@@ -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
Quoted 2 lines
ui/vnc-enc-hextile-template.h +0
-0break ; }
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Am 25.02.2012 16:57, schrieb Andreas Färber:
Quoted 27 lines
Am 25.02.2012 14:57, schrieb Stefan Weil:
Quoted 19 lines
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 <[email protected]>---
ui/vnc-enc-hextile-template.h| 1 +1 files changed, 1 insertions(+), 0 deletions(-)ui/vnc-enc-hextile-template.h +0
-0@@ -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 Quoted 4 lines
but we've lost the old values. oh well. */
}
+ break;
default:Doesn't that require a fallthrough comment for other tools then?
Quoted 1 line
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
Andreas Färber
Reviewed-byAm 25.02.2012 17:09, schrieb Stefan Weil:
Quoted 30 lines
Am 25.02.2012 16:57, schrieb Andreas Färber:
Quoted 29 lines
Am 25.02.2012 14:57, schrieb Stefan Weil:
Quoted 21 lines
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 <[email protected]>---
ui/vnc-enc-hextile-template.h| 1 +1 files changed, 1 insertions(+), 0 deletions(-)ui/vnc-enc-hextile-template.h +0
-0@@ -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 Quoted 4 lines
but we've lost the old values. oh well. */
}
+ break;
default:Doesn't that require a fallthrough comment for other tools then?
Quoted 7 lines
Quoted 1 line
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:
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg