Re: [PATCH v2 bpf-next 1/2] bpf: Fix macro redefined

From: Alexei Starovoitov
Date: Wed Jul 16 2025 - 23:33:49 EST


On Wed, Jul 16, 2025 at 8:29 PM Feng Yang <yangfeng59949@xxxxxxx> wrote:
>
> From: Feng Yang <yangfeng@xxxxxxxxxx>
>
> When compiling a program that include <linux/bpf.h> and <bpf/bpf_helpers.h>, (For example: make samples/bpf)
> the following warning will be generated:
> In file included from tcp_dumpstats_kern.c:7:
> samples/bpf/libbpf/include/bpf/bpf_helpers.h:321:9: warning: 'bpf_stream_printk' macro redefined [-Wmacro-redefined]
> 321 | #define bpf_stream_printk(stream_id, fmt, args...) \
> | ^
> include/linux/bpf.h:3626:9: note: previous definition is here
> 3626 | #define bpf_stream_printk(ss, ...) bpf_stream_stage_printk(&ss, __VA_ARGS__)
> | ^
>
> The main reason is due to below in sample/bpf/Makefile:

No. We're not going to change kernel code because of samples.

--
pw-bot: cr