Page MenuHomeFreeBSD

zfs: rename several printf attribute declarations to __printf__
ClosedPublic

Authored by dim on Dec 28 2025, 10:33 PM.
Tags
None
Referenced Files
F167880375: D54388.diff
Tue, Aug 25, 5:28 AM
Unknown Object (File)
Mon, Aug 24, 9:02 AM
Unknown Object (File)
Sun, Aug 23, 3:12 AM
Unknown Object (File)
Sat, Aug 22, 10:00 AM
Unknown Object (File)
Sat, Aug 15, 5:59 AM
Unknown Object (File)
Wed, Aug 12, 9:51 AM
Unknown Object (File)
Tue, Aug 11, 7:58 PM
Unknown Object (File)
Mon, Aug 10, 12:55 PM
Subscribers

Details

Summary

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.

MFC after: 3 days

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable