HomeFreeBSD

zfs: rename several printf attribute declarations to __printf__

Description

zfs: rename several printf attribute declarations to printf

For kernel builds, we redefine __printf__ to __freebsd_kprintf__, to
support FreeBSD kernel printf(9) extensions with clang.

In OpenZFS various printf related functions are declared with
attribute((format(printf, X, Y))), so these won't work with the
above redefinition. With clang 21 and higher, this leads to errors
similar to:

sys/contrib/openzfs/module/zfs/spa_misc.c:414:38: error: passing 'printf' format string where 'freebsd_kprintf' format string is expected [-Werror,-Wformat]
  414 |         (void) vsnprintf(buf, sizeof (buf), fmt, adx);
      |                                             ^

Since attribute names can always be spelled with leading and trailing
double underscores, rename these instances.

Note that in FreeBSD proper we usually use __printflike from
<sys/cdefs.h>, but that does not apply to OpenZFS.

Reviewed by: emaste
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D54388

(cherry picked from commit bcd9ea853b14c85a61eb9079c59e966eed336578)

Details

Provenance
dimAuthored on Dec 30 2025, 12:50 PM
Reviewer
emaste
Differential Revision
D54388: zfs: rename several printf attribute declarations to __printf__
Parents
rG752d056fce33: crypto: avoid warnings about too-long initializer strings
Branches
Unknown
Tags
Unknown