This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] tests: Add break to avoid implicit-fallthrough warning


On Fri, 2019-12-06 at 17:21 +0100, Florian Weimer wrote:
> * Mark Wielaard:
> 
> > For some reason gcc might fail to recognize the assert (0) will never
> > return and emit an implicit-fallthrough warning. Just add a break to
> > silence it.
> 
> Is this with -DNDEBUG?  assert (0) expands to basically nothing in that
> case.  I'm not sure if we should change that.  We cannot realistically
> emit __builtin_unreachable in that case, I think, because it would make
> writing incorrect asserts *really* risky with -DNDEBUG.

That might also trigger it. But in this case it seems like gcc simply
doesn't fold away the if (expr) ... even though expr is clearly 0 and
just warns about the whole statement. It is odd, maybe caused by this
setup not using include files in the standard place? It just seemed
simpler to just add a break then fight with it.

Cheers,

Mark


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]