@@ -8,6 +8,7 @@
#define _CMDLINE_H_
#include <termios.h>
+#include <rte_common.h>
#include <cmdline_rdline.h>
#include <cmdline_parse.h>
@@ -34,7 +35,7 @@ struct cmdline *cmdline_new(cmdline_parse_ctx_t *ctx, const char *prompt, int s_
void cmdline_set_prompt(struct cmdline *cl, const char *prompt);
void cmdline_free(struct cmdline *cl);
void cmdline_printf(const struct cmdline *cl, const char *fmt, ...)
- __attribute__((format(printf,2,3)));
+ __rte_format_printf(2, 3);
int cmdline_in(struct cmdline *cl, const char *buf, int size);
int cmdline_write_char(struct rdline *rdl, char c);
@@ -94,6 +94,12 @@ typedef uint16_t unaligned_uint16_t;
*/
#define RTE_SET_USED(x) (void)(x)
+/**
+ * Hint type checking for printf-style arguments.
+ */
+#define __rte_format_printf(fmt_idx, args_idx) \
+ __attribute__((format(printf, fmt_idx, args_idx)))
+
#define RTE_PRIORITY_LOG 101
#define RTE_PRIORITY_BUS 110
#define RTE_PRIORITY_CLASS 120
@@ -803,7 +809,7 @@ rte_str_to_size(const char *str)
*/
__rte_noreturn void
rte_exit(int exit_code, const char *format, ...)
- __attribute__((format(printf, 2, 3)));
+ __rte_format_printf(2, 3);
#ifdef __cplusplus
}
@@ -73,7 +73,7 @@ void __rte_panic(const char *funcname , const char *format, ...)
#endif
#endif
__rte_noreturn
- __attribute__((format(printf, 2, 3)));
+ __rte_format_printf(2, 3);
#ifdef __cplusplus
}
@@ -137,7 +137,7 @@ rte_devargs_parse(struct rte_devargs *da, const char *dev);
int
rte_devargs_parsef(struct rte_devargs *da,
const char *format, ...)
-__attribute__((format(printf, 2, 0)));
+__rte_format_printf(2, 0);
/**
* Insert an rte_devargs in the global list.
@@ -282,7 +282,7 @@ int rte_log(uint32_t level, uint32_t logtype, const char *format, ...)
__rte_cold
#endif
#endif
- __attribute__((format(printf, 3, 4)));
+ __rte_format_printf(3, 4);
/**
* Generates a log message.
@@ -311,7 +311,7 @@ int rte_log(uint32_t level, uint32_t logtype, const char *format, ...)
* - Negative on error.
*/
int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap)
- __attribute__((format(printf,3,0)));
+ __rte_format_printf(3, 0);
/**
* Generates a log message.