Re: [PATCH bpf-next 2/2] selftests/bpf: enforce C++11 mode for test_cpp test

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

 



On 9/27/22 6:29 AM, Andrii Nakryiko wrote:
Setting -std=c++11 seems to catch more potential C++-only problems. Also
BPF skeleton isn't rely compilable with any older standard due to the
use of nullptr.

Signed-off-by: Andrii Nakryiko <andrii@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 e6cf21fad69f..d52069c70e49 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -570,7 +570,7 @@ $(OUTPUT)/test_verifier: test_verifier.c verifier/tests.h $(BPFOBJ) | $(OUTPUT)
  # 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) $(CFLAGS) -std=c++11 $(filter %.a %.o %.cpp,$^) $(LDLIBS) -o $@
# Benchmark runner
  $(OUTPUT)/bench_%.o: benchs/bench_%.c bench.h $(BPFOBJ)


Seems CI triggers build error (https://github.com/kernel-patches/bpf/actions/runs/3133037577/jobs/5085992832) :

    [...]
    GEN-SKEL [test_progs] pyperf180.skel.h
    GEN-SKEL [test_progs] pyperf600.skel.h
    GEN-SKEL [test_progs-no_alu32] pyperf180.skel.h
    GEN-SKEL [test_progs-no_alu32] pyperf600.skel.h
    BINARY   bench
  In file included from test_cpp.cpp:9:
  /tmp/work/bpf/bpf/tools/testing/selftests/bpf/test_core_extern.skel.h:45:3: error: unknown type name '_Bool'
                  _Bool CONFIG_BOOL;
                  ^
  /tmp/work/bpf/bpf/tools/testing/selftests/bpf/test_core_extern.skel.h:46:3: error: unknown type name '_Bool'
                  _Bool CONFIG_BPF_SYSCALL;
                  ^
  2 errors generated.
  make: *** [Makefile:573: /tmp/work/bpf/bpf/tools/testing/selftests/bpf/test_cpp] Error 1
  make: *** Waiting for unfinished jobs....
  make: Leaving directory '/tmp/work/bpf/bpf/tools/testing/selftests/bpf'
  Error: Process completed with exit code 2.

Thanks,
Daniel



[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