The g++ man page says -Wall is equivalent to "All of the above -W
options combined."  The -Wswitch-default option should therefore be included in
-Wall, but currently is not.

The correct solution IMO is to add -Wswitch-default to -Wall in c-opts.c. 
Please see the attached patch.

Script started on Fri Mar  7 12:16:38 2008
~$ g++ -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc/configure --enable-languages=c++
--prefix=/export/home/jeff/opt/gcc
Thread model: posix
gcc version 4.2.4 20080214 (prerelease)
~$ g++ -Wall -Wswitch-default main.cc
main.cc: In function 'int main(int, char**)':
main.cc:1: warning: switch missing default case
~$ g++ -Wall main.cc -save-temps
~$ cat main.ii
# 1 "main.cc"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "main.cc"
int main(int argc, char** argv) { switch (argc) { } }
Script done on Fri Mar  7 12:17:25 2008


-- 
           Summary: -Wall should include -Wswitch-default
           Product: gcc
           Version: 4.2.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jeff at schwabcenter dot com


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

Reply via email to