Re: [PATCH 2/3] selftest/bpf: _GNU_SOURCE redefined in g++

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 19, 2024 at 8:11 AM Cupertino Miranda
<cupertino.miranda@xxxxxxxxxx> wrote:
>
> The following commit:
>
> commit cc937dad85aea4ab9e4f9827d7ea55932c86906b
> Author: Edward Liaw <edliaw@xxxxxxxxxx>
> Date:   Tue Jun 25 22:34:45 2024 +0000
>
>     selftests: centralize -D_GNU_SOURCE= to CFLAGS in lib.mk
>
> introduces "-D_GNU_SOURCE=" to generic CFLAGS used within bpf selfttests
> makefiles which include lib.mk.
> g++ by default sets the _GNU_SOURCE flag internally which
> reports the following warning and subsequent error:
>
> <command-line>: error: "_GNU_SOURCE" redefined [-Werror]
> <command-line>: note: this is the location of the previous definition
>
> This patch removes that _GNU_SOURCE definition from CFLAGS when
> compiling CPP files.
>
> Signed-off-by: Cupertino Miranda <cupertino.miranda@xxxxxxxxxx>
> Cc: Andrii Nakryiko <andrii@xxxxxxxxxx>
> Cc: Eduard Zingerman <eddyz87@xxxxxxxxx>
> Cc: Yonghong Song <yonghong.song@xxxxxxxxx>
> Cc: Alexei Starovoitov <ast@xxxxxxxxxx>
> Cc: Jose Marchesi <jose.marchesi@xxxxxxxxxx>
> Cc: David Faust <david.faust@xxxxxxxxxx>
> ---
>  tools/testing/selftests/bpf/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index ded6e22b3076..f06c51bfd522 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -741,7 +741,7 @@ $(OUTPUT)/xdp_features: xdp_features.c $(OUTPUT)/network_helpers.o $(OUTPUT)/xdp
>  # Make sure we are able to include and link libbpf against c++.
>  $(OUTPUT)/test_cpp: test_cpp.cpp $(OUTPUT)/test_core_extern.skel.h $(BPFOBJ)
>         $(call msg,CXX,,$@)
> -       $(Q)$(CXX) $(CFLAGS) $(filter %.a %.o %.cpp,$^) $(LDLIBS) -o $@
> +       $(Q)$(CXX) $(subst -D_GNU_SOURCE=,,$(CFLAGS)) $(filter %.a %.o %.cpp,$^) $(LDLIBS) -o $@
>

The fix for this issue has already landed in bpf/master, so we are
just waiting for bpf/master to be merged into bpf-next/master.

>  # Benchmark runner
>  $(OUTPUT)/bench_%.o: benchs/bench_%.c bench.h $(BPFOBJ)
> --
> 2.30.2
>





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux