disable gcc atomic operations on non-supported compilers and gcc versions
Costa Tsaousis committed
Aug 13, 2016 at 02:02 UTC
db787ff47f80740ae266e0e347a6b49b3a395c35
1 file changed
+22
-8
src/common.h
+22
-8
@@ -60,6 +60,28 @@
60
#include <zlib.h>
61
#endif
62
63
+#ifdef __GNUC__
64
+#define GCC_VERSION (__GNUC__ * 10000 \
65
+ + __GNUC_MINOR__ * 100 \
66
+ + __GNUC_PATCHLEVEL__)
67
+
68
+// test for gcc version < 4.1.2
69
+// to disable gcc atomic operations
70
+#if GCC_VERSION < 40102
71
+#define NETDATA_NO_ATOMIC_INSTRUCTIONS 1
72
+#endif
73
+
74
+#if __x86_64__ || __ppc64__
75
+#define ENVIRONMENT64
76
+#else
77
+#define ENVIRONMENT32
78
+#endif
79
+
80
+#else // !__GNUC__
81
+#define NETDATA_NO_ATOMIC_INSTRUCTIONS 1
82
+#define ENVIRONMENT32
83
+#endif // __GNUC__
84
+
85
#include "avl.h"
86
#include "log.h"
87
#include "global_statistics.h"
@@ -94,14 +116,6 @@
116
#include "main.h"
117
#include "unit_test.h"
118
97
-#if __GNUC__
98
-#if __x86_64__ || __ppc64__
99
-#define ENVIRONMENT64
100
-#else
101
-#define ENVIRONMENT32
102
-#endif
103
-#endif
104
-
119
#ifdef abs
120
#undef abs
121
#endif