Clang complains about using non-format string in print_color_tv.
The ideal fix would be to put format attribute on all the print_XXX functions
in json_print.h. But that leads to furthur complications because the existing
code may pass a NULL as format if the format is unused since the print
is being done only for JSON output.
The comprimise is to just disable the warning for the one place
it shows up.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
return ret;
}
+/*
+ * This function does take printf style argument but applying
+ * format attribute to causes more warnings since the print_XXX
+ * functions are used with NULL for format if unused.
+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
int print_color_tv(enum output_type type,
enum color_attr color,
const char *key,
return print_color_float(type, color, key, fmt, time);
}
+#pragma GCC diagnostic pop
/* Print line separator (if not in JSON mode) */
void print_nl(void)