]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
trace: Define TEST_FAIL and TEST_FAIL_TAG as inline function
authorBenjamin Berg <benjamin.berg@intel.com>
Tue, 14 Oct 2025 08:09:43 +0000 (10:09 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 17 Oct 2025 14:06:16 +0000 (17:06 +0300)
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 <greearb@candelatech.com>
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
src/utils/os.h

index 1bbaea3a4bdc3b3e5c44c71f2bf9469f7a2cb822..9d6c340966c1609c69d5dab67edc0c937d057daf 100644 (file)
@@ -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;