Skip to content

Commit 83377a0

Browse files
committed
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
1 parent 69b8cd9 commit 83377a0

File tree

4 files changed

+7
-13
lines changed

4 files changed

+7
-13
lines changed

sys/dev/ocs_fc/ocs_ddump.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ extern void ocs_ddump_startfile(ocs_textbuf_t *textbuf);
4646
extern void ocs_ddump_endfile(ocs_textbuf_t *textbuf);
4747
extern void ocs_ddump_section(ocs_textbuf_t *textbuf, const char *name, uint32_t instance);
4848
extern void ocs_ddump_endsection(ocs_textbuf_t *textbuf, const char *name, uint32_t instance);
49-
__attribute__((format(printf,3,4)))
50-
extern void ocs_ddump_value(ocs_textbuf_t *textbuf, const char *name, const char *fmt, ...);
49+
extern void ocs_ddump_value(ocs_textbuf_t *textbuf, const char *name, const char *fmt, ...) __printflike(3, 4);
5150
extern void ocs_ddump_buffer(ocs_textbuf_t *textbuf, const char *name, uint32_t instance, void *buffer, uint32_t size);
5251
extern int32_t ocs_save_ddump(ocs_t *ocs, uint32_t flags, uint32_t qentries);
5352
extern int32_t ocs_get_saved_ddump(ocs_t *ocs, ocs_textbuf_t *textbuf);

sys/dev/ocs_fc/ocs_mgmt.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ extern void ocs_mgmt_end_section(ocs_textbuf_t *textbuf, const char *name, int i
9595
extern void ocs_mgmt_end_unnumbered_section(ocs_textbuf_t *textbuf, const char *name);
9696
extern void ocs_mgmt_emit_property_name(ocs_textbuf_t *textbuf, int access, const char *name);
9797
extern void ocs_mgmt_emit_string(ocs_textbuf_t *textbuf, int access, const char *name, const char *value);
98-
__attribute__((format(printf,4,5)))
99-
extern void ocs_mgmt_emit_int(ocs_textbuf_t *textbuf, int access, const char *name, const char *fmt, ...);
98+
extern void ocs_mgmt_emit_int(ocs_textbuf_t *textbuf, int access, const char *name, const char *fmt, ...) __printflike(4, 5);
10099
extern void ocs_mgmt_emit_boolean(ocs_textbuf_t *textbuf, int access, const char *name, const int value);
101100
extern int parse_wwn(char *wwn_in, uint64_t *wwn_out);
102101

sys/dev/ocs_fc/ocs_os.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ typedef struct {
711711
* @return returns 0 for success, a negative error code value for failure.
712712
*/
713713

714-
extern int ocs_sem_init(ocs_sem_t *sem, int val, const char *name, ...) __attribute__((format(printf, 3, 4)));
714+
extern int ocs_sem_init(ocs_sem_t *sem, int val, const char *name, ...) __printflike(3, 4);
715715

716716
/**
717717
* @brief execute a P (decrement) operation

sys/dev/ocs_fc/ocs_utils.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,8 @@ extern int32_t ocs_textbuf_init(ocs_t *ocs, ocs_textbuf_t *textbuf, void *buffer
103103
extern void ocs_textbuf_free(ocs_t *ocs, ocs_textbuf_t *textbuf);
104104
extern void ocs_textbuf_putc(ocs_textbuf_t *textbuf, uint8_t c);
105105
extern void ocs_textbuf_puts(ocs_textbuf_t *textbuf, char *s);
106-
__attribute__((format(printf,2,3)))
107-
extern void ocs_textbuf_printf(ocs_textbuf_t *textbuf, const char *fmt, ...);
108-
__attribute__((format(printf,2,0)))
109-
extern void ocs_textbuf_vprintf(ocs_textbuf_t *textbuf, const char *fmt, va_list ap);
106+
extern void ocs_textbuf_printf(ocs_textbuf_t *textbuf, const char *fmt, ...) __printflike(2, 3);
107+
extern void ocs_textbuf_vprintf(ocs_textbuf_t *textbuf, const char *fmt, va_list ap) __printflike(2, 0);
110108
extern void ocs_textbuf_buffer(ocs_textbuf_t *textbuf, uint8_t *buffer, uint32_t buffer_length);
111109
extern void ocs_textbuf_copy(ocs_textbuf_t *textbuf, uint8_t *buffer, uint32_t buffer_length);
112110
extern int32_t ocs_textbuf_remaining(ocs_textbuf_t *textbuf);
@@ -325,10 +323,8 @@ typedef struct ocs_ramlog_s ocs_ramlog_t;
325323
extern ocs_ramlog_t *ocs_ramlog_init(ocs_t *ocs, uint32_t buffer_len, uint32_t buffer_count);
326324
extern void ocs_ramlog_free(ocs_t *ocs, ocs_ramlog_t *ramlog);
327325
extern void ocs_ramlog_clear(ocs_t *ocs, ocs_ramlog_t *ramlog, int clear_start_of_day, int clear_recent);
328-
__attribute__((format(printf,2,3)))
329-
extern int32_t ocs_ramlog_printf(void *os, const char *fmt, ...);
330-
__attribute__((format(printf,2,0)))
331-
extern int32_t ocs_ramlog_vprintf(ocs_ramlog_t *ramlog, const char *fmt, va_list ap);
326+
extern int32_t ocs_ramlog_printf(void *os, const char *fmt, ...) __printflike(2, 3);
327+
extern int32_t ocs_ramlog_vprintf(ocs_ramlog_t *ramlog, const char *fmt, va_list ap) __printflike(2, 0);
332328
extern int32_t ocs_ddump_ramlog(ocs_textbuf_t *textbuf, ocs_ramlog_t *ramlog);
333329

334330
#endif

0 commit comments

Comments
 (0)