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
Unknown Object (File)
Wed, Jan 28, 3:37 AM
Unknown Object (File)
Fri, Jan 16, 4:08 PM
Unknown Object (File)
Fri, Jan 16, 9:35 AM
Unknown Object (File)
Tue, Jan 13, 11:24 PM
Unknown Object (File)
Tue, Jan 13, 9:12 PM
Unknown Object (File)
Tue, Jan 13, 7:14 AM
Unknown Object (File)
Mon, Jan 12, 1:19 AM
Unknown Object (File)
Sat, Jan 10, 4:43 AM
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