diff mbox

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

Message ID CAOyqgcUM5Xu48tPvjJeL++3B28jgB9VFMP415=cEzZtcpNmh7w@mail.gmail.com
State New
Headers show

Commit Message

Ian Lance Taylor Aug. 4, 2016, 5:21 p.m. UTC
On Thu, Jul 28, 2016 at 8:57 AM, Marek Polacek <polacek@redhat.com> wrote:
> On Wed, Jul 27, 2016 at 10:05:25AM -0700, Mike Stump wrote:
>> 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.
>
> You're right -- I only looked at the particular switch case, not the entire
> function.  I did as you suggested.  Ian, do you want to take care of this?

Thanks for pointing it out.  I committed this patch to fix the problem.

For the patch bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.

Ian
diff mbox

Patch

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 239141)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@ 
-235dffb0de1e99d6f521f052067f0e936bf63baa
+ae44ca35b0b1c2ab925cadbcd7d47b334be5a318
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: libgo/runtime/heapdump.c
===================================================================
--- libgo/runtime/heapdump.c	(revision 238653)
+++ libgo/runtime/heapdump.c	(working copy)
@@ -763,14 +763,16 @@  dumpefacetypes(void *obj __attribute__ (
 		//playgcprog(0, (uintptr*)type->gc + 1, dumpeface_callback, obj);
 		break;
 	case TypeInfo_Array:
-		for(i = 0; i <= size - type->__size; i += type->__size)
+		for(i = 0; i <= size - type->__size; i += type->__size) {
 			//playgcprog(i, (uintptr*)type->gc + 1, dumpeface_callback, obj);
+		}
 		break;
 	case TypeInfo_Chan:
 		if(type->__size == 0) // channels may have zero-sized objects in them
 			break;
-		for(i = runtime_Hchansize; i <= size - type->__size; i += type->__size)
+		for(i = runtime_Hchansize; i <= size - type->__size; i += type->__size) {
 			//playgcprog(i, (uintptr*)type->gc + 1, dumpeface_callback, obj);
+		}
 		break;
 	}
 }