[U-Boot] [PATCH] net: Disable the format-extra-args warning
Tom Rini
trini at konsulko.com
Wed May 10 19:26:06 UTC 2017
We will see warnings such as:
net/eth_common.c:57:61: warning: data argument not used by format string [-Wformat-extra-args]
sprintf(enetvar, index ? "%s%daddr" : "%saddr", base_name, index);
~~~~~~~~ ^
With clang. In this case we do not want to re-write our code to be less
compact as the above is intentional and readable. Add a comment above
the disabling so that it's clear why we want that warning off.
Signed-off-by: Tom Rini <trini at konsulko.com>
---
net/Makefile | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/net/Makefile b/net/Makefile
index f03d6083268f..ae54eee5afe0 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -25,3 +25,8 @@ obj-$(CONFIG_CMD_PING) += ping.o
obj-$(CONFIG_CMD_RARP) += rarp.o
obj-$(CONFIG_CMD_SNTP) += sntp.o
obj-$(CONFIG_CMD_NET) += tftp.o
+
+# Disable this warning as it is triggered by:
+# sprintf(buf, index ? "foo%d" : "foo", index)
+# and this is intentional usage.
+CFLAGS_eth_common.o += -Wno-format-extra-args
--
1.9.1
More information about the U-Boot
mailing list