… | |
… | |
302 | |
302 | |
303 | #define ECB_CONCAT_(a, b) a ## b |
303 | #define ECB_CONCAT_(a, b) a ## b |
304 | #define ECB_CONCAT(a, b) ECB_CONCAT_(a, b) |
304 | #define ECB_CONCAT(a, b) ECB_CONCAT_(a, b) |
305 | #define ECB_STRINGIFY_(a) # a |
305 | #define ECB_STRINGIFY_(a) # a |
306 | #define ECB_STRINGIFY(a) ECB_STRINGIFY_(a) |
306 | #define ECB_STRINGIFY(a) ECB_STRINGIFY_(a) |
|
|
307 | #define ECB_STRINGIFY_EXPR(expr) ((expr), ECB_STRINGIFY_ (expr)) |
307 | |
308 | |
308 | #define ecb_function_ ecb_inline |
309 | #define ecb_function_ ecb_inline |
309 | |
310 | |
310 | #if ECB_GCC_VERSION(3,1) || ECB_CLANG_VERSION(2,8) |
311 | #if ECB_GCC_VERSION(3,1) || ECB_CLANG_VERSION(2,8) |
311 | #define ecb_attribute(attrlist) __attribute__ (attrlist) |
312 | #define ecb_attribute(attrlist) __attribute__ (attrlist) |
… | |
… | |
348 | #define ecb_deprecated __declspec (deprecated) |
349 | #define ecb_deprecated __declspec (deprecated) |
349 | #else |
350 | #else |
350 | #define ecb_deprecated ecb_attribute ((__deprecated__)) |
351 | #define ecb_deprecated ecb_attribute ((__deprecated__)) |
351 | #endif |
352 | #endif |
352 | |
353 | |
|
|
354 | #if __MSC_VER >= 1500 |
|
|
355 | #define ecb_deprecated_message(msg) __declspec (deprecated (msg)) |
|
|
356 | #elif ECB_GCC_VERSION(4,5) |
|
|
357 | #define ecb_deprecated_message(msg) ecb_attribute ((__deprecated__ (msg)) |
|
|
358 | #else |
|
|
359 | #define ecb_deprecated_message(msg) ecb_deprecated |
|
|
360 | #endif |
|
|
361 | |
|
|
362 | #if _MSC_VER >= 1400 |
|
|
363 | #define ecb_noinline __declspec (noinline) |
|
|
364 | #else |
353 | #define ecb_noinline ecb_attribute ((__noinline__)) |
365 | #define ecb_noinline ecb_attribute ((__noinline__)) |
|
|
366 | #endif |
|
|
367 | |
354 | #define ecb_unused ecb_attribute ((__unused__)) |
368 | #define ecb_unused ecb_attribute ((__unused__)) |
355 | #define ecb_const ecb_attribute ((__const__)) |
369 | #define ecb_const ecb_attribute ((__const__)) |
356 | #define ecb_pure ecb_attribute ((__pure__)) |
370 | #define ecb_pure ecb_attribute ((__pure__)) |
357 | |
371 | |
358 | /* TODO http://msdn.microsoft.com/en-us/library/k6ktzx3s.aspx __declspec(noreturn) */ |
|
|
359 | #if ECB_C11 || __IBMC_NORETURN |
372 | #if ECB_C11 || __IBMC_NORETURN |
360 | /* http://pic.dhe.ibm.com/infocenter/compbg/v121v141/topic/com.ibm.xlcpp121.bg.doc/language_ref/noreturn.html */ |
373 | /* http://pic.dhe.ibm.com/infocenter/compbg/v121v141/topic/com.ibm.xlcpp121.bg.doc/language_ref/noreturn.html */ |
361 | #define ecb_noreturn _Noreturn |
374 | #define ecb_noreturn _Noreturn |
|
|
375 | #elif ECB_CPP11 |
|
|
376 | #define ecb_noreturn [[noreturn]] |
|
|
377 | #elif _MSC_VER >= 1200 |
|
|
378 | /* http://msdn.microsoft.com/en-us/library/k6ktzx3s.aspx */ |
|
|
379 | #define ecb_noreturn __declspec (noreturn) |
362 | #else |
380 | #else |
363 | #define ecb_noreturn ecb_attribute ((__noreturn__)) |
381 | #define ecb_noreturn ecb_attribute ((__noreturn__)) |
364 | #endif |
382 | #endif |
365 | |
383 | |
366 | #if ECB_GCC_VERSION(4,3) |
384 | #if ECB_GCC_VERSION(4,3) |
… | |
… | |
573 | /* but less than using pointers, and always seems to */ |
591 | /* but less than using pointers, and always seems to */ |
574 | /* successfully return a constant. */ |
592 | /* successfully return a constant. */ |
575 | /* the reason why we have this horrible preprocessor mess */ |
593 | /* the reason why we have this horrible preprocessor mess */ |
576 | /* is to avoid it in all cases, at least on common architectures */ |
594 | /* is to avoid it in all cases, at least on common architectures */ |
577 | /* or when using a recent enough gcc version (>= 4.6) */ |
595 | /* or when using a recent enough gcc version (>= 4.6) */ |
578 | #if __i386 || __i386__ || _M_X86 || __amd64 || __amd64__ || _M_X64 |
596 | #if ((__i386 || __i386__) && !__VOS__) || _M_X86 || __amd64 || __amd64__ || _M_X64 |
579 | return 0x44; |
597 | return 0x44; |
580 | #elif __BYTE_ORDER__ && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ |
598 | #elif __BYTE_ORDER__ && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ |
581 | return 0x44; |
599 | return 0x44; |
582 | #elif __BYTE_ORDER__ && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ |
600 | #elif __BYTE_ORDER__ && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ |
583 | return 0x11; |
601 | return 0x11; |