This checking is currently done by check_assignment_types() but as an extension, specific pointer types will be checked. So, add a custom checking function, currently accepting any pointer type. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- verify-format.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/verify-format.c b/verify-format.c index 1b40b2c796a2..cd55a49e0676 100644 --- a/verify-format.c +++ b/verify-format.c @@ -181,12 +181,24 @@ static int printf_fmt_length(struct format_type *fmt, return !(*typediff = check_printf_length(fmt, ctype)); } +// For 'p' specifiers +static const char *check_printf_pointer(struct format_type *fmt, struct symbol *source) +{ + const char *typediff = "different base types"; + struct symbol *base; + + if (type_class(source, &base) != CLASS_PTR) + return typediff; + // FIXME: check or ignore address spaces + return NULL; +} + static int printf_fmt_pointer(struct format_type *fmt, struct expression **expr, struct symbol *ctype, const char **typediff) { - return check_assignment_types(fmt->type, expr, typediff); + return !(*typediff = check_printf_pointer(fmt, ctype)); } static int printf_fmt_print_pointer(struct format_type *fmt, -- 2.28.0