summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Richardson <arichardson@FreeBSD.org>2025-09-15 21:58:36 -0700
committerDimitry Andric <dim@FreeBSD.org>2026-01-04 02:46:39 +0100
commitb94022db9aed8e01675baafde096e09c63bf6cf6 (patch)
treeb8a290ee788dc8198e0f79aa64f29dbc29de2aff
parentf5b76cb51e2c5b5b939b4d759379907c69ea31db (diff)
ocs_fc: Use __printflike() instead of format(printf)
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 3c0ea1b629764c49611e3e3adfa0c44f9afa3558)
-rw-r--r--sys/dev/ocs_fc/ocs_ddump.h3
-rw-r--r--sys/dev/ocs_fc/ocs_mgmt.h3
-rw-r--r--sys/dev/ocs_fc/ocs_os.h2
-rw-r--r--sys/dev/ocs_fc/ocs_utils.h12
4 files changed, 7 insertions, 13 deletions
diff --git a/sys/dev/ocs_fc/ocs_ddump.h b/sys/dev/ocs_fc/ocs_ddump.h
index b7d7eefad813..3cffff6d9670 100644
--- a/sys/dev/ocs_fc/ocs_ddump.h
+++ b/sys/dev/ocs_fc/ocs_ddump.h
@@ -46,8 +46,7 @@ extern void ocs_ddump_startfile(ocs_textbuf_t *textbuf);
extern void ocs_ddump_endfile(ocs_textbuf_t *textbuf);
extern void ocs_ddump_section(ocs_textbuf_t *textbuf, const char *name, uint32_t instance);
extern void ocs_ddump_endsection(ocs_textbuf_t *textbuf, const char *name, uint32_t instance);
-__attribute__((format(printf,3,4)))
-extern void ocs_ddump_value(ocs_textbuf_t *textbuf, const char *name, const char *fmt, ...);
+extern void ocs_ddump_value(ocs_textbuf_t *textbuf, const char *name, const char *fmt, ...) __printflike(3, 4);
extern void ocs_ddump_buffer(ocs_textbuf_t *textbuf, const char *name, uint32_t instance, void *buffer, uint32_t size);
extern int32_t ocs_save_ddump(ocs_t *ocs, uint32_t flags, uint32_t qentries);
extern int32_t ocs_get_saved_ddump(ocs_t *ocs, ocs_textbuf_t *textbuf);
diff --git a/sys/dev/ocs_fc/ocs_mgmt.h b/sys/dev/ocs_fc/ocs_mgmt.h
index 7b59a3916ca8..9781aec18462 100644
--- a/sys/dev/ocs_fc/ocs_mgmt.h
+++ b/sys/dev/ocs_fc/ocs_mgmt.h
@@ -95,8 +95,7 @@ extern void ocs_mgmt_end_section(ocs_textbuf_t *textbuf, const char *name, int i
extern void ocs_mgmt_end_unnumbered_section(ocs_textbuf_t *textbuf, const char *name);
extern void ocs_mgmt_emit_property_name(ocs_textbuf_t *textbuf, int access, const char *name);
extern void ocs_mgmt_emit_string(ocs_textbuf_t *textbuf, int access, const char *name, const char *value);
-__attribute__((format(printf,4,5)))
-extern void ocs_mgmt_emit_int(ocs_textbuf_t *textbuf, int access, const char *name, const char *fmt, ...);
+extern void ocs_mgmt_emit_int(ocs_textbuf_t *textbuf, int access, const char *name, const char *fmt, ...) __printflike(4, 5);
extern void ocs_mgmt_emit_boolean(ocs_textbuf_t *textbuf, int access, const char *name, const int value);
extern int parse_wwn(char *wwn_in, uint64_t *wwn_out);
diff --git a/sys/dev/ocs_fc/ocs_os.h b/sys/dev/ocs_fc/ocs_os.h
index 9e3beff35548..e0024a198cb7 100644
--- a/sys/dev/ocs_fc/ocs_os.h
+++ b/sys/dev/ocs_fc/ocs_os.h
@@ -711,7 +711,7 @@ typedef struct {
* @return returns 0 for success, a negative error code value for failure.
*/
-extern int ocs_sem_init(ocs_sem_t *sem, int val, const char *name, ...) __attribute__((format(printf, 3, 4)));
+extern int ocs_sem_init(ocs_sem_t *sem, int val, const char *name, ...) __printflike(3, 4);
/**
* @brief execute a P (decrement) operation
diff --git a/sys/dev/ocs_fc/ocs_utils.h b/sys/dev/ocs_fc/ocs_utils.h
index e3a952e0cf26..7c9c9ae85b74 100644
--- a/sys/dev/ocs_fc/ocs_utils.h
+++ b/sys/dev/ocs_fc/ocs_utils.h
@@ -103,10 +103,8 @@ extern int32_t ocs_textbuf_init(ocs_t *ocs, ocs_textbuf_t *textbuf, void *buffer
extern void ocs_textbuf_free(ocs_t *ocs, ocs_textbuf_t *textbuf);
extern void ocs_textbuf_putc(ocs_textbuf_t *textbuf, uint8_t c);
extern void ocs_textbuf_puts(ocs_textbuf_t *textbuf, char *s);
-__attribute__((format(printf,2,3)))
-extern void ocs_textbuf_printf(ocs_textbuf_t *textbuf, const char *fmt, ...);
-__attribute__((format(printf,2,0)))
-extern void ocs_textbuf_vprintf(ocs_textbuf_t *textbuf, const char *fmt, va_list ap);
+extern void ocs_textbuf_printf(ocs_textbuf_t *textbuf, const char *fmt, ...) __printflike(2, 3);
+extern void ocs_textbuf_vprintf(ocs_textbuf_t *textbuf, const char *fmt, va_list ap) __printflike(2, 0);
extern void ocs_textbuf_buffer(ocs_textbuf_t *textbuf, uint8_t *buffer, uint32_t buffer_length);
extern void ocs_textbuf_copy(ocs_textbuf_t *textbuf, uint8_t *buffer, uint32_t buffer_length);
extern int32_t ocs_textbuf_remaining(ocs_textbuf_t *textbuf);
@@ -325,10 +323,8 @@ typedef struct ocs_ramlog_s ocs_ramlog_t;
extern ocs_ramlog_t *ocs_ramlog_init(ocs_t *ocs, uint32_t buffer_len, uint32_t buffer_count);
extern void ocs_ramlog_free(ocs_t *ocs, ocs_ramlog_t *ramlog);
extern void ocs_ramlog_clear(ocs_t *ocs, ocs_ramlog_t *ramlog, int clear_start_of_day, int clear_recent);
-__attribute__((format(printf,2,3)))
-extern int32_t ocs_ramlog_printf(void *os, const char *fmt, ...);
-__attribute__((format(printf,2,0)))
-extern int32_t ocs_ramlog_vprintf(ocs_ramlog_t *ramlog, const char *fmt, va_list ap);
+extern int32_t ocs_ramlog_printf(void *os, const char *fmt, ...) __printflike(2, 3);
+extern int32_t ocs_ramlog_vprintf(ocs_ramlog_t *ramlog, const char *fmt, va_list ap) __printflike(2, 0);
extern int32_t ocs_ddump_ramlog(ocs_textbuf_t *textbuf, ocs_ramlog_t *ramlog);
#endif