summaryrefslogtreecommitdiffstats
path: root/tools/lib/bpf/libbpf.c
diff options
context:
space:
mode:
authorAndrey Ignatov2019-04-07 07:37:34 +0200
committerAlexei Starovoitov2019-04-07 08:13:54 +0200
commitff466b58055f2d28d8ddc1388af312e87a693efe (patch)
tree96b75cd697c6c179a17817c18c0ad9700fa4cedf /tools/lib/bpf/libbpf.c
parentMerge branch 'bpf-varstack-fixes' (diff)
downloadkernel-qcow2-linux-ff466b58055f2d28d8ddc1388af312e87a693efe.tar.gz
kernel-qcow2-linux-ff466b58055f2d28d8ddc1388af312e87a693efe.tar.xz
kernel-qcow2-linux-ff466b58055f2d28d8ddc1388af312e87a693efe.zip
libbpf: Ignore -Wformat-nonliteral warning
vsprintf() in __base_pr() uses nonliteral format string and it breaks compilation for those who provide corresponding extra CFLAGS, e.g.: https://github.com/libbpf/libbpf/issues/27 If libbpf is built with the flags from PR: libbpf.c:68:26: error: format string is not a string literal [-Werror,-Wformat-nonliteral] return vfprintf(stderr, format, args); ^~~~~~ 1 error generated. Ignore this warning since the use case in libbpf.c is legit. Signed-off-by: Andrey Ignatov <rdna@fb.com> Acked-by: Yonghong Song <yhs@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/lib/bpf/libbpf.c')
-rw-r--r--tools/lib/bpf/libbpf.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index e1e4d35cf08e..1ebfe7943d53 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -52,6 +52,11 @@
#define BPF_FS_MAGIC 0xcafe4a11
#endif
+/* vsprintf() in __base_pr() uses nonliteral format string. It may break
+ * compilation if user enables corresponding warning. Disable it explicitly.
+ */
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+
#define __printf(a, b) __attribute__((format(printf, a, b)))
static int __base_pr(enum libbpf_print_level level, const char *format,