X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=format_check.c;h=38423d9bf1d985e6b1fc0f51dbd4109e42ee7067;hb=f56ee1a34627fb21c5909086f3597c76ce9583be;hp=4dbd9327eb1af02a0a89abb5600694981402ea11;hpb=361cba9ab5382420d3c0c8a244f044478644f834;p=cparser diff --git a/format_check.c b/format_check.c index 4dbd932..38423d9 100644 --- a/format_check.c +++ b/format_check.c @@ -88,7 +88,7 @@ static const char* get_length_modifier_name(const format_length_modifier_t mod) [FMT_MOD_I32] = "I32", [FMT_MOD_I64] = "I64" }; - assert(mod < lengthof(names)); + assert((size_t)mod < lengthof(names)); return names[mod]; } @@ -943,31 +943,27 @@ void check_format(const call_expression_t *const call) const entity_t *const entity = func_expr->reference.entity; const call_argument_t * arg = call->arguments; - if (false) { - /* the declaration has a GNU format attribute, check it */ - } else { - /* - * For some functions we always check the format, even if it was not - * specified. This allows to check format even in MS mode or without - * header included. - */ - const char *const name = entity->base.symbol->string; - for (size_t i = 0; i < lengthof(builtin_table); ++i) { - if (strcmp(name, builtin_table[i].name) == 0) { - switch (builtin_table[i].fmt_kind) { - case FORMAT_PRINTF: - check_printf_format(arg, &builtin_table[i]); - break; - case FORMAT_SCANF: - check_scanf_format(arg, &builtin_table[i]); - break; - case FORMAT_STRFTIME: - case FORMAT_STRFMON: - /* TODO: implement other cases */ - break; - } + /* + * For some functions we always check the format, even if it was not + * specified. This allows to check format even in MS mode or without + * header included. + */ + const char *const name = entity->base.symbol->string; + for (size_t i = 0; i < lengthof(builtin_table); ++i) { + if (strcmp(name, builtin_table[i].name) == 0) { + switch (builtin_table[i].fmt_kind) { + case FORMAT_PRINTF: + check_printf_format(arg, &builtin_table[i]); + break; + case FORMAT_SCANF: + check_scanf_format(arg, &builtin_table[i]); + break; + case FORMAT_STRFTIME: + case FORMAT_STRFMON: + /* TODO: implement other cases */ break; } + break; } } }