From 126f243eb767fb529466b4077479b6d4d7425bf3 Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Tue, 14 Oct 2025 10:09:43 +0200 Subject: [PATCH] trace: Define TEST_FAIL and TEST_FAIL_TAG as inline function While these macros are usually used in conditions, they can also simply be used as a statement in order to check whether a certain code path was taken. In that case, using a macro that turns into a constant 0 may cause a compiler warning. Avoid that issue by using a static inline function that returns 0. This fixes a build regression introduced by f5790e97cd64 ("nl80211: Delay event processing during command handling"). Fixes: f5790e97cd64 ("nl80211: Delay event processing during command handling") Reported-by: Ben Greear Signed-off-by: Benjamin Berg --- src/utils/os.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/utils/os.h b/src/utils/os.h index 1bbaea3a4..9d6c34096 100644 --- a/src/utils/os.h +++ b/src/utils/os.h @@ -685,16 +685,19 @@ int os_exec(const char *program, const char *arg, int wait_completion); #define strcpy OS_DO_NOT_USE_strcpy #endif /* OS_REJECT_C_LIB_FUNCTIONS */ - -#if defined(WPA_TRACE_BFD) && defined(CONFIG_TESTING_OPTIONS) #define TEST_FAIL() testing_test_fail(NULL, false) #define TEST_FAIL_TAG(tag) testing_test_fail(tag, false) + +#if defined(WPA_TRACE_BFD) && defined(CONFIG_TESTING_OPTIONS) int testing_test_fail(const char *tag, bool is_alloc); int testing_set_fail_pattern(bool is_alloc, char *patterns); int testing_get_fail_pattern(bool is_alloc, char *buf, size_t buflen); #else -#define TEST_FAIL() 0 -#define TEST_FAIL_TAG(tag) 0 +static inline int testing_test_fail(const char *tag, bool is_alloc) +{ + return 0; +} + static inline int testing_set_fail_pattern(bool is_alloc, char *patterns) { return -1; -- 2.47.3