From: Benjamin Berg Date: Tue, 14 Oct 2025 08:09:43 +0000 (+0200) Subject: trace: Define TEST_FAIL and TEST_FAIL_TAG as inline function X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=126f243eb767;p=thirdparty%2Fhostap.git 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 --- 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;