void check_format(const call_expression_t *const call)
{
- if (!warning.check_format)
+ if (!warning.format)
return;
const expression_t *const func_expr = call->function;
warning_t warning = {
.attribute = true,
.char_subscripts = true,
- .check_format = true,
+ .format = true,
+ .nonnull = true,
.empty_statement = false,
.fatal_errors = false,
.float_equal = false,
/* Note: this switched on a lot of more warnings than gcc's -Wall */
SET(attribute)
SET(char_subscripts)
- SET(check_format)
+ SET(format)
+ SET(nonnull)
SET(empty_statement)
SET(implicit_function_declaration)
SET(implicit_int)
}
OPT("fatal-errors", fatal_errors)
OPT("float-equal", float_equal)
- OPT("format", check_format)
+ OPTX("format") {
+ SET(format)
+ SET(nonnull)
+ }
+ OPT("nonnull", nonnull)
OPTX("implicit") {
SET(implicit_function_declaration)
SET(implicit_int)
#endif
bool attribute:1; /**< Warn if an unexpected `__attribute__' is used or function attributes applied to variables, etc. */
bool char_subscripts:1; /**< Warn if an array subscript has the type 'char' */
- bool check_format:1; /**< Check printf-style format strings */
+ bool format:1; /**< Check printf-style format strings */
+ bool nonnull:1; /**< Warn about passing a null pointer for arguments marked nonnull */
#if 0 // TODO
bool cast_align:1; /**< Warn whenever a pointer is cast such that the required alignment of the target is increased */
bool cast_qual:1; /**< Warn whenever a pointer is cast so as to remove a type qualifier from the target type */