#ifndef _CMDLINE_H_
#define _CMDLINE_H_
+#include <rte_common.h>
+
#include <termios.h>
#include <cmdline_rdline.h>
#include <cmdline_parse.h>
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);
*/
#define RTE_SET_USED(x) (void)(x)
+/**
+ * Check format string and its arguments at compile-time.
+ *
+ * GCC on Windows assumes MS-specific format string by default,
+ * even if the underlying stdio implementation is ANSI-compliant,
+ * so this must be overridden.
+ */
+#if RTE_CC_IS_GNU
+#define __rte_format_printf(format_index, first_arg) \
+ __attribute__((format(gnu_printf, format_index, first_arg)))
+#else
+#define __rte_format_printf(format_index, first_arg) \
+ __attribute__((format(printf, format_index, first_arg)))
+#endif
+
#define RTE_PRIORITY_LOG 101
#define RTE_PRIORITY_BUS 110
#define RTE_PRIORITY_CLASS 120
void
rte_exit(int exit_code, const char *format, ...)
__attribute__((noreturn))
- __attribute__((format(printf, 2, 3)));
+ __rte_format_printf(2, 3);
#ifdef __cplusplus
}
#endif
#endif
__attribute__((noreturn))
- __attribute__((format(printf, 2, 3)));
+ __rte_format_printf(2, 3);
#ifdef __cplusplus
}
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.
__attribute__((cold))
#endif
#endif
- __attribute__((format(printf, 3, 4)));
+ __rte_format_printf(3, 4);
/**
* Generates a log message.
* - 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.