ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libecb/ecb.h
(Generate patch)

Comparing libecb/ecb.h (file contents):
Revision 1.89 by root, Mon May 28 08:54:03 2012 UTC vs.
Revision 1.90 by root, Tue May 29 14:09:49 2012 UTC

79 #else 79 #else
80 #define ECB_GCC_VERSION(major,minor) (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))) 80 #define ECB_GCC_VERSION(major,minor) (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
81 #endif 81 #endif
82#endif 82#endif
83 83
84#define ECB_C99 (__STDC_VERSION__ >= 199901L)
85#define ECB_C11 (__STDC_VERSION__ >= 201112L)
86
84/*****************************************************************************/ 87/*****************************************************************************/
85 88
86/* ECB_NO_THREADS - ecb is not used by multiple threads, ever */ 89/* ECB_NO_THREADS - ecb is not used by multiple threads, ever */
87/* ECB_NO_SMP - ecb might be used in multiple threads, but only on a single cpu */ 90/* ECB_NO_SMP - ecb might be used in multiple threads, but only on a single cpu */
88 91
90# define ECB_NO_SMP 1 93# define ECB_NO_SMP 1
91#endif 94#endif
92 95
93#if ECB_NO_THREADS || ECB_NO_SMP 96#if ECB_NO_THREADS || ECB_NO_SMP
94 #define ECB_MEMORY_FENCE do { } while (0) 97 #define ECB_MEMORY_FENCE do { } while (0)
98#endif
99
100#ifndef ECB_MEMORY_FENCE
101 #if ECB_C11 && !defined __STDC_NO_ATOMICS__
102 /* we assume that these memory fences work on all variables/all memory accesses, */
103 /* not just C11 atomics and atomic accesses */
104 #include <stdatomic.h>
105 #define ECB_MEMORY_FENCE atomic_thread_fence (memory_order_acq_rel)
106 #define ECB_MEMORY_FENCE_ACQUIRE atomic_thread_fence (memory_order_acquire)
107 #define ECB_MEMORY_FENCE_RELEASE atomic_thread_fence (memory_order_release)
108 #endif
95#endif 109#endif
96 110
97#ifndef ECB_MEMORY_FENCE 111#ifndef ECB_MEMORY_FENCE
98 #if ECB_GCC_VERSION(2,5) || defined __INTEL_COMPILER || (__llvm__ && __GNUC__) || __SUNPRO_C >= 0x5110 || __SUNPRO_CC >= 0x5110 112 #if ECB_GCC_VERSION(2,5) || defined __INTEL_COMPILER || (__llvm__ && __GNUC__) || __SUNPRO_C >= 0x5110 || __SUNPRO_CC >= 0x5110
99 #if __i386 || __i386__ 113 #if __i386 || __i386__
175 #define ECB_MEMORY_FENCE_RELEASE ECB_MEMORY_FENCE 189 #define ECB_MEMORY_FENCE_RELEASE ECB_MEMORY_FENCE
176#endif 190#endif
177 191
178/*****************************************************************************/ 192/*****************************************************************************/
179 193
180#define ECB_C99 (__STDC_VERSION__ >= 199901L)
181
182#if __cplusplus 194#if __cplusplus
183 #define ecb_inline static inline 195 #define ecb_inline static inline
184#elif ECB_GCC_VERSION(2,5) 196#elif ECB_GCC_VERSION(2,5)
185 #define ecb_inline static __inline__ 197 #define ecb_inline static __inline__
186#elif ECB_C99 198#elif ECB_C99
224#elif ECB_GCC_VERSION(3,0) 236#elif ECB_GCC_VERSION(3,0)
225 #define ecb_decltype(x) __typeof(x) 237 #define ecb_decltype(x) __typeof(x)
226#endif 238#endif
227 239
228#define ecb_noinline ecb_attribute ((__noinline__)) 240#define ecb_noinline ecb_attribute ((__noinline__))
229#define ecb_noreturn ecb_attribute ((__noreturn__))
230#define ecb_unused ecb_attribute ((__unused__)) 241#define ecb_unused ecb_attribute ((__unused__))
231#define ecb_const ecb_attribute ((__const__)) 242#define ecb_const ecb_attribute ((__const__))
232#define ecb_pure ecb_attribute ((__pure__)) 243#define ecb_pure ecb_attribute ((__pure__))
244
245#if ECB_C11
246 #define ecb_noreturn _Noreturn
247#else
248 #define ecb_noreturn ecb_attribute ((__noreturn__))
249#endif
233 250
234#if ECB_GCC_VERSION(4,3) 251#if ECB_GCC_VERSION(4,3)
235 #define ecb_artificial ecb_attribute ((__artificial__)) 252 #define ecb_artificial ecb_attribute ((__artificial__))
236 #define ecb_hot ecb_attribute ((__hot__)) 253 #define ecb_hot ecb_attribute ((__hot__))
237 #define ecb_cold ecb_attribute ((__cold__)) 254 #define ecb_cold ecb_attribute ((__cold__))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines