aboutsummaryrefslogtreecommitdiffstats
path: root/erts/include/internal/ethread_inline.h
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2015-03-20 22:05:10 +0100
committerRickard Green <[email protected]>2015-03-20 22:05:10 +0100
commitb99ce1c3a64f24e68b8a937338546fdf60501c65 (patch)
treef05aca3b1f87413ea9f04cd9b3569597da0f996f /erts/include/internal/ethread_inline.h
parent6642d62c071f94d3e76254453099e2df01f7ad0e (diff)
parent24fa075b5c0d54f2035a2ff510a82aa19187eda4 (diff)
downloadotp-b99ce1c3a64f24e68b8a937338546fdf60501c65.tar.gz
otp-b99ce1c3a64f24e68b8a937338546fdf60501c65.tar.bz2
otp-b99ce1c3a64f24e68b8a937338546fdf60501c65.zip
Merge branch 'rickard/gcc-atomics/OTP-12383'
* rickard/gcc-atomics/OTP-12383: Improve ethread atomics based on GCC builtins Conflicts: erts/aclocal.m4
Diffstat (limited to 'erts/include/internal/ethread_inline.h')
-rw-r--r--erts/include/internal/ethread_inline.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/erts/include/internal/ethread_inline.h b/erts/include/internal/ethread_inline.h
index ffb756c84f..c09a67619a 100644
--- a/erts/include/internal/ethread_inline.h
+++ b/erts/include/internal/ethread_inline.h
@@ -20,6 +20,29 @@
#ifndef ETHREAD_INLINE_H__
#define ETHREAD_INLINE_H__
+#define ETHR_GCC_COMPILER_FALSE 0 /* Not a gcc compatible compiler */
+#define ETHR_GCC_COMPILER_TRUE 1 /* The GNU gcc compiler */
+/* Negative integers for gcc compatible compilers */
+#define ETHR_GCC_COMPILER_CLANG -1 /* The Clang gcc compatible compiler */
+#define ETHR_GCC_COMPILER_ICC -2 /* The Intel gcc compatible compiler */
+/* Line them up... */
+
+/*
+ * Unfortunately there is no easy and certain way of
+ * detecting a true gcc compiler, since the compatible
+ * ones all define the same defines as the true gnu-gcc...
+ */
+#if !defined(__GNUC__) && !defined(__GNUG__)
+# define ETHR_GCC_COMPILER ETHR_GCC_COMPILER_FALSE
+#elif defined(__clang__)
+# define ETHR_GCC_COMPILER ETHR_GCC_COMPILER_CLANG
+#elif defined(__ICC) || defined(__INTEL_COMPILER)
+# define ETHR_GCC_COMPILER ETHR_GCC_COMPILER_ICC
+#else
+/* Seems to be the true gnu-gcc... */
+# define ETHR_GCC_COMPILER ETHR_GCC_COMPILER_TRUE
+#endif
+
#if !defined(__GNUC__)
# define ETHR_AT_LEAST_GCC_VSN__(MAJ, MIN, PL) 0
#elif !defined(__GNUC_MINOR__)