pass correct modes to 64bit lowerer
[cparser] / format_check.c
index 93c4c21..06e0f7a 100644 (file)
@@ -23,6 +23,7 @@
 #include "format_check.h"
 #include "symbol_t.h"
 #include "ast_t.h"
+#include "entity_t.h"
 #include "diagnostic.h"
 #include "types.h"
 #include "type_t.h"
@@ -389,7 +390,6 @@ break_fmt_flags:
                        case 'x':
                                allowed_flags = FMT_FLAG_MINUS | FMT_FLAG_HASH | FMT_FLAG_ZERO;
                                goto eval_fmt_mod_unsigned;
-                               break;
 
                        case 'u':
                                allowed_flags = FMT_FLAG_MINUS | FMT_FLAG_ZERO;
@@ -524,7 +524,7 @@ eval_fmt_mod_unsigned:
                        if (wrong_flags & FMT_FLAG_TICK)  wrong[idx++] = '\'';
                        wrong[idx] = '\0';
 
-                       warningf(pos, "invalid format flags \"%s\" in conversion specification %%%c at position", wrong, fmt, num_fmt);
+                       warningf(pos, "invalid format flags \"%s\" in conversion specification %%%c at position %u", wrong, fmt, num_fmt);
                }
 
                if (arg == NULL) {
@@ -552,7 +552,7 @@ eval_fmt_mod_unsigned:
                        }
                        if (is_type_valid(arg_skip)) {
                                warningf(pos,
-                                       "argument type '%T' does not match conversion specifier '%%%s%c' at position",
+                                       "argument type '%T' does not match conversion specifier '%%%s%c' at position %u",
                                        arg_type, get_length_modifier_name(fmt_mod), (char)fmt, num_fmt);
                        }
                }
@@ -637,8 +637,8 @@ void check_format(const call_expression_t *const call)
        if (func_expr->kind != EXPR_REFERENCE)
                return;
 
-       const declaration_t   *const decl = func_expr->reference.declaration;
-       const call_argument_t *      arg  = call->arguments;
+       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 */
@@ -647,7 +647,7 @@ void check_format(const call_expression_t *const call)
                 * 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 = decl->symbol->string;
+               const char *const name = entity->base.symbol->string;
                for(size_t i = 0; i < sizeof(builtin_table) / sizeof(builtin_table[0]); ++i) {
                        if(strcmp(name, builtin_table[i].name) == 0) {
                                if(builtin_table[i].fmt_kind == FORMAT_PRINTF) {