On Fri, May 20, 2016 at 08:17:50PM -0600, Sandra Loosemore wrote:
> On 05/20/2016 10:36 AM, Marek Polacek wrote:
> > diff --git gcc/doc/invoke.texi gcc/doc/invoke.texi
> > index f3d087f..5909b9d 100644
> > --- gcc/doc/invoke.texi
> > +++ gcc/doc/invoke.texi
> > @@ -297,7 +297,8 @@ Objective-C and Objective-C++ Dialects}.
> >   -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]} @gol
> >   -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
> >   -Wmissing-format-attribute -Wsubobject-linkage @gol
> > --Wswitch  -Wswitch-default  -Wswitch-enum -Wswitch-bool -Wsync-nand @gol
> > +-Wswitch  -Wswitch-default  -Wswitch-enum -Wswitch-bool @gol
> > +-Wswitch-unreachable  -Wsync-nand @gol
> >   -Wsystem-headers  -Wtautological-compare  -Wtrampolines  -Wtrigraphs @gol
> >   -Wtype-limits  -Wundef @gol
> >   -Wuninitialized  -Wunknown-pragmas  -Wunsafe-loop-optimizations @gol
> 
> I think this list is supposed to be alphabetized except with respect to
> -Wno-foo being sorted as if it were -Wfoo.  I realize there are other
> inconsistencies, but can you at least keep the -Wswitch* entries in proper
> order?
 
Sure, fixed.

> > @@ -4144,6 +4145,39 @@ switch ((int) (a == 4))
> >   @end smallexample
> >   This warning is enabled by default for C and C++ programs.
> > 
> > +@item -Wswitch-unreachable
> > +@opindex Wswitch-unreachable
> > +@opindex Wno-switch-unreachable
> > +Warn whenever a @code{switch} statement contains statements between the
> > +controlling expression and the first case label, which will never be
> > +executed.  For example:
> > +@smallexample
> > +@group
> > +switch (cond)
> > +  @{
> > +   i = 15;
> > +  @dots{}
> > +   case 5:
> > +  @dots{}
> > +  @}
> > +@end group
> > +@end smallexample
> > +@option{-Wswitch-unreachable} will not warn if the statement between the
> 
> s/will/does/

OK. 

> > +controlling expression and the first case label is just a declaration:
> > +@smallexample
> > +@group
> > +switch (cond)
> > +  @{
> > +   int i;
> > +  @dots{}
> > +   case 5:
> > +   i = 5;
> > +  @dots{}
> > +  @}
> > +@end group
> > +@end smallexample
> > +This warning is enabled by default for C and C++ programs.
> > +
> >   @item -Wsync-nand @r{(C and C++ only)}
> >   @opindex Wsync-nand
> >   @opindex Wno-sync-nand
> 
> The doc part of the patch is OK with those things fixed.

Thanks, I made the changes.

        Marek

Reply via email to