This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Implement -Wimplicit-fallthrough (take 2): fix missing breaks
- From: Marek Polacek <polacek at redhat dot com>
- To: Mike Stump <mikestump at comcast dot net>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Ian Lance Taylor <iant at golang dot org>, Segher Boessenkool <segher at kernel dot crashing dot org>
- Date: Thu, 28 Jul 2016 17:57:34 +0200
- Subject: Re: Implement -Wimplicit-fallthrough (take 2): fix missing breaks
- Authentication-results: sourceware.org; auth=none
- References: <20160727165212.GW7007@redhat.com> <A842D501-781B-4465-869C-AAF17C6075EA@comcast.net>
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?
Segher, is the rs6000.c part ok?
How about the rest?
Thanks.
2016-07-28 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): Likewise.
(altivec_expand_st_builtin): Likewise.
* gengtype.c (dbgprint_count_type_at): Likewise.
libgo/
* runtime/heapdump.c (dumpefacetypes): Comment out content. Add unused
attribute.
diff --git gcc/gcc/config/i386/i386.c gcc/gcc/config/i386/i386.c
index 246c6b5..7c8bb17 100644
--- gcc/gcc/config/i386/i386.c
+++ gcc/gcc/config/i386/i386.c
@@ -40172,6 +40172,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,
@@ -40546,6 +40547,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,
diff --git gcc/gcc/config/rs6000/rs6000.c gcc/gcc/config/rs6000/rs6000.c
index e5d8ad0..27442e1 100644
--- gcc/gcc/config/rs6000/rs6000.c
+++ gcc/gcc/config/rs6000/rs6000.c
@@ -14421,6 +14421,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;
@@ -14482,6 +14483,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;
diff --git gcc/gcc/gengtype.c gcc/gcc/gengtype.c
index 5479b8f..0518355 100644
--- 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;
diff --git gcc/libgo/runtime/heapdump.c gcc/libgo/runtime/heapdump.c
index d0cfb01..1e7678a 100644
--- gcc/libgo/runtime/heapdump.c
+++ gcc/libgo/runtime/heapdump.c
@@ -754,23 +754,28 @@ dumpeface_callback(void *p, uintptr kind, uintptr offset)
// Dump all the types that appear in the type field of
// any Eface contained in obj.
static void
-dumpefacetypes(void *obj __attribute__ ((unused)), uintptr size, const Type *type, uintptr kind)
+dumpefacetypes(void *obj __attribute__ ((unused)),
+ uintptr size __attribute__ ((unused)),
+ const Type *type __attribute__ ((unused)),
+ uintptr kind __attribute__ ((unused)))
{
+#if 0
uintptr i;
switch(kind) {
case TypeInfo_SingleObject:
- //playgcprog(0, (uintptr*)type->gc + 1, dumpeface_callback, obj);
+ playgcprog(0, (uintptr*)type->gc + 1, dumpeface_callback, obj);
break;
case TypeInfo_Array:
for(i = 0; i <= size - type->__size; i += type->__size)
- //playgcprog(i, (uintptr*)type->gc + 1, dumpeface_callback, obj);
+ 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)
- //playgcprog(i, (uintptr*)type->gc + 1, dumpeface_callback, obj);
+ playgcprog(i, (uintptr*)type->gc + 1, dumpeface_callback, obj);
break;
}
+#endif
}
Marek