summaryrefslogtreecommitdiffstats
path: root/samples
diff options
context:
space:
mode:
authorAlexander Lobakin <alexandr.lobakin@intel.com>2021-12-03 20:50:04 +0100
committerAndrii Nakryiko <andrii@kernel.org>2021-12-06 19:33:44 -0800
commit6f670d06e47c774bc065aaa84a527a4838f34bd8 (patch)
tree0dc4ce1066208d66a19fae3eae4f780333021fd1 /samples
parente64fbcaa7a666f16329b1c67af15ea501bc84586 (diff)
downloadlinux-6f670d06e47c774bc065aaa84a527a4838f34bd8.tar.gz
linux-6f670d06e47c774bc065aaa84a527a4838f34bd8.tar.bz2
linux-6f670d06e47c774bc065aaa84a527a4838f34bd8.zip
samples: bpf: Fix 'unknown warning group' build warning on Clang
Clang doesn't have 'stringop-truncation' group like GCC does, and complains about it when building samples which use xdp_sample_user infra: samples/bpf/xdp_sample_user.h:48:32: warning: unknown warning group '-Wstringop-truncation', ignored [-Wunknown-warning-option] #pragma GCC diagnostic ignored "-Wstringop-truncation" ^ [ repeat ] Those are harmless, but avoidable when guarding it with ifdef. I could guard push/pop as well, but this would require one more ifdef cruft around a single line which I don't think is reasonable. Fixes: 156f886cf697 ("samples: bpf: Add basic infrastructure for XDP samples") Signed-off-by: Alexander Lobakin <alexandr.lobakin@intel.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Link: https://lore.kernel.org/bpf/20211203195004.5803-3-alexandr.lobakin@intel.com
Diffstat (limited to 'samples')
-rw-r--r--samples/bpf/xdp_sample_user.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/samples/bpf/xdp_sample_user.h b/samples/bpf/xdp_sample_user.h
index d97465ff8c62..5f44b877ecf5 100644
--- a/samples/bpf/xdp_sample_user.h
+++ b/samples/bpf/xdp_sample_user.h
@@ -45,7 +45,9 @@ const char *get_driver_name(int ifindex);
int get_mac_addr(int ifindex, void *mac_addr);
#pragma GCC diagnostic push
+#ifndef __clang__
#pragma GCC diagnostic ignored "-Wstringop-truncation"
+#endif
__attribute__((unused))
static inline char *safe_strncpy(char *dst, const char *src, size_t size)
{