comparison DEPENDENCIES/generic/include/boost/interprocess/detail/workaround.hpp @ 101:c530137014c0

Update Boost headers (1.58.0)
author Chris Cannam
date Mon, 07 Sep 2015 11:12:49 +0100
parents 2665513ce2d3
children
comparison
equal deleted inserted replaced
100:793467b5e61c 101:c530137014c0
9 ////////////////////////////////////////////////////////////////////////////// 9 //////////////////////////////////////////////////////////////////////////////
10 10
11 #ifndef BOOST_INTERPROCESS_DETAIL_WORKAROUND_HPP 11 #ifndef BOOST_INTERPROCESS_DETAIL_WORKAROUND_HPP
12 #define BOOST_INTERPROCESS_DETAIL_WORKAROUND_HPP 12 #define BOOST_INTERPROCESS_DETAIL_WORKAROUND_HPP
13 13
14 #ifndef BOOST_CONFIG_HPP
15 # include <boost/config.hpp>
16 #endif
17 #
18 #if defined(BOOST_HAS_PRAGMA_ONCE)
19 # pragma once
20 #endif
21
14 #include <boost/interprocess/detail/config_begin.hpp> 22 #include <boost/interprocess/detail/config_begin.hpp>
15 23
16 #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) 24 #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
17 #define BOOST_INTERPROCESS_WINDOWS 25 #define BOOST_INTERPROCESS_WINDOWS
18 #define BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION 26 #define BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION
20 //Define this to connect with shared memory created with versions < 1.54 28 //Define this to connect with shared memory created with versions < 1.54
21 //#define BOOST_INTERPROCESS_BOOTSTAMP_IS_LASTBOOTUPTIME 29 //#define BOOST_INTERPROCESS_BOOTSTAMP_IS_LASTBOOTUPTIME
22 #else 30 #else
23 #include <unistd.h> 31 #include <unistd.h>
24 32
25 #if defined(_POSIX_THREAD_PROCESS_SHARED) && ((_POSIX_THREAD_PROCESS_SHARED - 0) > 0) 33 //////////////////////////////////////////////////////
34 //Check for XSI shared memory objects. They are available in nearly all UNIX platforms
35 //////////////////////////////////////////////////////
36 #if !defined(__QNXNTO__) && !defined(__ANDROID__) && !defined(__HAIKU__)
37 #define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS
38 #endif
39
40 //////////////////////////////////////////////////////
41 // From SUSv3/UNIX 98, pthread_mutexattr_settype is mandatory
42 //////////////////////////////////////////////////////
43 #if defined(_XOPEN_UNIX) && ((_XOPEN_VERSION + 0) >= 500)
44 #define BOOST_INTERPROCESS_POSIX_RECURSIVE_MUTEXES
45 #endif
46
47 //////////////////////////////////////////////////////
48 // _POSIX_THREAD_PROCESS_SHARED (POSIX.1b/POSIX.4)
49 //////////////////////////////////////////////////////
50 #if defined(_POSIX_THREAD_PROCESS_SHARED) && ((_POSIX_THREAD_PROCESS_SHARED + 0) > 0)
26 //Cygwin defines _POSIX_THREAD_PROCESS_SHARED but does not implement it. 51 //Cygwin defines _POSIX_THREAD_PROCESS_SHARED but does not implement it.
27 #if defined(__CYGWIN__) 52 #if defined(__CYGWIN__)
28 #define BOOST_INTERPROCESS_BUGGY_POSIX_PROCESS_SHARED 53 #define BOOST_INTERPROCESS_BUGGY_POSIX_PROCESS_SHARED
29 //Mac Os X < Lion (10.7) might define _POSIX_THREAD_PROCESS_SHARED but there is no real support. 54 //Mac Os X < Lion (10.7) might define _POSIX_THREAD_PROCESS_SHARED but there is no real support.
30 #elif defined(__APPLE__) 55 #elif defined(__APPLE__)
45 #else 70 #else
46 #define BOOST_INTERPROCESS_POSIX_PROCESS_SHARED 71 #define BOOST_INTERPROCESS_POSIX_PROCESS_SHARED
47 #endif 72 #endif
48 #endif 73 #endif
49 74
50 #if defined(_POSIX_BARRIERS) && ((_POSIX_BARRIERS - 0) > 0) 75 //////////////////////////////////////////////////////
51 #define BOOST_INTERPROCESS_POSIX_BARRIERS 76 // _POSIX_SHARED_MEMORY_OBJECTS (POSIX.1b/POSIX.4)
52 #endif 77 //////////////////////////////////////////////////////
53 78 #if ( defined(_POSIX_SHARED_MEMORY_OBJECTS) && ((_POSIX_SHARED_MEMORY_OBJECTS + 0) > 0) ) ||\
54 #if defined(_POSIX_SEMAPHORES) && ((_POSIX_SEMAPHORES - 0) > 0) 79 (defined(__vms) && __CRTL_VER >= 70200000)
55 #define BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES
56 #if defined(__CYGWIN__)
57 #define BOOST_INTERPROCESS_POSIX_SEMAPHORES_NO_UNLINK
58 #endif
59 //Some platforms have a limited (name length) named semaphore support
60 #elif (defined(__FreeBSD__) && (__FreeBSD__ >= 4)) || defined(__APPLE__)
61 #define BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES
62 #endif
63
64 #if ((defined _V6_ILP32_OFFBIG) &&(_V6_ILP32_OFFBIG - 0 > 0)) ||\
65 ((defined _V6_LP64_OFF64) &&(_V6_LP64_OFF64 - 0 > 0)) ||\
66 ((defined _V6_LPBIG_OFFBIG) &&(_V6_LPBIG_OFFBIG - 0 > 0)) ||\
67 ((defined _XBS5_ILP32_OFFBIG)&&(_XBS5_ILP32_OFFBIG - 0 > 0)) ||\
68 ((defined _XBS5_LP64_OFF64) &&(_XBS5_LP64_OFF64 - 0 > 0)) ||\
69 ((defined _XBS5_LPBIG_OFFBIG)&&(_XBS5_LPBIG_OFFBIG - 0 > 0)) ||\
70 ((defined _FILE_OFFSET_BITS) &&(_FILE_OFFSET_BITS - 0 >= 64))||\
71 ((defined _FILE_OFFSET_BITS) &&(_FILE_OFFSET_BITS - 0 >= 64))
72 #define BOOST_INTERPROCESS_UNIX_64_BIT_OR_BIGGER_OFF_T
73 #endif
74
75 //Check for XSI shared memory objects. They are available in nearly all UNIX platforms
76 #if !defined(__QNXNTO__)
77 #define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS
78 #endif
79
80 #if defined(_POSIX_SHARED_MEMORY_OBJECTS) && ((_POSIX_SHARED_MEMORY_OBJECTS - 0) > 0)
81 #define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS 80 #define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS
82 #else
83 //VMS and MACOS don't define it but they have shm_open/close interface
84 #if defined(__vms)
85 #if __CRTL_VER >= 70200000
86 #define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS
87 #endif
88 //Mac OS has some non-conformant features like names limited to SHM_NAME_MAX
89 #elif defined (__APPLE__)
90 //#define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS
91 //#define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS_NO_GROW
92 #endif
93 #endif
94
95 //Now check if we have only XSI shared memory
96 #if defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS) &&\
97 !defined(BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS)
98 //#define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS_ONLY
99 #endif
100
101 #if defined(_POSIX_TIMEOUTS) && ((_POSIX_TIMEOUTS - 0) > 0)
102 #define BOOST_INTERPROCESS_POSIX_TIMEOUTS
103 #endif
104
105 #ifdef BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS
106 //Some systems have filesystem-based resources, so the 81 //Some systems have filesystem-based resources, so the
107 //portable "/shmname" format does not work due to permission issues 82 //portable "/shmname" format does not work due to permission issues
108 //For those systems we need to form a path to a temporary directory: 83 //For those systems we need to form a path to a temporary directory:
109 // hp-ux tru64 vms freebsd 84 // hp-ux tru64 vms freebsd
110 #if defined(__hpux) || defined(__osf__) || defined(__vms) || (defined(__FreeBSD__) && (__FreeBSD__ < 7)) 85 #if defined(__hpux) || defined(__osf__) || defined(__vms) || (defined(__FreeBSD__) && (__FreeBSD__ < 7))
111 #define BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SHARED_MEMORY 86 #define BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SHARED_MEMORY
112 //Some systems have "jailed" environments where shm usage is restricted at runtime 87 //Some systems have "jailed" environments where shm usage is restricted at runtime
113 //and temporary file file based shm is possible in those executions. 88 //and temporary file based shm is possible in those executions.
114 #elif defined(__FreeBSD__) 89 #elif defined(__FreeBSD__)
115 #define BOOST_INTERPROCESS_RUNTIME_FILESYSTEM_BASED_POSIX_SHARED_MEMORY 90 #define BOOST_INTERPROCESS_RUNTIME_FILESYSTEM_BASED_POSIX_SHARED_MEMORY
116 #endif 91 #endif
117 #endif 92 #endif
118 93
119 #ifdef BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES 94 //////////////////////////////////////////////////////
95 // _POSIX_MAPPED_FILES (POSIX.1b/POSIX.4)
96 //////////////////////////////////////////////////////
97 #if defined(_POSIX_MAPPED_FILES) && ((_POSIX_MAPPED_FILES + 0) > 0)
98 #define BOOST_INTERPROCESS_POSIX_MAPPED_FILES
99 #endif
100
101 //////////////////////////////////////////////////////
102 // _POSIX_SEMAPHORES (POSIX.1b/POSIX.4)
103 //////////////////////////////////////////////////////
104 #if ( defined(_POSIX_SEMAPHORES) && ((_POSIX_SEMAPHORES + 0) > 0) ) ||\
105 ( defined(__FreeBSD__) && (__FreeBSD__ >= 4)) || \
106 defined(__APPLE__)
107 #define BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES
108 //MacOsX declares _POSIX_SEMAPHORES but sem_init returns ENOSYS
109 #if !defined(__APPLE__)
110 #define BOOST_INTERPROCESS_POSIX_UNNAMED_SEMAPHORES
111 #endif
120 #if defined(__osf__) || defined(__vms) 112 #if defined(__osf__) || defined(__vms)
121 #define BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SEMAPHORES 113 #define BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SEMAPHORES
122 #endif 114 #endif
123 #endif 115 #endif
124 116
125 #if defined(_POSIX_VERSION) && defined(_XOPEN_VERSION) && \ 117 //////////////////////////////////////////////////////
126 (((_POSIX_VERSION + 0)>= 200112L || (_XOPEN_VERSION + 0)>= 500)) 118 // _POSIX_BARRIERS (SUSv3/Unix03)
127 #define BOOST_INTERPROCESS_POSIX_RECURSIVE_MUTEXES 119 //////////////////////////////////////////////////////
120 #if defined(_POSIX_BARRIERS) && ((_POSIX_BARRIERS + 0) >= 200112L)
121 #define BOOST_INTERPROCESS_POSIX_BARRIERS
128 #endif 122 #endif
129 123
124 //////////////////////////////////////////////////////
125 // _POSIX_TIMEOUTS (SUSv3/Unix03)
126 //////////////////////////////////////////////////////
127 #if defined(_POSIX_TIMEOUTS) && ((_POSIX_TIMEOUTS + 0L) >= 200112L)
128 #define BOOST_INTERPROCESS_POSIX_TIMEOUTS
129 #endif
130
131 //////////////////////////////////////////////////////
132 // Detect BSD derivatives to detect sysctl
133 //////////////////////////////////////////////////////
130 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) 134 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
131 #define BOOST_INTERPROCESS_BSD_DERIVATIVE 135 #define BOOST_INTERPROCESS_BSD_DERIVATIVE
132 //Some *BSD systems (OpenBSD & NetBSD) need sys/param.h before sys/sysctl.h, whereas 136 //Some *BSD systems (OpenBSD & NetBSD) need sys/param.h before sys/sysctl.h, whereas
133 //others (FreeBSD & Darwin) need sys/types.h 137 //others (FreeBSD & Darwin) need sys/types.h
134 #include <sys/types.h> 138 #include <sys/types.h>
136 #include <sys/sysctl.h> 140 #include <sys/sysctl.h>
137 #if defined(CTL_KERN) && defined (KERN_BOOTTIME) 141 #if defined(CTL_KERN) && defined (KERN_BOOTTIME)
138 //#define BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME 142 //#define BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME
139 #endif 143 #endif
140 #endif 144 #endif
145
146 //////////////////////////////////////////////////////
147 //64 bit offset
148 //////////////////////////////////////////////////////
149 #if (defined (_V6_ILP32_OFFBIG) &&(_V6_ILP32_OFFBIG - 0 > 0)) ||\
150 (defined (_V6_LP64_OFF64) &&(_V6_LP64_OFF64 - 0 > 0)) ||\
151 (defined (_V6_LPBIG_OFFBIG) &&(_V6_LPBIG_OFFBIG - 0 > 0)) ||\
152 (defined (_XBS5_ILP32_OFFBIG)&&(_XBS5_ILP32_OFFBIG - 0 > 0)) ||\
153 (defined (_XBS5_LP64_OFF64) &&(_XBS5_LP64_OFF64 - 0 > 0)) ||\
154 (defined (_XBS5_LPBIG_OFFBIG)&&(_XBS5_LPBIG_OFFBIG - 0 > 0)) ||\
155 (defined (_FILE_OFFSET_BITS) &&(_FILE_OFFSET_BITS - 0 >= 64))||\
156 (defined (_FILE_OFFSET_BITS) &&(_FILE_OFFSET_BITS - 0 >= 64))
157 #define BOOST_INTERPROCESS_UNIX_64_BIT_OR_BIGGER_OFF_T
158 #endif
141 #endif //!defined(BOOST_INTERPROCESS_WINDOWS) 159 #endif //!defined(BOOST_INTERPROCESS_WINDOWS)
142 160
143 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) 161 #if defined(BOOST_INTERPROCESS_WINDOWS) || defined(BOOST_INTERPROCESS_POSIX_MAPPED_FILES)
144 #define BOOST_INTERPROCESS_PERFECT_FORWARDING 162 # define BOOST_INTERPROCESS_MAPPED_FILES
145 #endif 163 #endif
146 164
147 //Now declare some Boost.Interprocess features depending on the implementation 165 //Now declare some Boost.Interprocess features depending on the implementation
148 #if defined(BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES) && !defined(BOOST_INTERPROCESS_POSIX_SEMAPHORES_NO_UNLINK) 166 #if defined(BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES) && !defined(BOOST_INTERPROCESS_POSIX_SEMAPHORES_NO_UNLINK)
149 #define BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES 167 #define BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES
150 #define BOOST_INTERPROCESS_NAMED_SEMAPHORE_USES_POSIX_SEMAPHORES 168 #define BOOST_INTERPROCESS_NAMED_SEMAPHORE_USES_POSIX_SEMAPHORES
169 #endif
170
171 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
172 #define BOOST_INTERPROCESS_PERFECT_FORWARDING
151 #endif 173 #endif
152 174
153 // Timeout duration use if BOOST_INTERPROCESS_ENABLE_TIMEOUT_WHEN_LOCKING is set 175 // Timeout duration use if BOOST_INTERPROCESS_ENABLE_TIMEOUT_WHEN_LOCKING is set
154 #ifndef BOOST_INTERPROCESS_TIMEOUT_WHEN_LOCKING_DURATION_MS 176 #ifndef BOOST_INTERPROCESS_TIMEOUT_WHEN_LOCKING_DURATION_MS
155 #define BOOST_INTERPROCESS_TIMEOUT_WHEN_LOCKING_DURATION_MS 10000 177 #define BOOST_INTERPROCESS_TIMEOUT_WHEN_LOCKING_DURATION_MS 10000
160 //message queue uses a circular queue as index instead of an array (better performance) 182 //message queue uses a circular queue as index instead of an array (better performance)
161 //Boost version < 1.52 uses an array, so undef this if you want to communicate 183 //Boost version < 1.52 uses an array, so undef this if you want to communicate
162 //with processes compiled with those versions. 184 //with processes compiled with those versions.
163 #define BOOST_INTERPROCESS_MSG_QUEUE_CIRCULAR_INDEX 185 #define BOOST_INTERPROCESS_MSG_QUEUE_CIRCULAR_INDEX
164 186
165 //Inline attributes 187 //Macros for documentation purposes. For code, expands to the argument
166 #if defined(_MSC_VER) 188 #define BOOST_INTERPROCESS_IMPDEF(TYPE) TYPE
167 #define BOOST_INTERPROCESS_ALWAYS_INLINE __forceinline 189 #define BOOST_INTERPROCESS_SEEDOC(TYPE) TYPE
168 #elif defined (__GNUC__)
169 #define BOOST_INTERPROCESS_ALWAYS_INLINE __attribute__((__always_inline__))
170 #else
171 #define BOOST_INTERPROCESS_ALWAYS_INLINE inline
172 #endif
173
174 #if defined(_MSC_VER)
175 #define BOOST_INTERPROCESS_NEVER_INLINE __declspec(noinline)
176 #elif defined (__GNUC__)
177 #define BOOST_INTERPROCESS_NEVER_INLINE __attribute__((__noinline__))
178 #endif
179
180 #if defined(BOOST_NO_CXX11_NOEXCEPT)
181 #if defined(BOOST_MSVC)
182 #define BOOST_INTERPROCESS_NOEXCEPT throw()
183 #else
184 #define BOOST_INTERPROCESS_NOEXCEPT
185 #endif
186 #define BOOST_INTERPROCESS_NOEXCEPT_IF(x)
187 #else
188 #define BOOST_INTERPROCESS_NOEXCEPT noexcept
189 #define BOOST_INTERPROCESS_NOEXCEPT_IF(x) noexcept(x)
190 #endif
191 190
192 #include <boost/interprocess/detail/config_end.hpp> 191 #include <boost/interprocess/detail/config_end.hpp>
193 192
194 #endif //#ifndef BOOST_INTERPROCESS_DETAIL_WORKAROUND_HPP 193 #endif //#ifndef BOOST_INTERPROCESS_DETAIL_WORKAROUND_HPP