MXS-2008 Move content of maxscale/platform.h to maxbase/cdefs.h

No good reason for keeping that platform adjustments anywhere
else but in cdefs.h.
This commit is contained in:
Johan Wikman
2018-08-17 13:37:51 +03:00
parent 90960ec07f
commit aaad63ee5e
17 changed files with 40 additions and 70 deletions

View File

@ -72,3 +72,41 @@
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
/**
* thread_local
*/
#if !defined(__cplusplus)
#if __STDC_VERSION__ >= 201112
#if defined(__STDC_NO_THREADS__)
#define thread_local _Thread_local
#else
#include <threads.h>
#endif
#else // __STDC_VERSION >= 201112
#if defined(__GNUC__)
#define thread_local __thread
#else
#error Do not know how to define thread_local on this compiler/OS platform.
#endif
#endif
#else // __cplusplus
// GCC 4.8 added support for native thread_local.
#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8)
#if defined(__GNUC__)
#define thread_local __thread
#else
#error Do not know how to define thread_local on this compiler/OS platform.
#endif
#endif
#endif // __cplusplus