Skip to content
Snippets Groups Projects
Commit e91dad93 authored by Cheng Shao's avatar Cheng Shao Committed by Marge Bot
Browse files

rts: fix errors when compiling with TSAN

This commit fixes rts compilation errors when compiling with TSAN:

- xxx_FENCE macros are redefined and trigger CPP warnings.
- Use SIZEOF_W. WORD_SIZE_IN_BITS is provided by MachDeps.h which
  Cmm.h doesn't include by default.
parent c8a4c050
No related branches found
No related tags found
No related merge requests found
......@@ -700,9 +700,9 @@
#if defined(TSAN_ENABLED)
// This is may be efficient than a fence but TSAN can reason about it.
#if WORD_SIZE_IN_BITS == 64
#if SIZEOF_W == 8
#define ACQUIRE_FENCE_ON(x) if (1) { W_ tmp; (tmp) = prim %load_acquire64(x); }
#elif WORD_SIZE_IN_BITS == 32
#elif SIZEOF_W == 4
#define ACQUIRE_FENCE_ON(x) if (1) { W_ tmp; (tmp) = prim %load_acquire32(x); }
#endif
#else
......
......@@ -549,6 +549,9 @@ busy_wait_nop(void)
#define SEQ_CST_FENCE() __atomic_thread_fence(__ATOMIC_SEQ_CST)
#if defined(TSAN_ENABLED)
#undef ACQUIRE_FENCE
#undef RELEASE_FENCE
#undef SEQ_CST_FENCE
#define ACQUIRE_FENCE() NO_WARN(-Wtsan, __atomic_thread_fence(__ATOMIC_ACQUIRE);)
#define RELEASE_FENCE() NO_WARN(-Wtsan, __atomic_thread_fence(__ATOMIC_RELEASE);)
#define SEQ_CST_FENCE() NO_WARN(-Wtsan, __atomic_thread_fence(__ATOMIC_SEQ_CST);)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment