sys/xen: Use __printflike() instead of format(printf)
Some checks failed
Cross-build Kernel / amd64 ubuntu-20.04 (clang-12) (push) Has been cancelled
Cross-build Kernel / aarch64 ubuntu-20.04 (clang-12) (push) Has been cancelled
Cross-build Kernel / amd64 macos-latest (clang-13) (push) Has been cancelled
Cross-build Kernel / aarch64 macos-latest (clang-13) (push) Has been cancelled
Cross-build Kernel / amd64 ubuntu-22.04 (clang-14) (push) Has been cancelled
Cross-build Kernel / aarch64 ubuntu-22.04 (clang-14) (push) Has been cancelled

The __printflike macro sets the format to freebsd_kprintf which recent
clang understands and warns about. Fixes the following error:
`passing 'printf' format string where 'freebsd_kprintf' format string is expected [-Werror,-Wformat]`

MFC after:	1 week

(cherry picked from commit 4cd7be3e81)
This commit is contained in:
Alex Richardson 2025-09-15 21:54:36 -07:00 committed by Dimitry Andric
parent b94022db9a
commit a96eb797b2
4 changed files with 7 additions and 7 deletions

View file

@ -173,7 +173,7 @@ struct xbb_softc;
struct xbb_xen_req;
static void xbb_attach_failed(struct xbb_softc *xbb, int err, const char *fmt,
...) __attribute__((format(printf, 3, 4)));
...) __printflike(3, 4);
static int xbb_shutdown(struct xbb_softc *xbb);
/*------------------------------ Data Structures -----------------------------*/

View file

@ -194,7 +194,7 @@ void xen_intr_unbind(xen_intr_handle_t *handle);
*/
int
xen_intr_describe(xen_intr_handle_t port_handle, const char *fmt, ...)
__attribute__((format(printf, 2, 3)));
__printflike(2, 3);
/**
* Signal the remote peer of an interrupt source associated with an

View file

@ -152,7 +152,7 @@ int xenbus_grant_ring(device_t dev, unsigned long ring_mfn, grant_ref_t *refp);
* printf arguments.
*/
void xenbus_dev_error(device_t dev, int err, const char *fmt, ...)
__attribute__((format(printf, 3, 4)));
__printflike(3, 4);
/**
* va_list version of xenbus_dev_error().
@ -163,7 +163,7 @@ void xenbus_dev_error(device_t dev, int err, const char *fmt, ...)
* \param ap Va_list of printf arguments.
*/
void xenbus_dev_verror(device_t dev, int err, const char *fmt, va_list ap)
__attribute__((format(printf, 3, 0)));
__printflike(3, 0);
/**
* Equivalent to xenbus_dev_error(), followed by
@ -175,7 +175,7 @@ void xenbus_dev_verror(device_t dev, int err, const char *fmt, va_list ap)
* printf arguments.
*/
void xenbus_dev_fatal(device_t dev, int err, const char *fmt, ...)
__attribute__((format(printf, 3, 4)));
__printflike(3, 4);
/**
* va_list version of xenbus_dev_fatal().
@ -186,7 +186,7 @@ void xenbus_dev_fatal(device_t dev, int err, const char *fmt, ...)
* \param ap Va_list of printf arguments.
*/
void xenbus_dev_vfatal(device_t dev, int err, const char *fmt, va_list)
__attribute__((format(printf, 3, 0)));
__printflike(3, 0);
/**
* Convert a member of the xenbus_state enum into an ASCII string.

View file

@ -271,7 +271,7 @@ int xs_scanf(struct xs_transaction t,
*/
int xs_printf(struct xs_transaction t, const char *dir,
const char *node, const char *fmt, ...)
__attribute__((format(printf, 4, 5)));
__printflike(4, 5);
/**
* va_list version of xenbus_printf().