Skip to content

Support GCC’s ThreadSanitizer. - #157

Merged
cameron314 merged 1 commit into
cameron314:masterfrom
PromyLOPh:master
Jul 9, 2024
Merged

Support GCC’s ThreadSanitizer.#157
cameron314 merged 1 commit into
cameron314:masterfrom
PromyLOPh:master

Conversation

@PromyLOPh

Copy link
Copy Markdown
Contributor

GCC may or may not support __has_feature, depending on its version, but it does expose a different macro to check for the presence of the ThreadSanitizer during compile-time.

Comment thread atomicops.h Outdated
Comment thread atomicops.h Outdated
@PromyLOPh

Copy link
Copy Markdown
Contributor Author

If there’s a chance both feature test macros are supported (not sure), we might want to change the code to

diff --git a/atomicops.h b/atomicops.h
index a641333..1ebde3d 100644
--- a/atomicops.h
+++ b/atomicops.h
@@ -47,9 +47,8 @@
 // For GCC
 #if defined(__SANITIZE_THREAD__)
 #define AE_TSAN_IS_ENABLED 1
-#endif
 // For clang
-#if defined(__has_feature)
+#elif defined(__has_feature)
 #if __has_feature(thread_sanitizer)
 #define AE_TSAN_IS_ENABLED 1
 #endif

to avoid warnings about re-defined preprocessor macros.

Comment thread atomicops.h Outdated
Comment thread atomicops.h Outdated
Comment thread atomicops.h Outdated
Comment thread atomicops.h Outdated
GCC may or may not support __has_feature, depending on its version,
but it does expose a different macro to check for the presence of the
ThreadSanitizer during compile-time.

Co-authored-by: Cameron <[email protected]>
@cameron314
cameron314 merged commit 16b48ae into cameron314:master Jul 9, 2024
@cameron314

Copy link
Copy Markdown
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants