Commit a7c7b027 by Marcus Winter

fixes for disabled threading analysis mode

parent 46d4d607
...@@ -321,6 +321,7 @@ void embb_mutex_destroy( ...@@ -321,6 +321,7 @@ void embb_mutex_destroy(
#define EMBB_ATOMIC_MUTEX_UNLOCK(mutex) embb_mutex_unlock(&(mutex)) #define EMBB_ATOMIC_MUTEX_UNLOCK(mutex) embb_mutex_unlock(&(mutex))
#define EMBB_ATOMIC_MUTEX_DESTROY(mutex) embb_mutex_destroy(&(mutex)) #define EMBB_ATOMIC_MUTEX_DESTROY(mutex) embb_mutex_destroy(&(mutex))
#define EMBB_ATOMIC_INIT_CHECK(variable) assert(variable->marker == 0x12345678) #define EMBB_ATOMIC_INIT_CHECK(variable) assert(variable->marker == 0x12345678)
#define EMBB_ATOMIC_INIT_MARKER(variable) variable->marker = 0x12345678
#else #else
...@@ -328,7 +329,8 @@ void embb_mutex_destroy( ...@@ -328,7 +329,8 @@ void embb_mutex_destroy(
#define EMBB_ATOMIC_MUTEX_LOCK(...) #define EMBB_ATOMIC_MUTEX_LOCK(...)
#define EMBB_ATOMIC_MUTEX_UNLOCK(...) #define EMBB_ATOMIC_MUTEX_UNLOCK(...)
#define EMBB_ATOMIC_MUTEX_DESTROY(...) #define EMBB_ATOMIC_MUTEX_DESTROY(...)
#define EMBB_ATOMIC_INIT_CHECK(...) #define EMBB_ATOMIC_INIT_CHECK(variable) (void)(variable)
#define EMBB_ATOMIC_INIT_MARKER(variable) (void)(variable)
#endif #endif
......
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
#include <intrin.h> #include <intrin.h>
#endif #endif
#ifdef EMBB_THREADING_ANALYSIS_MODE
#define EMBB_ATOMIC_INTERNAL_DEFINE_VARIABLE( \ #define EMBB_ATOMIC_INTERNAL_DEFINE_VARIABLE( \
EMBB_ATOMIC_PARAMETER_TYPE_NATIVE, \ EMBB_ATOMIC_PARAMETER_TYPE_NATIVE, \
EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX) \ EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX) \
...@@ -45,6 +47,18 @@ ...@@ -45,6 +47,18 @@
uint32_t marker; \ uint32_t marker; \
} EMBB_CAT2(embb_atomic_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX); } EMBB_CAT2(embb_atomic_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX);
#else
#define EMBB_ATOMIC_INTERNAL_DEFINE_VARIABLE( \
EMBB_ATOMIC_PARAMETER_TYPE_NATIVE, \
EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX) \
typedef struct \
{ \
volatile EMBB_ATOMIC_PARAMETER_TYPE_NATIVE internal_variable; \
} EMBB_CAT2(embb_atomic_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX);
#endif
EMBB_ATOMIC_INTERNAL_DEFINE_VARIABLE(char, char) EMBB_ATOMIC_INTERNAL_DEFINE_VARIABLE(char, char)
EMBB_ATOMIC_INTERNAL_DEFINE_VARIABLE(short, short) EMBB_ATOMIC_INTERNAL_DEFINE_VARIABLE(short, short)
EMBB_ATOMIC_INTERNAL_DEFINE_VARIABLE(unsigned short, unsigned_short) EMBB_ATOMIC_INTERNAL_DEFINE_VARIABLE(unsigned short, unsigned_short)
......
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#define EMBB_ATOMIC_INTERNAL_DEFINE_DESTROY_METHOD(EMBB_ATOMIC_PARAMETER_TYPE_NATIVE, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX, EMBB_ATOMIC_PARAMETER_TYPE_SIZE) \ #define EMBB_ATOMIC_INTERNAL_DEFINE_DESTROY_METHOD(EMBB_ATOMIC_PARAMETER_TYPE_NATIVE, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX, EMBB_ATOMIC_PARAMETER_TYPE_SIZE) \
EMBB_PLATFORM_INLINE void EMBB_CAT2(embb_atomic_destroy_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)(\ EMBB_PLATFORM_INLINE void EMBB_CAT2(embb_atomic_destroy_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)(\
EMBB_CAT2(embb_atomic_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)* variable) { \ EMBB_CAT2(embb_atomic_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)* variable) { \
(void)variable; \
EMBB_ATOMIC_INIT_CHECK(variable); \ EMBB_ATOMIC_INIT_CHECK(variable); \
EMBB_ATOMIC_MUTEX_DESTROY(variable->internal_mutex); \ EMBB_ATOMIC_MUTEX_DESTROY(variable->internal_mutex); \
} }
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
EMBB_PLATFORM_INLINE void EMBB_CAT2(embb_atomic_init_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)(\ EMBB_PLATFORM_INLINE void EMBB_CAT2(embb_atomic_init_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)(\
EMBB_CAT2(embb_atomic_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)* variable) { \ EMBB_CAT2(embb_atomic_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)* variable) { \
EMBB_ATOMIC_MUTEX_INIT(variable->internal_mutex); \ EMBB_ATOMIC_MUTEX_INIT(variable->internal_mutex); \
variable->marker = 0x12345678; \ EMBB_ATOMIC_INIT_MARKER(variable); \
} }
#undef EMBB_ATOMIC_METHOD_TO_GENERATE #undef EMBB_ATOMIC_METHOD_TO_GENERATE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment