3 #ifndef CDSLIB_COMPILER_GCC_COMPILER_MACRO_H
4 #define CDSLIB_COMPILER_GCC_COMPILER_MACRO_H
6 // OS interface && OS name
8 # if defined( __linux__ )
9 # define CDS_OS_INTERFACE CDS_OSI_UNIX
10 # define CDS_OS_TYPE CDS_OS_LINUX
11 # define CDS_OS__NAME "linux"
12 # define CDS_OS__NICK "linux"
13 # elif defined( __sun__ )
14 # define CDS_OS_INTERFACE CDS_OSI_UNIX
15 # define CDS_OS_TYPE CDS_OS_SUN_SOLARIS
16 # define CDS_OS__NAME "Sun Solaris"
17 # define CDS_OS__NICK "sun"
18 # elif defined( __hpux__ )
19 # define CDS_OS_INTERFACE CDS_OSI_UNIX
20 # define CDS_OS_TYPE CDS_OS_HPUX
21 # define CDS_OS__NAME "HP-UX"
22 # define CDS_OS__NICK "hpux"
23 # elif defined( _AIX )
24 # define CDS_OS_INTERFACE CDS_OSI_UNIX
25 # define CDS_OS_TYPE CDS_OS_AIX
26 # define CDS_OS__NAME "AIX"
27 # define CDS_OS__NICK "aix"
28 # elif defined( __FreeBSD__ )
29 # define CDS_OS_INTERFACE CDS_OSI_UNIX
30 # define CDS_OS_TYPE CDS_OS_FREE_BSD
31 # define CDS_OS__NAME "FreeBSD"
32 # define CDS_OS__NICK "freebsd"
33 # elif defined( __OpenBSD__ )
34 # define CDS_OS_INTERFACE CDS_OSI_UNIX
35 # define CDS_OS_TYPE CDS_OS_OPEN_BSD
36 # define CDS_OS__NAME "OpenBSD"
37 # define CDS_OS__NICK "openbsd"
38 # elif defined( __NetBSD__ )
39 # define CDS_OS_INTERFACE CDS_OSI_UNIX
40 # define CDS_OS_TYPE CDS_OS_NET_BSD
41 # define CDS_OS__NAME "NetBSD"
42 # define CDS_OS__NICK "netbsd"
43 # elif defined(__MINGW32__) || defined( __MINGW64__)
44 # define CDS_OS_INTERFACE CDS_OSI_WINDOWS
45 # define CDS_OS_TYPE CDS_OS_MINGW
46 # define CDS_OS__NAME "MinGW"
47 # define CDS_OS__NICK "mingw"
48 # elif defined(__MACH__)
49 # define CDS_OS_INTERFACE CDS_OSI_UNIX
50 # define CDS_OS_TYPE CDS_OS_OSX
51 # define CDS_OS__NAME "OS X"
52 # define CDS_OS__NICK "osx"
54 # define CDS_OS_INTERFACE CDS_OSI_UNIX
55 # define CDS_OS_TYPE CDS_OS_PTHREAD
56 # define CDS_OS__NAME "pthread"
57 # define CDS_OS__NICK "pthread"
59 #endif // #ifndef CDS_OS_TYPE
61 // Processor architecture
63 #if defined(__arm__) && !defined(__ARM_ARCH)
64 // GCC 4.6 does not defined __ARM_ARCH
65 # if defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__)
72 #if defined(__x86_64__) || defined(__amd64__) || defined(__amd64)
73 # define CDS_PROCESSOR_ARCH CDS_PROCESSOR_AMD64
74 # define CDS_BUILD_BITS 64
75 # define CDS_PROCESSOR__NAME "Intel x86-64"
76 # define CDS_PROCESSOR__NICK "amd64"
77 #elif defined(__i386__)
78 # define CDS_PROCESSOR_ARCH CDS_PROCESSOR_X86
79 # define CDS_BUILD_BITS 32
80 # define CDS_PROCESSOR__NAME "Intel x86"
81 # define CDS_PROCESSOR__NICK "x86"
82 #elif defined(sparc) || defined (__sparc__)
83 # define CDS_PROCESSOR_ARCH CDS_PROCESSOR_SPARC
84 # define CDS_PROCESSOR__NAME "Sparc"
85 # define CDS_PROCESSOR__NICK "sparc"
87 # define CDS_BUILD_BITS 64
89 # error Sparc 32bit is not supported
91 #elif defined( __ia64__)
92 # define CDS_PROCESSOR_ARCH CDS_PROCESSOR_IA64
93 # define CDS_BUILD_BITS 64
94 # define CDS_PROCESSOR__NAME "Intel IA64"
95 # define CDS_PROCESSOR__NICK "ia64"
96 #elif defined(_ARCH_PPC64)
97 # define CDS_PROCESSOR_ARCH CDS_PROCESSOR_PPC64
98 # define CDS_BUILD_BITS 64
99 # define CDS_PROCESSOR__NAME "IBM PowerPC64"
100 # define CDS_PROCESSOR__NICK "ppc64"
101 #elif defined(__arm__) && __SIZEOF_POINTER__ == 4 && __ARM_ARCH >= 7
102 # define CDS_PROCESSOR_ARCH CDS_PROCESSOR_ARM7
103 # define CDS_BUILD_BITS 32
104 # define CDS_PROCESSOR__NAME "ARM v7"
105 # define CDS_PROCESSOR__NICK "arm7"
107 # if defined(CDS_USE_LIBCDS_ATOMIC)
108 # error "Libcds does not support atomic implementation for the processor architecture. Try to use C++11-compatible compiler and remove CDS_USE_LIBCDS_ATOMIC flag from compiler command line"
110 # define CDS_PROCESSOR_ARCH CDS_PROCESSOR_UNKNOWN
111 # define CDS_BUILD_BITS 32
112 # define CDS_PROCESSOR__NAME "unknown"
113 # define CDS_PROCESSOR__NICK "unknown"
117 #if CDS_OS_TYPE == CDS_OS_MINGW
118 # ifdef CDS_BUILD_LIB
119 # define CDS_EXPORT_API __declspec(dllexport)
121 # define CDS_EXPORT_API __declspec(dllimport)
125 # define __declspec( _x )
129 #if CDS_PROCESSOR_ARCH == CDS_PROCESSOR_X86
130 # define CDS_STDCALL __attribute__((stdcall))
136 #endif // #ifndef CDSLIB_COMPILER_GCC_COMPILER_MACRO_H