Re: [PATCH] btrfs: add __printf and __cold attributes to do_abort_log_replay()
From: David Sterba
Date: Tue Oct 20 2026 - 19:05:56 EST
On Tue, Oct 20, 2026 at 09:46:59PM +0200, Adrián García Casado wrote:
> do_abort_log_replay() formats its variadic arguments via struct va_format
> and %pV, and is only called in error paths when aborting log replay via
> the btrfs_abort_log_replay() macro.
>
> Because %pV hides the format string from the compiler, GCC does not warn
> about the missing format attribute under -Wsuggest-attribute=format, and
> callers do not get compile-time format string validation.
>
> Add the __printf(5, 6) and __cold attributes to do_abort_log_replay(),
> matching __btrfs_handle_fs_error() and __btrfs_panic().
>
> Signed-off-by: Adrián García Casado <adriangarciacasado42@xxxxxxxxx>
Reviewed-by: David Sterba <dsterba@xxxxxxxx>
It's a bit confusing that the function definition
__btrfs_handle_fs_error and __btrfs_panic don't have the __printf
annotation, only __cold. It's sufficient to have them only at the
declaration. This would be good to unify, either have it both
declaration+definition or only declaration for the public functions.