BPF List
 help / color / mirror / Atom feed
From: Kumar Kartikeya Dwivedi <memxor@gmail.com>
To: bpf@vger.kernel.org
Cc: Andrii Nakryiko <andrii@kernel.org>
Subject: [PATCH bpf-next v1 6/6] selftests/bpf: Compile using -std=gnu89
Date: Sat,  6 Nov 2021 05:12:43 +0530	[thread overview]
Message-ID: <20211105234243.390179-7-memxor@gmail.com> (raw)
In-Reply-To: <20211105234243.390179-1-memxor@gmail.com>

The minimum supported C standard version is C89, with use of GNU
extensions, hence make sure to catch any instances that would break
the build for this mode by passing -std=gnu89.

Also, copy out CFLAGS for C++ test so that we don't end up passing
-std=gnu89 to g++, otherwise the build generates a (harmless) warning:

cc1plus: warning: command-line option ‘-std=gnu90’ is valid for C/ObjC but not for C++

Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
---
 tools/testing/selftests/bpf/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 54b0a41a3775..6239e51c310f 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -33,6 +33,9 @@ ifneq ($(LLVM),)
 CFLAGS += -Wno-unused-command-line-argument
 endif
 
+CXXFLAGS := $(CFLAGS)
+CFLAGS += -std=gnu89
+
 # Order correspond to 'make run_tests' order
 TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test_progs \
 	test_verifier_log test_dev_cgroup \
@@ -519,7 +522,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) $(CXXFLAGS) $(filter %.a %.o %.cpp,$^) $(LDLIBS) -o $@
 
 # Benchmark runner
 $(OUTPUT)/bench_%.o: benchs/bench_%.c bench.h $(BPFOBJ)
-- 
2.33.1


  parent reply	other threads:[~2021-11-05 23:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-05 23:42 [PATCH bpf-next v1 0/6] Change bpftool, libbpf, selftests to force GNU89 mode Kumar Kartikeya Dwivedi
2021-11-05 23:42 ` [PATCH bpf-next v1 1/6] bpftool: Compile using -std=gnu89 Kumar Kartikeya Dwivedi
2021-11-05 23:42 ` [PATCH bpf-next v1 2/6] libbpf: fix non-C89 loop variable declaration in gen_loader.c Kumar Kartikeya Dwivedi
2021-11-05 23:42 ` [PATCH bpf-next v1 3/6] libbpf: Compile using -std=gnu89 Kumar Kartikeya Dwivedi
2021-11-05 23:42 ` [PATCH bpf-next v1 4/6] selftests/bpf: Fix non-C89 loop variable declaration instances Kumar Kartikeya Dwivedi
2021-11-05 23:42 ` [PATCH bpf-next v1 5/6] selftests/bpf: Switch to non-unicode character in output Kumar Kartikeya Dwivedi
2021-11-05 23:42 ` Kumar Kartikeya Dwivedi [this message]
2021-11-06 16:33 ` [PATCH bpf-next v1 0/6] Change bpftool, libbpf, selftests to force GNU89 mode Alexei Starovoitov
2021-11-06 20:02   ` Andrii Nakryiko
2021-11-06 23:20     ` Alexei Starovoitov
2021-11-08 22:15       ` Andrii Nakryiko
2021-11-09 21:40         ` Alexei Starovoitov
2021-11-09 23:16           ` Andrii Nakryiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211105234243.390179-7-memxor@gmail.com \
    --to=memxor@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox