diff mbox

Implement -Wimplicit-fallthrough (take 2): fix missing breaks

Message ID 20160727165212.GW7007@redhat.com
State New
Headers show

Commit Message

Marek Polacek July 27, 2016, 4:52 p.m. UTC
This is what the new warning pointed out.  I think all these are bugs.

This patch has been tested on powerpc64le-unknown-linux-gnu, aarch64-linux-gnu,
and x86_64-redhat-linux.

2016-07-27  Marek Polacek  <polacek@redhat.com>

	PR c/7652
gcc/
	* config/i386/i386.c (ix86_expand_args_builtin): Add break.
	(ix86_expand_round_builtin): Likewise.
	* config/rs6000/rs6000.c (altivec_expand_ld_builtin): Add break.
	(altivec_expand_st_builtin): Likewise.
	* gengtype.c (dbgprint_count_type_at): Add break.
gcc/java/
	* jcf-dump.c (print_constant): Add break.
libgo/
	* runtime/heapdump.c (dumpefacetypes): Add break.


	Marek

Comments

Mike Stump July 27, 2016, 5:05 p.m. UTC | #1
On Jul 27, 2016, at 9:52 AM, Marek Polacek <polacek@redhat.com> wrote:
> 
> This is what the new warning pointed out.  I think all these are bugs.
> 
> --- gcc/libgo/runtime/heapdump.c
> +++ gcc/libgo/runtime/heapdump.c
> @@ -766,6 +766,7 @@ dumpefacetypes(void *obj __attribute__ ((unused)), uintptr size, const Type *typ
> 		for(i = 0; i <= size - type->__size; i += type->__size)
> 			//playgcprog(i, (uintptr*)type->gc + 1, dumpeface_callback, obj);
> 		break;
> +		break;
> 	case TypeInfo_Chan:
> 		if(type->__size == 0) // channels may have zero-sized objects in them
> 			break;

I disagree that's the best fix.  Better would be to uncomment out the playgcprog calls, and #if 0 the entire contents of the function.
Tom Tromey July 27, 2016, 5:43 p.m. UTC | #2
>>>>> "Marek" == Marek Polacek <polacek@redhat.com> writes:

Marek> gcc/java/
Marek> 	* jcf-dump.c (print_constant): Add break.

This bit is ok.

Tom
Jeff Law July 27, 2016, 8:17 p.m. UTC | #3
On 07/27/2016 10:52 AM, Marek Polacek wrote:
> This is what the new warning pointed out.  I think all these are bugs.
>
> This patch has been tested on powerpc64le-unknown-linux-gnu, aarch64-linux-gnu,
> and x86_64-redhat-linux.
>
> 2016-07-27  Marek Polacek  <polacek@redhat.com>
>
> 	PR c/7652
> gcc/
> 	* config/i386/i386.c (ix86_expand_args_builtin): Add break.
> 	(ix86_expand_round_builtin): Likewise.
> 	* config/rs6000/rs6000.c (altivec_expand_ld_builtin): Add break.
> 	(altivec_expand_st_builtin): Likewise.
> 	* gengtype.c (dbgprint_count_type_at): Add break.
> gcc/java/
> 	* jcf-dump.c (print_constant): Add break.
> libgo/
> 	* runtime/heapdump.c (dumpefacetypes): Add break.
Note that I think libgo's runtime is shared with golang and that Ian 
imports the runtime from that project.

jeff
Marek Polacek July 28, 2016, 3:35 p.m. UTC | #4
On Wed, Jul 27, 2016 at 11:43:22AM -0600, Tom Tromey wrote:
> >>>>> "Marek" == Marek Polacek <polacek@redhat.com> writes:
> 
> Marek> gcc/java/
> Marek> 	* jcf-dump.c (print_constant): Add break.
> 
> This bit is ok.

Thanks Tom.  I think I'll just commit this hunk separately to not post
already approved bits again.

	Marek
Marek Polacek July 28, 2016, 3:59 p.m. UTC | #5
On Wed, Jul 27, 2016 at 02:17:35PM -0600, Jeff Law wrote:
> On 07/27/2016 10:52 AM, Marek Polacek wrote:
> > This is what the new warning pointed out.  I think all these are bugs.
> > 
> > This patch has been tested on powerpc64le-unknown-linux-gnu, aarch64-linux-gnu,
> > and x86_64-redhat-linux.
> > 
> > 2016-07-27  Marek Polacek  <polacek@redhat.com>
> > 
> > 	PR c/7652
> > gcc/
> > 	* config/i386/i386.c (ix86_expand_args_builtin): Add break.
> > 	(ix86_expand_round_builtin): Likewise.
> > 	* config/rs6000/rs6000.c (altivec_expand_ld_builtin): Add break.
> > 	(altivec_expand_st_builtin): Likewise.
> > 	* gengtype.c (dbgprint_count_type_at): Add break.
> > gcc/java/
> > 	* jcf-dump.c (print_constant): Add break.
> > libgo/
> > 	* runtime/heapdump.c (dumpefacetypes): Add break.
> Note that I think libgo's runtime is shared with golang and that Ian imports
> the runtime from that project.

Yea, I think so; I asked Ian whether he wants to help out with that.

	Marek
diff mbox

Patch

--- gcc/gcc/config/i386/i386.c
+++ gcc/gcc/config/i386/i386.c
@@ -40171,6 +40187,7 @@  ix86_expand_args_builtin (const struct builtin_description *d,
     case 5:
       pat = GEN_FCN (icode) (real_target, args[0].op, args[1].op,
 			     args[2].op, args[3].op, args[4].op);
+      break;
     case 6:
       pat = GEN_FCN (icode) (real_target, args[0].op, args[1].op,
 			     args[2].op, args[3].op, args[4].op,
@@ -40545,6 +40562,7 @@  ix86_expand_round_builtin (const struct builtin_description *d,
     case 5:
       pat = GEN_FCN (icode) (target, args[0].op, args[1].op,
 			     args[2].op, args[3].op, args[4].op);
+      break;
     case 6:
       pat = GEN_FCN (icode) (target, args[0].op, args[1].op,
 			     args[2].op, args[3].op, args[4].op,
--- gcc/gcc/config/rs6000/rs6000.c
+++ gcc/gcc/config/rs6000/rs6000.c
@@ -14401,6 +14401,7 @@  altivec_expand_ld_builtin (tree exp, rtx target, bool *expandedp)
       break;
     case ALTIVEC_BUILTIN_LD_INTERNAL_2di:
       icode = CODE_FOR_vector_altivec_load_v2di;
+      break;
     case ALTIVEC_BUILTIN_LD_INTERNAL_1ti:
       icode = CODE_FOR_vector_altivec_load_v1ti;
       break;
@@ -14462,6 +14463,7 @@  altivec_expand_st_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
       break;
     case ALTIVEC_BUILTIN_ST_INTERNAL_2di:
       icode = CODE_FOR_vector_altivec_store_v2di;
+      break;
     case ALTIVEC_BUILTIN_ST_INTERNAL_1ti:
       icode = CODE_FOR_vector_altivec_store_v1ti;
       break;
--- gcc/gcc/gengtype.c
+++ gcc/gcc/gengtype.c
@@ -175,6 +175,7 @@  dbgprint_count_type_at (const char *fil, int lin, const char *msg, type_p t)
 	{
 	case TYPE_UNDEFINED:
 	  nb_undefined++;
+	  break;
 	case TYPE_SCALAR:
 	  nb_scalar++;
 	  break;
--- gcc/gcc/java/jcf-dump.c
+++ gcc/gcc/java/jcf-dump.c
@@ -926,6 +926,7 @@  print_constant (FILE *out, JCF *jcf, int index, int verbosity)
 	  if (verbosity > 0)
 	    fprintf (out, "Fieldref: %ld=", (long) JPOOL_USHORT2 (jcf, index));
 	  print_constant (out, jcf, JPOOL_USHORT2 (jcf, index), 0);
+	  break;
 	case 5:
 	case 6:
 	case 7:
--- gcc/libgo/runtime/heapdump.c
+++ gcc/libgo/runtime/heapdump.c
@@ -766,6 +766,7 @@  dumpefacetypes(void *obj __attribute__ ((unused)), uintptr size, const Type *typ
 		for(i = 0; i <= size - type->__size; i += type->__size)
 			//playgcprog(i, (uintptr*)type->gc + 1, dumpeface_callback, obj);
 		break;
+		break;
 	case TypeInfo_Chan:
 		if(type->__size == 0) // channels may have zero-sized objects in them
 			break;