This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: C PATCH to add -Wswitch-unreachable (PR c/49859)


On 05/23/2016 12:16 PM, Marek Polacek wrote:

Can we document what a programmer needs to do to suppress the warning? My
worry is that the warning will be too unpredictable to be useful.

Why would you suppress the warning?  Just delete the code that cannot be
executed anyway.  And what is unpredictable?  You don't want the compiler
to warn on
   switch(x) {
     found = 1;
     case 1:
     ...
?

Oh, I misread what the patch was about. It looks sufficiently predictable to do this the GIMPLE level (but it's odd if that's indeed the architecturally correct choice).

Thanks,
Florian


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