git: 1a0377015e78 - stable/14 - zfs: rename several printf attribute declarations to __printf__
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 02 Jan 2026 20:52:13 UTC
The branch stable/14 has been updated by dim:
URL: https://cgit.FreeBSD.org/src/commit/?id=1a0377015e78f6ed4b444133a8b5139a18737f42
commit 1a0377015e78f6ed4b444133a8b5139a18737f42
Author: Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2025-12-30 12:50:24 +0000
Commit: Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2026-01-02 20:45:08 +0000
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)
---
sys/contrib/openzfs/include/os/freebsd/spl/sys/cmn_err.h | 16 ++++++++--------
sys/contrib/openzfs/include/os/freebsd/spl/sys/kmem.h | 4 ++--
sys/contrib/openzfs/include/sys/spa.h | 4 ++--
sys/contrib/openzfs/include/sys/vdev.h | 2 +-
sys/contrib/openzfs/include/sys/zfs_debug.h | 2 +-
5 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/cmn_err.h b/sys/contrib/openzfs/include/os/freebsd/spl/sys/cmn_err.h
index 87fce4955bc1..21f05c67334c 100644
--- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/cmn_err.h
+++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/cmn_err.h
@@ -51,28 +51,28 @@ extern "C" {
#ifndef _ASM
extern void cmn_err(int, const char *, ...)
- __attribute__((format(printf, 2, 3)));
+ __attribute__((format(__printf__, 2, 3)));
extern void vzcmn_err(zoneid_t, int, const char *, __va_list)
- __attribute__((format(printf, 3, 0)));
+ __attribute__((format(__printf__, 3, 0)));
extern void vcmn_err(int, const char *, __va_list)
- __attribute__((format(printf, 2, 0)));
+ __attribute__((format(__printf__, 2, 0)));
extern void zcmn_err(zoneid_t, int, const char *, ...)
- __attribute__((format(printf, 3, 4)));
+ __attribute__((format(__printf__, 3, 4)));
extern void vzprintf(zoneid_t, const char *, __va_list)
- __attribute__((format(printf, 2, 0)));
+ __attribute__((format(__printf__, 2, 0)));
extern void zprintf(zoneid_t, const char *, ...)
- __attribute__((format(printf, 2, 3)));
+ __attribute__((format(__printf__, 2, 3)));
extern void vuprintf(const char *, __va_list)
- __attribute__((format(printf, 1, 0)));
+ __attribute__((format(__printf__, 1, 0)));
extern void panic(const char *, ...)
- __attribute__((format(printf, 1, 2), __noreturn__));
+ __attribute__((format(__printf__, 1, 2), __noreturn__));
#define cmn_err_once(ce, ...) \
do { \
diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/kmem.h b/sys/contrib/openzfs/include/os/freebsd/spl/sys/kmem.h
index ae786f0e20ca..d365904727da 100644
--- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/kmem.h
+++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/kmem.h
@@ -54,9 +54,9 @@ MALLOC_DECLARE(M_SOLARIS);
typedef struct vmem vmem_t;
extern char *kmem_asprintf(const char *, ...)
- __attribute__((format(printf, 1, 2)));
+ __attribute__((format(__printf__, 1, 2)));
extern char *kmem_vasprintf(const char *fmt, va_list ap)
- __attribute__((format(printf, 1, 0)));
+ __attribute__((format(__printf__, 1, 0)));
extern int kmem_scnprintf(char *restrict str, size_t size,
const char *restrict fmt, ...);
diff --git a/sys/contrib/openzfs/include/sys/spa.h b/sys/contrib/openzfs/include/sys/spa.h
index 76e4446d3942..f7866e564778 100644
--- a/sys/contrib/openzfs/include/sys/spa.h
+++ b/sys/contrib/openzfs/include/sys/spa.h
@@ -1064,9 +1064,9 @@ extern spa_autotrim_t spa_get_autotrim(spa_t *spa);
/* Miscellaneous support routines */
extern void spa_load_failed(spa_t *spa, const char *fmt, ...)
- __attribute__((format(printf, 2, 3)));
+ __attribute__((format(__printf__, 2, 3)));
extern void spa_load_note(spa_t *spa, const char *fmt, ...)
- __attribute__((format(printf, 2, 3)));
+ __attribute__((format(__printf__, 2, 3)));
extern void spa_activate_mos_feature(spa_t *spa, const char *feature,
dmu_tx_t *tx);
extern void spa_deactivate_mos_feature(spa_t *spa, const char *feature);
diff --git a/sys/contrib/openzfs/include/sys/vdev.h b/sys/contrib/openzfs/include/sys/vdev.h
index 05d18a36cbaa..3171edf8472c 100644
--- a/sys/contrib/openzfs/include/sys/vdev.h
+++ b/sys/contrib/openzfs/include/sys/vdev.h
@@ -53,7 +53,7 @@ extern int zfs_nocacheflush;
typedef boolean_t vdev_open_children_func_t(vdev_t *vd);
extern void vdev_dbgmsg(vdev_t *vd, const char *fmt, ...)
- __attribute__((format(printf, 2, 3)));
+ __attribute__((format(__printf__, 2, 3)));
extern void vdev_dbgmsg_print_tree(vdev_t *, int);
extern int vdev_open(vdev_t *);
extern void vdev_open_children(vdev_t *);
diff --git a/sys/contrib/openzfs/include/sys/zfs_debug.h b/sys/contrib/openzfs/include/sys/zfs_debug.h
index 62fa34cd14e1..3668d1a422c1 100644
--- a/sys/contrib/openzfs/include/sys/zfs_debug.h
+++ b/sys/contrib/openzfs/include/sys/zfs_debug.h
@@ -62,7 +62,7 @@ extern int zfs_dbgmsg_enable;
extern void __set_error(const char *file, const char *func, int line, int err);
extern void __zfs_dbgmsg(char *buf);
extern void __dprintf(boolean_t dprint, const char *file, const char *func,
- int line, const char *fmt, ...) __attribute__((format(printf, 5, 6)));
+ int line, const char *fmt, ...) __attribute__((format(__printf__, 5, 6)));
/*
* Some general principles for using zfs_dbgmsg():