[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAEf4BzapE89OjQ4z7kzQiOz78JqpMBdjkbQfePDGGG0sy7DJag@mail.gmail.com>
Date: Tue, 12 May 2020 15:30:40 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Yonghong Song <yhs@...com>
Cc: Andrii Nakryiko <andriin@...com>, bpf <bpf@...r.kernel.org>,
Martin KaFai Lau <kafai@...com>,
Networking <netdev@...r.kernel.org>,
Alexei Starovoitov <ast@...com>,
Daniel Borkmann <daniel@...earbox.net>,
Kernel Team <kernel-team@...com>
Subject: Re: [PATCH bpf-next 8/8] samples/bpf: remove compiler warnings
On Tue, May 12, 2020 at 8:54 AM Yonghong Song <yhs@...com> wrote:
>
> Commit 5fbc220862fc ("tools/libpf: Add offsetof/container_of macro
> in bpf_helpers.h") added macros offsetof/container_of to
> bpf_helpers.h. Unfortunately, it caused compilation warnings
> below for a few samples/bpf programs:
> In file included from /data/users/yhs/work/net-next/samples/bpf/sockex2_kern.c:4:
> In file included from /data/users/yhs/work/net-next/include/uapi/linux/in.h:24:
> In file included from /data/users/yhs/work/net-next/include/linux/socket.h:8:
> In file included from /data/users/yhs/work/net-next/include/linux/uio.h:8:
> /data/users/yhs/work/net-next/include/linux/kernel.h:992:9: warning: 'container_of' macro redefined [-Wmacro-redefined]
> ^
> /data/users/yhs/work/net-next/tools/lib/bpf/bpf_helpers.h:46:9: note: previous definition is here
> ^
> 1 warning generated.
> CLANG-bpf samples/bpf/sockex3_kern.o
>
> In all these cases, bpf_helpers.h is included first, followed by other
> standard headers. The macro container_of is defined unconditionally
> in kernel.h, causing the compiler warning.
>
> The fix is to move bpf_helpers.h after standard headers.
>
> Signed-off-by: Yonghong Song <yhs@...com>
> ---
LGTM.
Acked-by: Andrii Nakryiko <andriin@...com>
> samples/bpf/offwaketime_kern.c | 4 ++--
> samples/bpf/sockex2_kern.c | 4 ++--
> samples/bpf/sockex3_kern.c | 4 ++--
> 3 files changed, 6 insertions(+), 6 deletions(-)
>
[...]
Powered by blists - more mailing lists