------- Comment #8 from manu at gcc dot gnu dot org  2008-08-13 10:49 -------
@Bernhard

You need to properly submit the patch to gcc-patches (plus copyright assignment
in place, testcases, changelog)?

See http://gcc.gnu.org/contribute.html

As for the patch itself. Notice that c_do_switch_warnings returns before your
code

 if (!warn_switch && !warn_switch_enum && !warn_switch_default)
    return;

If you make your warning conditional on Wunreachable-code, you need to add
warn_unreachable_code to that test. Alternatively, make it conditional on
-Wswitch and it will work. Then, you should use warning (OPT_Wswitch, "").
Also, you should pass to warning a explicit location (ideally, the one
corresponding ot the default label or if that is not possible, then the one of
the switch):

warning (OPT_Wswitch, "%Hwarning", &location);


Bonus points if the code for this and enums could be merged somehow!


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org


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

Reply via email to