@@ -43,9 +43,6 @@ include $(RTE_SDK)/mk/rte.vars.mk
# binary name
APP = pktgen
-CFLAGS_commands.o := -Wno-format-nonliteral
-CFLAGS_pktgen-log.o := -Wno-format-nonliteral
-
CFLAGS += -O3 -g $(WERROR_FLAGS) -fno-stack-protector
CFLAGS += -I$(RTE_SRCDIR) -I$(RTE_SRCDIR)/../lib/common
@@ -99,6 +99,7 @@ pktgen_log_set_screen_level(int level)
/* Log the provided message to the log screen and optionally a file. */
void
+__attribute__((format(printf, 5, 6)))
pktgen_log(int level, const char *file, long line,
const char *func, const char *fmt, ...)
{
@@ -696,7 +696,7 @@ cli_pause(const char *msg, const char *keys)
if (cli_poll(&c))
if (strchr(keys, c)) {
/* clear the line of the prompt */
- cli_printf("\r%*s\r", strlen(prompt), " ");
+ cli_printf("\r%*s\r", (int)strlen(prompt), " ");
return c;
}
} while (this_cli->quit_flag == 0);
@@ -71,6 +71,7 @@ extern "C" {
*/
static inline void
+__attribute__((format(printf, 1, 2)))
cli_printf(const char *fmt, ...)
{
va_list vaList;
@@ -162,7 +162,7 @@ decode_map(const char *fmt)
}
switch (fmt[1]) {
- case '%': cli_printf("% "); break;
+ case '%': cli_printf("%% "); break;
case 'd': cli_printf("<32bit number> "); break;
case 'D': cli_printf("<64bit number> "); break;
case 'h': cli_printf("<32bit hex> "); break;
@@ -50,6 +50,7 @@
RTE_DEFINE_PER_LCORE(struct cli_scrn *, scrn);
void
+__attribute__((format(printf, 3, 4)))
scrn_printf(int16_t r, int16_t c, const char *fmt, ...)
{
va_list vaList;
@@ -63,6 +64,7 @@ scrn_printf(int16_t r, int16_t c, const char *fmt, ...)
}
void
+__attribute__((format(printf, 3, 4)))
scrn_cprintf(int16_t r, int16_t ncols, const char *fmt, ...)
{
va_list vaList;
@@ -80,6 +82,7 @@ scrn_cprintf(int16_t r, int16_t ncols, const char *fmt, ...)
}
void
+__attribute__((format(printf, 4, 5)))
scrn_fprintf(int16_t r, int16_t c, FILE *f, const char *fmt, ...)
{
va_list vaList;
@@ -106,6 +106,7 @@ typedef enum {
typedef uint8_t cli_rgb_t;
static inline void
+__attribute__((format(printf, 1, 2)))
scrn_puts(const char *fmt, ...)
{
struct cli_scrn *scrn = this_scrn;