Open eaaltonen opened 2 years ago
This style is intentional.
There is another warning (-Wswitch
) that warns if you forget to handle any enum case, but it gets disabled if you add a default (because that's signaling that you intend to cover "everything else not yet mentioned"). However, that's not the case here, as we want to be sure that we always explicitly handle every possible case.
I personally prefer Wswitch-enum
which warns even if you have a default, but that warning tends to get very noisy on legacy code-bases so is less used (I don't know this for sure, but just anecdotally).
I personally prefer the style as it is (as it's compatible with both Wswitch
and Wswitch-enum
). I'll leave this open to hear other opinions though!
I changed the commit so that the warning/error is silenced using a gcc pragma instead. Would you find that acceptable?
@jaredgrubb Care to take a look? By suppressing the warning the library could be used also by code that compiles with switch-default
.
Commit
When a project using docopt.cpp is built with
-Werror=switch-default
option, there's an errorwhich this fixes.
Signed-off-by: Eero Aaltonen eero.aaltonen@vaisala.com