27 #ifndef INCLUDED_CODE_ANNOTATION
28 #define INCLUDED_CODE_ANNOTATION
49 #if HAVE_C99 && GCC_VERSION // _Pragma from C99, unused from GCC
50 # define UNUSED2(param) _Pragma("unused " #param)
54 # define UNUSED2(param) do{ if(¶m) {} } while(false)
56 # define UNUSED2(param) ((void)(param))
73 #if GCC_VERSION >= 303
74 # define NOTHROW_DECLARE __attribute__((nothrow))
75 # define NOTHROW_DEFINE // not supported for definitions
80 # define NOTHROW_DECLARE __declspec(nothrow)
81 # define NOTHROW_DEFINE __declspec(nothrow)
85 # define NOTHROW_DECLARE
86 # define NOTHROW_DEFINE
115 #define UNREACHABLE // actually defined below.. this is for
116 # undef UNREACHABLE // CppDoc's benefit only.
121 #define HAVE_ASSUME_UNREACHABLE 1
122 #if MSC_VERSION && !ICC_VERSION // (ICC ignores this)
123 # define ASSUME_UNREACHABLE __assume(0)
124 #elif GCC_VERSION >= 450
125 # define ASSUME_UNREACHABLE __builtin_unreachable()
127 # define ASSUME_UNREACHABLE
128 # undef HAVE_ASSUME_UNREACHABLE
129 # define HAVE_ASSUME_UNREACHABLE 0
135 #if HAVE_ASSUME_UNREACHABLE && !CONFIG_ENABLE_CHECKS
136 # define UNREACHABLE ASSUME_UNREACHABLE
142 # define UNREACHABLE\
144 DEBUG_WARN_ERR(ERR::LOGIC); \
160 #define NODEFAULT default: UNREACHABLE
168 #define PASTE3_HIDDEN__(a, b, c) a ## b ## c
169 #define PASTE3__(a, b, c) PASTE3_HIDDEN__(a, b, c)
170 #define UID__ PASTE3__(LINE_, __LINE__, _)
171 #define UID2__ PASTE3__(LINE_, __LINE__, _2)
178 #if GCC_VERSION >= 408
179 # define UNUSED_ATTRIBUTE __attribute__((unused))
181 # define UNUSED_ATTRIBUTE
193 #define cassert(expr) typedef static_assert_<(expr)>::type UID__ UNUSED_ATTRIBUTE
206 #define cassert_dependent(expr) typedef typename static_assert_<(expr)>::type UID__ UNUSED_ATTRIBUTE
214 #define cassert2(expr) extern char CASSERT_FAILURE[1][(expr)]
226 #define NONCOPYABLE(className)\
228 className(const className&);\
229 const className& operator=(const className&)
232 # define ASSUME_ALIGNED(ptr, multiple) __assume_aligned(ptr, multiple)
234 # define ASSUME_ALIGNED(ptr, multiple)
242 # define PRINTF_ARGS(fmtpos) __attribute__ ((format (printf, fmtpos, fmtpos+1)))
243 # define VPRINTF_ARGS(fmtpos) __attribute__ ((format (printf, fmtpos, 0)))
245 # define WPRINTF_ARGS(fmtpos) __attribute__ ((user("format, w, printf, " #fmtpos ", +1")))
247 # define WPRINTF_ARGS(fmtpos)
249 # define VWPRINTF_ARGS(fmtpos)
251 # define PRINTF_ARGS(fmtpos)
252 # define VPRINTF_ARGS(fmtpos)
253 # define WPRINTF_ARGS(fmtpos)
254 # define VWPRINTF_ARGS(fmtpos)
260 # define SENTINEL_ARG __attribute__ ((sentinel))
262 # define SENTINEL_ARG
269 # define COMPILER_FENCE __memory_barrier()
272 # pragma intrinsic(_ReadWriteBarrier)
273 # define COMPILER_FENCE _ReadWriteBarrier()
275 # define COMPILER_FENCE asm volatile("" : : : "memory")
277 # define COMPILER_FENCE
287 # define _W64 __attribute__((mode (__pointer__)))
315 # define RESTRICT __restrict__
317 #elif MSC_VERSION >= 1400
318 # define RESTRICT __restrict
325 # error ICC_VERSION defined without either GCC_VERSION or an adequate MSC_VERSION
343 #define ARRAY_SIZE(name) (sizeof(name) / (sizeof((name)[0])))
355 #define ARRAY_SIZE(name) (sizeof(*ArraySizeDeducer(name)))
357 #endif // GCC_VERSION
361 #if GCC_VERSION >= 300
364 #elif GCC_VERSION >= 200 || MSC_VERSION
365 # define __func__ __FUNCTION__
368 # define __func__ "(unknown)"
373 #if defined(__cplusplus)
374 # define EXTERN_C extern "C"
376 # define EXTERN_C extern
381 # define INLINE __forceinline
383 # define INLINE inline
388 # define CALL_CONV __cdecl
394 #if MSC_VERSION && !ARCH_AMD64
395 # define DECORATED_NAME(name) _##name
397 # define DECORATED_NAME(name) name
403 #define STRINGIZE2(id) # id
404 #define STRINGIZE(id) STRINGIZE2(id)
409 #define WIDEN2(x) L ## x
410 #define WIDEN(x) WIDEN2(x)
421 #define RVALUE_REF(T) T&&
426 #define LVALUE(rvalue) rvalue // in C++0x, a named rvalue reference is already an lvalue
431 #define RVALUE(lvalue) std::move(lvalue)
434 #if !HAVE_CPP0X // partial emulation
476 #define RVALUE_REF(T) const RValue<T>&
477 #define LVALUE(rvalue) rvalue.LValue()
478 #define RVALUE(lvalue) ToRValue(lvalue)
480 #endif // #if !HAVE_CPP0X
482 #endif // #ifndef INCLUDED_CODE_ANNOTATION
const RValue & operator=(const RValue &)
#define T(string_literal)
char(* ArraySizeDeducer(T(&)[n]))[n]
static RValue< T > ToRValue(T &lvalue)