Hi all.
Using cl or clang-cl to build the BladeRF-fsk.exe program on Win-10, I get these errors:
utilities/bladeRF-fsk/c/src/link.c(205,12): error: assigning to 'int' from incompatible type 'void'
205 | status = MUTEX_INIT(&(link->tx->data_buf_status_lock));
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
utilities/bladeRF-fsk/c/src/link.c(235,12): error: assigning to 'int' from incompatible type 'void'
235 | status = MUTEX_INIT(&(link->rx->data_buf_status_lock));
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
utilities/bladeRF-fsk/c/src/link.c(247,12): error: assigning to 'int' from incompatible type 'void'
247 | status = MUTEX_INIT(&(link->rx->ack_buf_status_lock));
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
utilities/bladeRF-fsk/c/src/link.c(299,20): error: assigning to 'int' from incompatible type 'void'
299 | status = MUTEX_DESTROY(&(link->tx->data_buf_status_lock));
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
utilities/bladeRF-fsk/c/src/link.c(303,20): error: assigning to 'int' from incompatible type 'void'
303 | status = COND_DESTROY(&(link->tx->data_buf_filled_cond));
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Since they do not like these macro-definitions in host/utilities/bladeRF-fsk/c/src/thread.h.
E.g. the 1st error expands to:
status = InitializeCriticalSection (& (link->tx->data_buf_status_lock));
which is illegal C-code; InitializeCriticalSection() returns void.
But redefining those macros into:
--- a/host/utilities/bladeRF-fsk/c/src/thread.h 2026-03-23 15:38:37
+++ b/host/utilities/bladeRF-fsk/c/src/thread.h 2026-09-16 06:45:33
@@ -78,10 +78,10 @@
#define MUTEX CRITICAL_SECTION
#define COND CONDITION_VARIABLE
-#define MUTEX_INIT(m) InitializeCriticalSection(m)
-#define MUTEX_LOCK(m) EnterCriticalSection(m)
-#define MUTEX_UNLOCK(m) LeaveCriticalSection(m)
-#define MUTEX_DESTROY(m) DeleteCriticalSection(m)
+#define MUTEX_INIT(m) (InitializeCriticalSection(m), 0)
+#define MUTEX_LOCK(m) (EnterCriticalSection(m), 0)
+#define MUTEX_UNLOCK(m) (LeaveCriticalSection(m), 0)
+#define MUTEX_DESTROY(m) (DeleteCriticalSection(m), 0)
#define THREAD_CREATE(h,f,a) \
((*(h) = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)(f),(LPVOID)(a),0,NULL)) == NULL ? GetLastError() : 0)
@@ -92,8 +92,10 @@
#define THREAD_EXIT(s) ExitThread(s)
#define COND_INIT(c) (InitializeConditionVariable(c), 0)
-#define COND_SIGNAL(c) WakeConditionVariable(c)
-#define COND_DESTROY(c) ((void)0)
+
+#define COND_SIGNAL(c) (WakeConditionVariable(c), 0)
+#define COND_DESTROY(c) (0)
+
#define COND_TIMED_WAIT(c,m,t) (SleepConditionVariableCS(c,m,t) ? 0 : GetLastError())
#define COND_WAIT(c,m) (!SleepConditionVariableCS(c,m,INFINITE))
it compiles fine.
BTW. why are these macros defined in 2 places? One thread.h file should be enough IMHO.
Hi all.
Using
clorclang-clto build theBladeRF-fsk.exeprogram on Win-10, I get these errors:Since they do not like these macro-definitions in
host/utilities/bladeRF-fsk/c/src/thread.h.E.g. the 1st error expands to:
which is illegal C-code;
InitializeCriticalSection()returnsvoid.But redefining those macros into:
it compiles fine.
BTW. why are these macros defined in 2 places? One
thread.hfile should be enough IMHO.