linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tools/libbpf: add WERROR option
@ 2025-07-05 10:43 Sam James
  2025-07-07 13:18 ` Daniel Borkmann
  0 siblings, 1 reply; 8+ messages in thread
From: Sam James @ 2025-07-05 10:43 UTC (permalink / raw)
  To: bpf, Andrii Nakryiko, Eduard Zingerman, Alexei Starovoitov,
	Daniel Borkmann, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa
  Cc: linux-kernel, Sam James

Check the 'WERROR' variable and suppress adding '-Werror' if WERROR=0.

This mirrors what tools/perf and other directories in tools do to handle
-Werror rather than adding it unconditionally.

Signed-off-by: Sam James <sam@gentoo.org>
---
 tools/lib/bpf/Makefile | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index 168140f8e646..9563d37265da 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -77,10 +77,15 @@ else
   CFLAGS := -g -O2
 endif
 
+# Treat warnings as errors unless directed not to
+ifneq ($(WERROR),0)
+  CFLAGS += -Werror
+endif
+
 # Append required CFLAGS
 override CFLAGS += -std=gnu89
 override CFLAGS += $(EXTRA_WARNINGS) -Wno-switch-enum
-override CFLAGS += -Werror -Wall
+override CFLAGS += -Wall
 override CFLAGS += $(INCLUDES)
 override CFLAGS += -fvisibility=hidden
 override CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-07-13 23:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-05 10:43 [PATCH] tools/libbpf: add WERROR option Sam James
2025-07-07 13:18 ` Daniel Borkmann
2025-07-07 13:33   ` Quentin Monnet
2025-07-13  6:21     ` Sam James
2025-07-13  6:23   ` Sam James
2025-07-13 22:45     ` Alexei Starovoitov
2025-07-13 22:58       ` Sam James
2025-07-13 23:03         ` Alexei Starovoitov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).