Page MenuHomeFreeBSD

zfs: rename several printf attribute declarations to __printf__
ClosedPublic

Authored by dim on Sun, Dec 28, 10:33 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jan 10, 4:43 AM
Unknown Object (File)
Fri, Jan 9, 9:41 PM
Unknown Object (File)
Thu, Jan 8, 12:48 AM
Unknown Object (File)
Mon, Jan 5, 4:17 PM
Unknown Object (File)
Mon, Jan 5, 7:28 AM
Unknown Object (File)
Sat, Jan 3, 8:43 AM
Unknown Object (File)
Sat, Jan 3, 8:19 AM
Unknown Object (File)
Thu, Jan 1, 3:35 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