6 .char_subscripts = true,
8 .empty_statement = false,
11 .implicit_function_declaration = true,
14 .missing_declarations = false,
15 .missing_prototypes = false,
17 .redundant_decls = true,
18 .s_are_errors = false,
20 .sign_compare = false,
21 .strict_prototypes = true,
22 .switch_default = false,
23 .unknown_pragmas = true,
24 .unused_function = false,
25 .unused_label = false,
26 .unused_parameter = false,
28 .unused_variable = false
31 void set_warning_opt(const char *const opt)
38 if (s[0] == 'n' && s[1] == 'o' && s[2] == '-') {
44 #define OPTX(x) else if (strcmp(s, x) == 0)
45 #define SET(y) warning.y = state;
46 #define OPT(x, y) OPTX(x) SET(y)
48 /* Note: this switched on a lot of more warnings than gcc's -Wall */
52 SET(implicit_function_declaration)
58 SET(strict_prototypes)
66 OPT("char-subscripts", char_subscripts)
67 OPT("empty-statement", empty_statement)
68 OPT("error", s_are_errors)
71 // TODO SET(function_end_without_return)
73 // TODO SET(incomplete_aggregate_init)
74 // TODO SET(pointless_comparison)
75 // TODO SET(sign_compare)
79 OPT("fatal-errors", fatal_errors)
80 OPT("float-equal", float_equal)
81 OPT("format", check_format)
83 SET(implicit_function_declaration)
86 OPT("implicit-function-declaration", implicit_function_declaration)
87 OPT("implicit-int", implicit_int)
89 OPT("missing-declarations", missing_declarations)
90 OPT("missing-prototypes", missing_prototypes)
91 OPT("multichar", multichar)
92 OPT("redundant-decls", redundant_decls)
94 OPT("sign-compare", sign_compare)
95 OPT("strict-prototypes", strict_prototypes)
96 OPT("switch-default", switch_default)
97 OPT("unknown-pragmas", unknown_pragmas)
101 SET(unused_parameter)
105 OPT("unused-function", unused_function)
106 OPT("unused-label", unused_label)
107 OPT("unused-parameter", unused_parameter)
108 OPT("unused-value", unused_value)
109 OPT("unused-variable", unused_variable)
114 fprintf(stderr, "warning: ignoring unknown option -W%s\n", opt);