Skip to content

Commit 6f670d0

Browse files
alobakinanakryiko
authored andcommitted
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: 156f886 ("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
1 parent e64fbca commit 6f670d0

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎samples/bpf/xdp_sample_user.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ const char *get_driver_name(int ifindex);
4545
int get_mac_addr(int ifindex, void *mac_addr);
4646

4747
#pragma GCC diagnostic push
48+
#ifndef __clang__
4849
#pragma GCC diagnostic ignored "-Wstringop-truncation"
50+
#endif
4951
__attribute__((unused))
5052
static inline char *safe_strncpy(char *dst, const char *src, size_t size)
5153
{

0 commit comments

Comments
 (0)