Philippe Mathieu-Daudé <[email protected]> writes:

> error_propagate_prepend() "behaves like error_prepend()", and
> error_prepend() uses "formatting @fmt, ... like printf()".
> error_prepend() checks its format string argument, but
> error_propagate_prepend() does not. Fix by addint the format
> attribute to error_propagate_prepend() and error_vprepend().
>
> This would have caught the bug fixed in the previous commit:
>
>     CC      hw/sd/milkymist-memcard.o
>   hw/sd/milkymist-memcard.c: In function ‘milkymist_memcard_realize’:
>   hw/sd/milkymist-memcard.c:284:70: error: format ‘%s’ expects a matching 
> ‘char *’ argument [-Werror=format=]
>     284 |         error_propagate_prepend(errp, err, "failed to init SD card: 
> %s");
>         |                                                                     
> ~^
>         |                                                                     
>  |
>         |                                                                     
>  char *
>
> Missed in commit 4b5766488f "error: Fix use of error_prepend() with
> &error_fatal, &error_abort".
>
> Inspired-by: Stefan Weil <[email protected]>
> Suggested-by: Eric Blake <[email protected]>
> Reviewed-by: Markus Armbruster <[email protected]>
> Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
> ---
> Since v1:
> - Reword (Markus)
> - Add error_vprepend (Stefan)
> - Use local style to add the attribute *after* the declaration,
>   which is invalid on definition where we get (depending on the
>   toolchain):
>
>   . error: attributes should be specified before the declarator in a function 
> definition
>
>   . error: attributes are not allowed on a function-definition
>
> Supersedes: <[email protected]>

Queued with Stefan's R-by from v1.  Hope what's okay.  Thanks!


Reply via email to