[Bug debug/35502] -Wall should include -Wswitch-default

2008-03-07 Thread jeff at schwabcenter dot com


--- Comment #1 from jeff at schwabcenter dot com  2008-03-07 23:21 ---
Created an attachment (id=15277)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15277action=view)
Preprocessed sample code

Compiling the attached file with g++ -Wall should produce warning: switch
missing default case.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35502



[Bug debug/35502] -Wall should include -Wswitch-default

2008-03-07 Thread jeff at schwabcenter dot com


--- Comment #2 from jeff at schwabcenter dot com  2008-03-07 23:24 ---
Created an attachment (id=15278)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15278action=view)
Fix for this bug

Setting warn_switch_default = value in the OPT_Wall case of
c_common_handle_option (in gcc/c-opts.c) fixes the problem.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35502



[Bug debug/35502] -Wall should include -Wswitch-default

2008-03-07 Thread pinskia at gcc dot gnu dot org


--- Comment #3 from pinskia at gcc dot gnu dot org  2008-03-07 23:26 ---
This is a documentation fix which has already happened, see
http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html .
-Wall
This enables all the warnings about constructions that some users consider
questionable, and that are easy to avoid (or modify to prevent the warning),
even in conjunction with macros. This also enables some language-specific
warnings described in C++ Dialect Options and Objective-C and Objective-C++
Dialect Options.
-Wall turns on the following warning flags:

  -Waddress   
  -Warray-bounds (only with -O2)  
  -Wc++0x-compat  
  -Wchar-subscripts  
  -Wimplicit-int  
  -Wimplicit-function-declaration  
  -Wcomment  
  -Wformat   
  -Wmain (only for C/ObjC and unless -ffreestanding)  
  -Wmissing-braces  
  -Wnonnull  
  -Wparentheses  
  -Wpointer-sign  
  -Wreorder   
  -Wreturn-type  
  -Wsequence-point  
  -Wsign-compare (only in C++)  
  -Wstrict-aliasing  
  -Wstrict-overflow=1  
  -Wswitch  
  -Wtrigraphs  
  -Wuninitialized (only with -O1 and above)  
  -Wunknown-pragmas  
  -Wunused-function  
  -Wunused-label 
  -Wunused-value 
  -Wunused-variable  
  -Wvolatile-register-var 



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35502



[Bug debug/35502] -Wall should include -Wswitch-default

2008-03-07 Thread pinskia at gcc dot gnu dot org


--- Comment #4 from pinskia at gcc dot gnu dot org  2008-03-07 23:31 ---
See http://gcc.gnu.org/ml/gcc-patches/2007-09/msg01761.html and
http://archives.free.net.ph/message/20071001.204624.0ca57fae.de.html

.


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||FIXED
   Target Milestone|--- |4.3.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35502



[Bug debug/35502] -Wall should include -Wswitch-default

2008-03-07 Thread jeff at schwabcenter dot com


--- Comment #5 from jeff at schwabcenter dot com  2008-03-07 23:38 ---
Thanks for the quick response and the links.  FYI, the latter link seems to be
broken:

http://archives.free.net.ph/message/20071001.204624.0ca57fae.de.html

Is there any particular reason for changing the docs, rather than the code? 
Include Wswitch-default in Wall is intuitive to me, and avoiding the warning is
straight-forward (if not trivial).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35502



[Bug debug/35502] -Wall should include -Wswitch-default

2008-03-07 Thread jeff at schwabcenter dot com


--- Comment #6 from jeff at schwabcenter dot com  2008-03-07 23:42 ---
 Is there any particular reason for changing the docs, rather than the code? 

Kindly disregard that question.  I have just been informed by a co-worker that
some of our third-party library headers include switch statements without
default cases, so adding -Wswitch-default to -Wall would make our lives more
difficult, anyway. :(


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35502



[Bug debug/35502] -Wall should include -Wswitch-default

2008-03-07 Thread jeff at schwabcenter dot com


--- Comment #7 from jeff at schwabcenter dot com  2008-03-07 23:43 ---
http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html does not list
-Wswitch-default being enabled by -Wall.


-- 

jeff at schwabcenter dot com changed:

   What|Removed |Added

 Status|RESOLVED|VERIFIED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35502