statement->body = parse_statement();
current_switch = rem;
+ if (warning.switch_default && find_default_label(statement) == NULL) {
+ warningf(statement->statement.source_position, "switch has no default case");
+ }
+
return (statement_t*) statement;
}
OPT("missing-prototypes", missing_prototypes)
OPT("redundant-decls", redundant_decls)
OPT("strict-prototypes", strict_prototypes)
+ OPT("switch-default", switch_default)
#if 0
OPTX("unused") {
SET(unused_function)
warning_t warning = {
.char_subscripts = true,
.check_format = true,
+ .fatal_errors = false,
.implicit_function_declaration = true,
.implicit_int = true,
.missing_declarations = true,
.missing_prototypes = true,
- .strict_prototypes = true,
.redundant_decls = true,
+ .s_are_errors = false,
+ .strict_prototypes = true,
+ .switch_default = false,
.unused_value = true
};
bool strict_aliasing:1; /* Warn about code which might break the strict aliasing rules that the compiler is using for optimization. */
#endif
bool strict_prototypes:1; /* warn if a function declaration has an unspecified parameter list */
-#if 0 // TODO
bool switch_default:1; /* Warn whenever a 'switch' statement does not have a 'default' case */
+#if 0 // TODO
bool switch_enum:1; /* Warn about 'switch' statements with an enum as index type and missing case labels or case labels outside the enum range TODO has an alias -Wswitch? */
bool traditional:1; /* Warn about certain constructs that behave differently in traditional and ISO C */
bool undef:1; /* Warn if an undefined identifier is evaluated in an '#if' directive */