From 24ed0c28926a98d70b39064161a3e34f32dfacac Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Sat, 7 Feb 2026 01:41:08 -0600 Subject: [PATCH] make: Prevent double wrapping of printf/vprintf This is a bit awkward due to Makefiles having no concept of boolean ors, but we can avoid passing multiple -Wl,--wrap flags with enough ifdefs/ifndefs. --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 4208d79b..f68e084e 100644 --- a/Makefile +++ b/Makefile @@ -113,9 +113,11 @@ TEST_CFLAGS += -DTEST_HEAP TEST_CFLAGS += -Wl,--wrap=malloc TEST_CFLAGS += -Wl,--wrap=free TEST_CFLAGS += -Wl,--wrap=realloc +ifndef STACK TEST_CFLAGS += -Wl,--wrap=printf TEST_CFLAGS += -Wl,--wrap=vprintf endif +endif BENCH_CFLAGS += -Wno-unused-function BENCH_CFLAGS += -Wno-format-overflow @@ -129,9 +131,11 @@ BENCH_CFLAGS += -DBENCH_HEAP BENCH_CFLAGS += -Wl,--wrap=malloc BENCH_CFLAGS += -Wl,--wrap=free BENCH_CFLAGS += -Wl,--wrap=realloc +ifdef NO_STACK BENCH_CFLAGS += -Wl,--wrap=printf BENCH_CFLAGS += -Wl,--wrap=vprintf endif +endif ifdef VERBOSE CODEFLAGS += -v