3 //==========================================================================
5 * @file config-macros.h
7 * @author Doug Schmidt <d.schmidt@vanderbilt.edu>
8 * @author Jesper S. M|ller<stophph@diku.dk>
9 * @author and a cast of thousands...
11 * This file contains the contents of the old config-lite.h header
12 * without C++ code (except for C++ code in macros). Specifically,
13 * only macros or C language constructs are found in this header.
14 * Allows configuration values and macros to be used by some C
17 //==========================================================================
19 #ifndef ACE_CONFIG_MACROS_H
20 #define ACE_CONFIG_MACROS_H
22 #include "ace/config.h"
23 #include "ace/config-face-safety.h"
25 #include "ace/Version.h"
26 #include "ace/Versioned_Namespace.h"
28 #if defined (ACE_HAS_ALLOC_HOOKS)
32 #if !defined (ACE_HAS_EXCEPTIONS)
33 #define ACE_HAS_EXCEPTIONS
34 #endif /* !ACE_HAS_EXCEPTIONS */
36 // ACE_HAS_TLI is used to decide whether to try any XTI/TLI functionality
37 // so if it isn't set, set it. Capabilities and differences between
38 // XTI and TLI favor XTI, but when deciding to do anything, as opposed to
39 // ACE_NOTSUP_RETURN for example, ACE_HAS_TLI is the deciding factor.
40 #if !defined (ACE_HAS_TLI)
41 # if defined (ACE_HAS_XTI)
43 # endif /* ACE_HAS_XTI */
44 #endif /* ACE_HAS_TLI */
46 #define ACE_BITS_PER_ULONG (8 * sizeof (u_long))
48 #if !defined (ACE_OSTREAM_TYPE)
49 # if defined (ACE_LACKS_IOSTREAM_TOTALLY)
50 # define ACE_OSTREAM_TYPE FILE
51 # else /* ! ACE_LACKS_IOSTREAM_TOTALLY */
52 # define ACE_OSTREAM_TYPE ostream
53 # endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
54 #endif /* ! ACE_OSTREAM_TYPE */
56 #if !defined (ACE_DEFAULT_LOG_STREAM)
57 # if defined (ACE_LACKS_IOSTREAM_TOTALLY)
58 # define ACE_DEFAULT_LOG_STREAM 0
59 # else /* ! ACE_LACKS_IOSTREAM_TOTALLY */
60 # define ACE_DEFAULT_LOG_STREAM (&cerr)
61 # endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
62 #endif /* ! ACE_DEFAULT_LOG_STREAM */
64 // For Win32 compatibility...
65 # if !defined (ACE_WSOCK_VERSION)
66 # define ACE_WSOCK_VERSION 0, 0
67 # endif /* ACE_WSOCK_VERSION */
69 # if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
73 # endif /* ACE_MT_SAFE */
75 # if defined (ACE_HAS_PURIFY)
76 # define ACE_INITIALIZE_MEMORY_BEFORE_USE
77 # endif /* ACE_HAS_PURIFY */
79 # if defined (ACE_HAS_VALGRIND)
80 # define ACE_INITIALIZE_MEMORY_BEFORE_USE
81 # endif /* ACE_HAS_VALGRIND */
83 // =========================================================================
84 // Perfect Multicast filtering refers to RFC 3376, where a socket is only
85 // delivered dgrams for groups joined even if it didn't bind the group
86 // address. We turn this option off by default, although most OS's
87 // except for Windows probably lack perfect filtering.
88 // =========================================================================
90 # if !defined (ACE_LACKS_PERFECT_MULTICAST_FILTERING)
91 # define ACE_LACKS_PERFECT_MULTICAST_FILTERING 0
92 # endif /* ACE_LACKS_PERFECT_MULTICAST_FILTERING */
94 // =========================================================================
95 // Enable/Disable Features By Default
96 // =========================================================================
98 # if !defined (ACE_HAS_POSITION_INDEPENDENT_POINTERS)
99 # define ACE_HAS_POSITION_INDEPENDENT_POINTERS 1
100 # endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS */
102 # if !defined (ACE_HAS_PROCESS_SPAWN)
103 # if !defined (ACE_LACKS_FORK) || \
104 (defined (ACE_WIN32))
105 # define ACE_HAS_PROCESS_SPAWN 1
107 # endif /* ACE_HAS_PROCESS_SPAWN */
109 # if !defined (ACE_HAS_DYNAMIC_LINKING)
110 # if defined (ACE_HAS_SVR4_DYNAMIC_LINKING) || defined (ACE_WIN32) || defined (ACE_VXWORKS)
111 # define ACE_HAS_DYNAMIC_LINKING 1
113 # endif /* ACE_HAS_DYNAMIC_LINKING */
115 # if defined (ACE_HAS_DYNAMIC_LINKING) && ACE_HAS_DYNAMIC_LINKING == 0 && \
116 defined (ACE_HAS_SVR4_DYNAMIC_LINKING)
117 # undef ACE_HAS_SVR4_DYNAMIC_LINKING
118 # endif /* ACE_HAS_DYNAMIC_LINKING == 0 */
120 # if defined (ACE_USES_FIFO_SEM)
121 # if defined (ACE_HAS_POSIX_SEM) || defined (ACE_LACKS_MKFIFO) || defined (ACE_LACKS_FCNTL)
122 # undef ACE_USES_FIFO_SEM
124 # endif /* ACE_USES_FIFO_SEM */
126 # ifndef ACE_LACKS_POSIX_DEVCTL
127 # define ACE_LACKS_POSIX_DEVCTL
130 // =========================================================================
133 // These macros handle all the inlining of code via the .i or .inl files
134 // =========================================================================
136 #if defined (ACE_LACKS_INLINE_FUNCTIONS) && !defined (ACE_NO_INLINE)
137 # define ACE_NO_INLINE
138 #endif /* defined (ACE_LACKS_INLINE_FUNCTIONS) && !defined (ACE_NO_INLINE) */
140 // ACE inlining has been explicitly disabled. Implement
141 // internally within ACE by undefining __ACE_INLINE__.
142 #if defined (ACE_NO_INLINE)
143 # undef __ACE_INLINE__
144 #endif /* ! ACE_NO_INLINE */
146 #if defined (__ACE_INLINE__)
147 # define ACE_INLINE inline
148 # if !defined (ACE_HAS_INLINED_OSCALLS)
149 # define ACE_HAS_INLINED_OSCALLS
150 # endif /* !ACE_HAS_INLINED_OSCALLS */
153 #endif /* __ACE_INLINE__ */
155 // ============================================================================
158 // Since Win32 DLL's do not export all symbols by default, they must be
159 // explicitly exported (which is done by *_Export macros).
160 // ============================================================================
162 // Win32 should have already defined the macros in config-win32-common.h
163 #if !defined (ACE_HAS_CUSTOM_EXPORT_MACROS)
164 # define ACE_Proper_Export_Flag
165 # define ACE_Proper_Import_Flag
166 # define ACE_EXPORT_SINGLETON_DECLARATION(T)
167 # define ACE_IMPORT_SINGLETON_DECLARATION(T)
168 # define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
169 # define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
171 // An export macro should at the very least have been defined.
173 # ifndef ACE_Proper_Import_Flag
174 # define ACE_Proper_Import_Flag
175 # endif /* !ACE_Proper_Import_Flag */
177 # ifndef ACE_EXPORT_SINGLETON_DECLARATION
178 # define ACE_EXPORT_SINGLETON_DECLARATION(T)
179 # endif /* !ACE_EXPORT_SINGLETON_DECLARATION */
181 # ifndef ACE_IMPORT_SINGLETON_DECLARATION
182 # define ACE_IMPORT_SINGLETON_DECLARATION(T)
183 # endif /* !ACE_IMPORT_SINGLETON_DECLARATION */
185 # ifndef ACE_EXPORT_SINGLETON_DECLARE
186 # define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
187 # endif /* !ACE_EXPORT_SINGLETON_DECLARE */
189 # ifndef ACE_IMPORT_SINGLETON_DECLARE
190 # define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
191 # endif /* !ACE_IMPORT_SINGLETON_DECLARE */
193 #endif /* !ACE_HAS_CUSTOM_EXPORT_MACROS */
195 #if defined (ACE_HAS_EXPLICIT_TEMPLATE_CLASS_INSTANTIATION)
196 # define ACE_SINGLETON_TEMPLATE_INSTANTIATION(T) \
198 # define ACE_SINGLETON_TEMPLATE_INSTANTIATE(SINGLETON_TYPE, CLASS, LOCK) \
199 template class SINGLETON_TYPE < CLASS, LOCK >;
200 #elif defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION)
201 # define ACE_SINGLETON_TEMPLATE_INSTANTIATION(T) \
202 template T * T::singleton_;
203 # define ACE_SINGLETON_TEMPLATE_INSTANTIATE(SINGLETON_TYPE, CLASS, LOCK) \
204 template SINGLETON_TYPE < CLASS, LOCK > * SINGLETON_TYPE < CLASS, LOCK >::singleton_;
205 #endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */
207 #if !defined(ACE_SINGLETON_TEMPLATE_INSTANTIATION)
208 # define ACE_SINGLETON_TEMPLATE_INSTANTIATION(T)
210 #if !defined(ACE_SINGLETON_TEMPLATE_INSTANTIATE)
211 # define ACE_SINGLETON_TEMPLATE_INSTANTIATE(SINGLETON_TYPE, CLASS, LOCK)
214 // This is a whim of mine -- that instead of annotating a class with
215 // ACE_Export in its declaration, we make the declaration near the TOP
216 // of the file with ACE_DECLARE_EXPORT.
217 // TS = type specifier (e.g., class, struct, int, etc.)
219 // So, how do you use it? Most of the time, just use ...
220 // ACE_DECLARE_EXPORT(class, someobject);
221 // If there are global functions to be exported, then use ...
222 // ACE_DECLARE_EXPORT(void, globalfunction) (int, ...);
223 // Someday, when template libraries are supported, we made need ...
224 // ACE_DECLARE_EXPORT(template class, sometemplate) <class TYPE, class LOCK>;
225 # define ACE_DECLARE_EXPORT(TS,ID) TS ACE_Export ID
227 // ============================================================================
230 // These macros are used to choose between the old cast style and the new
231 // *_cast<> operators
232 // ============================================================================
234 # define ACE_sap_any_cast(TYPE) reinterpret_cast<TYPE> (const_cast<ACE_Addr &> (ACE_Addr::sap_any))
236 // ============================================================================
237 // Compiler Silencing macros
239 // Some compilers complain about parameters that are not used. This macro
240 // should keep them quiet.
241 // ============================================================================
243 #if !defined (ACE_UNUSED_ARG)
244 # if defined (__GNUC__) || defined (__BORLANDC__)
245 # define ACE_UNUSED_ARG(a) (void) (a)
246 # elif defined (ghs) || defined (__rational__) || defined (__USLC__) || defined (__DCC__) || defined (__PGI)
247 // Some compilers complain about "statement with no effect" with (a).
248 // This eliminates the warnings, and no code is generated for the null
249 // conditional statement. @note that may only be true if -O is enabled,
250 // such as with GreenHills (ghs) 1.8.8.
251 # define ACE_UNUSED_ARG(a) do {/* null */} while (&a == 0)
252 # else /* ghs ..... */
253 # define ACE_UNUSED_ARG(a) (a)
254 # endif /* ghs ..... */
255 #endif /* !ACE_UNUSED_ARG */
257 #if defined (_MSC_VER) || defined (ghs) || defined(__BORLANDC__) || defined (__USLC__) || defined (__DCC__) || defined (__PGI) || defined (__IAR_SYSTEMS_ICC__)
258 # define ACE_NOTREACHED(a)
259 #else /* ghs || ..... */
260 # define ACE_NOTREACHED(a) a
261 #endif /* ghs || ..... */
263 #if !defined ACE_FALLTHROUGH
264 # define ACE_FALLTHROUGH [[fallthrough]]
265 #endif /* ACE_FALLTHROUGH */
267 // ============================================================================
268 // ACE_ALLOC_HOOK* macros
270 // Macros to declare and define class-specific allocation operators.
271 // ============================================================================
273 # if defined (ACE_HAS_ALLOC_HOOKS)
274 # define ACE_ALLOC_HOOK_DECLARE \
275 void *operator new (size_t bytes); \
276 void *operator new (size_t bytes, void *ptr); \
277 void *operator new (size_t bytes, const std::nothrow_t &) noexcept; \
278 void operator delete (void *ptr); \
279 void operator delete (void *ptr, const std::nothrow_t &); \
280 void *operator new[] (size_t size); \
281 void operator delete[] (void *ptr); \
282 void *operator new[] (size_t size, const std::nothrow_t &) noexcept; \
283 void operator delete[] (void *ptr, const std::nothrow_t &)
285 # define ACE_GENERIC_ALLOCS(MAKE_PREFIX, CLASS) \
286 MAKE_PREFIX (void *, CLASS)::operator new (size_t bytes) \
288 void *const ptr = ACE_Allocator::instance ()->malloc (bytes); \
290 throw std::bad_alloc (); \
293 MAKE_PREFIX (void *, CLASS)::operator new (size_t, void *ptr) { return ptr; }\
294 MAKE_PREFIX (void *, CLASS)::operator new (size_t bytes, \
295 const std::nothrow_t &) noexcept \
296 { return ACE_Allocator::instance ()->malloc (bytes); } \
297 MAKE_PREFIX (void, CLASS)::operator delete (void *ptr) \
298 { if (ptr) ACE_Allocator::instance ()->free (ptr); } \
299 MAKE_PREFIX (void, CLASS)::operator delete (void *ptr, \
300 const std::nothrow_t &) \
301 { if (ptr) ACE_Allocator::instance ()->free (ptr); } \
302 MAKE_PREFIX (void *, CLASS)::operator new[] (size_t size) \
304 void *const ptr = ACE_Allocator::instance ()->malloc (size); \
306 throw std::bad_alloc (); \
309 MAKE_PREFIX (void, CLASS)::operator delete[] (void *ptr) \
310 { if (ptr) ACE_Allocator::instance ()->free (ptr); } \
311 MAKE_PREFIX (void *, CLASS)::operator new[] (size_t size, \
312 const std::nothrow_t &) noexcept\
313 { return ACE_Allocator::instance ()->malloc (size); } \
314 MAKE_PREFIX (void, CLASS)::operator delete[] (void *ptr, \
315 const std::nothrow_t &) \
316 { if (ptr) ACE_Allocator::instance ()->free (ptr); }
318 # define ACE_ALLOC_HOOK_HELPER(RET, CLASS) RET CLASS
319 # define ACE_ALLOC_HOOK_DEFINE(CLASS) \
320 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER, CLASS)
322 # define ACE_ALLOC_HOOK_HELPER_Tt(RET, CLASS) \
323 template <typename T1> RET CLASS<T1>
324 # define ACE_ALLOC_HOOK_DEFINE_Tt(CLASS) \
325 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tt, CLASS)
327 # define ACE_ALLOC_HOOK_HELPER_Tc(RET, CLASS) template <class T1> RET CLASS<T1>
328 # define ACE_ALLOC_HOOK_DEFINE_Tc(CLASS) \
329 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tc, CLASS)
331 # define ACE_ALLOC_HOOK_HELPER_Ty(RET, CLASS) \
332 template <ACE_SYNCH_DECL> RET CLASS<ACE_SYNCH_USE>
333 # define ACE_ALLOC_HOOK_DEFINE_Ty(CLASS) \
334 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Ty, CLASS)
336 # define ACE_ALLOC_HOOK_HELPER_Tyc(RET, CLASS) \
337 template <ACE_SYNCH_DECL, class T1> RET CLASS<ACE_SYNCH_USE, T1>
338 # define ACE_ALLOC_HOOK_DEFINE_Tyc(CLASS) \
339 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tyc, CLASS)
341 # define ACE_ALLOC_HOOK_HELPER_Tycc(RET, CLASS) \
342 template <ACE_SYNCH_DECL, class T1, class T2> RET CLASS<ACE_SYNCH_USE, T1, T2>
343 # define ACE_ALLOC_HOOK_DEFINE_Tycc(CLASS) \
344 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tycc, CLASS)
346 # define ACE_ALLOC_HOOK_HELPER_Tcy(RET, CLASS) \
347 template <class T1, ACE_SYNCH_DECL> RET CLASS<T1, ACE_SYNCH_USE>
348 # define ACE_ALLOC_HOOK_DEFINE_Tcy(CLASS) \
349 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tcy, CLASS)
351 # define ACE_ALLOC_HOOK_HELPER_Tcyc(RET, CLASS) \
352 template <class T0, ACE_SYNCH_DECL, class T1> RET CLASS<T0, ACE_SYNCH_USE, T1>
353 # define ACE_ALLOC_HOOK_DEFINE_Tcyc(CLASS) \
354 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tcyc, CLASS)
356 # define ACE_ALLOC_HOOK_HELPER_Tca(RET, CLASS) \
357 template <class T1, ACE_PEER_ACCEPTOR_1> RET CLASS<T1, ACE_PEER_ACCEPTOR_2>
358 # define ACE_ALLOC_HOOK_DEFINE_Tca(CLASS) \
359 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tca, CLASS)
361 # define ACE_ALLOC_HOOK_HELPER_Tco(RET, CLASS) \
362 template <class T1, ACE_PEER_CONNECTOR_1> RET CLASS<T1, ACE_PEER_CONNECTOR_2>
363 # define ACE_ALLOC_HOOK_DEFINE_Tco(CLASS) \
364 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tco, CLASS)
366 # define ACE_ALLOC_HOOK_HELPER_Tcoccc(RET, CLASS) \
367 template <class T1, ACE_PEER_CONNECTOR_1, class T3, class T4, class T5> RET \
368 CLASS<T1, ACE_PEER_CONNECTOR_2, T3, T4, T5>
369 # define ACE_ALLOC_HOOK_DEFINE_Tcoccc(CLASS) \
370 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tcoccc, CLASS)
372 # define ACE_ALLOC_HOOK_HELPER_Tcc(RET, CLASS) \
373 template <class T1, class T2> RET CLASS<T1, T2>
374 # define ACE_ALLOC_HOOK_DEFINE_Tcc(CLASS) \
375 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tcc, CLASS)
377 # define ACE_ALLOC_HOOK_HELPER_Tccc(RET, CLASS) \
378 template <class T1, class T2, class T3> RET CLASS<T1, T2, T3>
379 # define ACE_ALLOC_HOOK_DEFINE_Tccc(CLASS) \
380 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tccc, CLASS)
382 # define ACE_ALLOC_HOOK_HELPER_Tccct(RET, CLASS) \
383 template <class T1, class T2, class T3, typename T4> RET CLASS<T1, T2, T3, T4>
384 # define ACE_ALLOC_HOOK_DEFINE_Tccct(CLASS) \
385 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tccct, CLASS)
387 # define ACE_ALLOC_HOOK_HELPER_Tc4(RET, CLASS) \
388 template <class T1, class T2, class T3, class T4> RET CLASS<T1, T2, T3, T4>
389 # define ACE_ALLOC_HOOK_DEFINE_Tc4(CLASS) \
390 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tc4, CLASS)
392 # define ACE_ALLOC_HOOK_HELPER_Tc5(RET, CLASS) \
393 template <class T1, class T2, class T3, class T4, class T5> RET \
394 CLASS<T1, T2, T3, T4, T5>
395 # define ACE_ALLOC_HOOK_DEFINE_Tc5(CLASS) \
396 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tc5, CLASS)
398 # define ACE_ALLOC_HOOK_HELPER_Tc6(RET, CLASS) \
399 template <class T1, class T2, class T3, class T4, class T5, class T6> RET \
400 CLASS<T1, T2, T3, T4, T5, T6>
401 # define ACE_ALLOC_HOOK_DEFINE_Tc6(CLASS) \
402 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tc6, CLASS)
404 # define ACE_ALLOC_HOOK_HELPER_Tc7(RET, CLASS) \
405 template <class T1, class T2, class T3, class T4, class T5, class T6, \
406 class T7> RET CLASS<T1, T2, T3, T4, T5, T6, T7>
407 # define ACE_ALLOC_HOOK_DEFINE_Tc7(CLASS) \
408 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tc7, CLASS)
410 # define ACE_ALLOC_HOOK_HELPER_Tcs(RET, CLASS) \
411 template <class T1, size_t T2> RET CLASS<T1, T2>
412 # define ACE_ALLOC_HOOK_DEFINE_Tcs(CLASS) \
413 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tcs, CLASS)
415 # define ACE_ALLOC_HOOK_HELPER_Tmcc(RET, CLASS) \
416 template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> RET \
417 CLASS<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>
418 # define ACE_ALLOC_HOOK_DEFINE_Tmcc(CLASS) \
419 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tmcc, CLASS)
422 # define ACE_ALLOC_HOOK_DECLARE struct Ace_ {} /* Just need a dummy... */
423 # define ACE_ALLOC_HOOK_DEFINE(CLASS)
424 # define ACE_ALLOC_HOOK_DEFINE_Tt(CLASS)
425 # define ACE_ALLOC_HOOK_DEFINE_Tc(CLASS)
426 # define ACE_ALLOC_HOOK_DEFINE_Tcc(CLASS)
427 # define ACE_ALLOC_HOOK_DEFINE_Tccc(CLASS)
428 # define ACE_ALLOC_HOOK_DEFINE_Tccct(CLASS)
429 # define ACE_ALLOC_HOOK_DEFINE_Tc4(CLASS)
430 # define ACE_ALLOC_HOOK_DEFINE_Tc5(CLASS)
431 # define ACE_ALLOC_HOOK_DEFINE_Tc6(CLASS)
432 # define ACE_ALLOC_HOOK_DEFINE_Tc7(CLASS)
433 # define ACE_ALLOC_HOOK_DEFINE_Ty(CLASS)
434 # define ACE_ALLOC_HOOK_DEFINE_Tyc(CLASS)
435 # define ACE_ALLOC_HOOK_DEFINE_Tycc(CLASS)
436 # define ACE_ALLOC_HOOK_DEFINE_Tcy(CLASS)
437 # define ACE_ALLOC_HOOK_DEFINE_Tcyc(CLASS)
438 # define ACE_ALLOC_HOOK_DEFINE_Tca(CLASS)
439 # define ACE_ALLOC_HOOK_DEFINE_Tco(CLASS)
440 # define ACE_ALLOC_HOOK_DEFINE_Tcoccc(CLASS)
441 # define ACE_ALLOC_HOOK_DEFINE_Tcs(CLASS)
442 # define ACE_ALLOC_HOOK_DEFINE_Tmcc(CLASS)
443 # endif /* ACE_HAS_ALLOC_HOOKS */
445 // ============================================================================
449 * @deprecated ACE_OSCALL_RETURN and ACE_OSCALL should not be used.
450 * Please restart system calls in your application code.
451 * See the @c sigaction(2) man page for documentation
452 * regarding enabling restartable system calls across
453 * signals via the @c SA_RESTART flag.
455 * The following two macros used ensure that system calls are properly
456 * restarted (if necessary) when interrupts occur. However, that
457 * capability was never enabled by any of our supported platforms.
458 * In fact, some parts of ACE would not function properly when that
459 * ability was enabled. Furthermore, they assumed that ability to
460 * restart system calls was determined statically. That assumption
461 * does not hold for modern platforms, where that ability is
462 * determined dynamically at run-time.
464 // ============================================================================
466 #define ACE_OSCALL_RETURN(X,TYPE) \
470 #define ACE_OSCALL(X,TYPE,RESULT) \
472 RESULT = (TYPE) (X); \
475 #if defined (ACE_WIN32)
476 # define ACE_WIN32CALL_RETURN(X,TYPE,FAILVALUE) \
479 ace_result_ = (TYPE) X; \
480 if (ace_result_ == FAILVALUE) \
481 ACE_OS::set_errno_to_last_error (); \
482 return ace_result_; \
484 # define ACE_WIN32CALL(X,TYPE,FAILVALUE,RESULT) \
487 if (RESULT == FAILVALUE) \
488 ACE_OS::set_errno_to_last_error (); \
490 #endif /* ACE_WIN32 */
492 // The C99 security-improved run-time returns an error value on failure;
494 #if defined (ACE_HAS_TR24731_2005_CRT)
495 # define ACE_SECURECRTCALL(X,TYPE,FAILVALUE,RESULT) \
498 if (___ != 0) { errno = ___; RESULT = FAILVALUE; } \
500 #endif /* ACE_HAS_TR24731_2005_CRT */
502 // ============================================================================
504 // ============================================================================
506 #if defined (ACE_WIN32)
508 typedef HANDLE ACE_HANDLE
;
509 typedef SOCKET ACE_SOCKET
;
510 # define ACE_INVALID_HANDLE INVALID_HANDLE_VALUE
512 #else /* ! ACE_WIN32 */
514 typedef int ACE_HANDLE
;
515 typedef ACE_HANDLE ACE_SOCKET
;
516 # define ACE_INVALID_HANDLE -1
518 #endif /* ACE_WIN32 */
520 // Define the type that's returned from the platform's native thread
521 // functions. ACE_THR_FUNC_RETURN is the type defined as the thread
522 // function's return type, except when the thread function doesn't return
523 // anything (pSoS). The ACE_THR_FUNC_NO_RETURN_VAL macro is used to
524 // indicate that the actual thread function doesn't return anything. The
525 // rest of ACE uses a real type so there's no a ton of conditional code
526 // everywhere to deal with the possibility of no return type.
527 # if defined (ACE_VXWORKS) && !defined (ACE_HAS_PTHREADS)
528 # include /**/ <taskLib.h>
529 typedef int ACE_THR_FUNC_RETURN
;
530 #define ACE_HAS_INTEGRAL_TYPE_THR_FUNC_RETURN
531 # elif defined (ACE_WIN32)
532 typedef DWORD ACE_THR_FUNC_RETURN
;
533 #define ACE_HAS_INTEGRAL_TYPE_THR_FUNC_RETURN
535 typedef void* ACE_THR_FUNC_RETURN
;
536 # endif /* ACE_VXWORKS */
537 typedef ACE_THR_FUNC_RETURN (*ACE_THR_FUNC
)(void *);
541 #endif /* __cplusplus */
542 typedef void (*ACE_THR_C_DEST
)(void *);
545 #endif /* __cplusplus */
546 typedef void (*ACE_THR_DEST
)(void *);
548 // Now some platforms have special requirements...
549 # if defined (ACE_VXWORKS) && !defined (ACE_HAS_PTHREADS)
550 typedef FUNCPTR ACE_THR_FUNC_INTERNAL
; // where typedef int (*FUNCPTR) (...)
552 typedef ACE_THR_FUNC ACE_THR_FUNC_INTERNAL
;
553 # endif /* ACE_VXWORKS */
558 # endif /* __cplusplus */
559 # if defined (ACE_VXWORKS) && !defined (ACE_HAS_PTHREADS)
560 typedef FUNCPTR ACE_THR_C_FUNC
; // where typedef int (*FUNCPTR) (...)
562 typedef ACE_THR_FUNC_RETURN (*ACE_THR_C_FUNC
)(void *);
563 # endif /* ACE_VXWORKS */
566 # endif /* __cplusplus */
568 // ============================================================================
569 // Macros for controlling the lifetimes of dlls loaded by ACE_DLL--including
570 // all dlls loaded via the ACE Service Config framework.
572 // Please don't change these values or add new ones wantonly, since we use
573 // the ACE_BIT_ENABLED, etc..., macros to test them.
574 // ============================================================================
576 // Per-process policy that unloads dlls eagerly.
577 #define ACE_DLL_UNLOAD_POLICY_PER_PROCESS 0
578 // Apply policy on a per-dll basis. If the dll doesn't use one of the macros
579 // below, the current per-process policy will be used.
580 #define ACE_DLL_UNLOAD_POLICY_PER_DLL 1
581 // Don't unload dll when refcount reaches zero, i.e., wait for either an
582 // explicit unload request or program exit.
583 #define ACE_DLL_UNLOAD_POLICY_LAZY 2
584 // Default policy allows dlls to control their own destinies, but will
585 // unload those that don't make a choice eagerly.
586 #define ACE_DLL_UNLOAD_POLICY_DEFAULT ACE_DLL_UNLOAD_POLICY_PER_DLL
588 // Add this macro you one of your cpp file in your dll. X should
589 // be either ACE_DLL_UNLOAD_POLICY_DEFAULT or ACE_DLL_UNLOAD_POLICY_LAZY.
590 #define ACE_DLL_UNLOAD_POLICY(CLS,X) \
591 extern "C" u_long CLS##_Export _get_dll_unload_policy () \
594 // ============================================================================
595 // ACE_USES_CLASSIC_SVC_CONF macro
596 // ============================================================================
598 // For now, default is to use the classic svc.conf format.
599 #if !defined (ACE_USES_CLASSIC_SVC_CONF)
600 # if defined (ACE_HAS_CLASSIC_SVC_CONF) && defined (ACE_HAS_XML_SVC_CONF)
601 # error You can only use either CLASSIC or XML svc.conf, not both.
603 // Change the ACE_HAS_XML_SVC_CONF to ACE_HAS_CLASSIC_SVC_CONF when
604 // we switch ACE to use XML svc.conf as default format.
605 # if defined (ACE_HAS_XML_SVC_CONF)
606 # define ACE_USES_CLASSIC_SVC_CONF 0
608 # define ACE_USES_CLASSIC_SVC_CONF 1
609 # endif /* ACE_HAS_XML_SVC_CONF */
610 #endif /* ACE_USES_CLASSIC_SVC_CONF */
612 // ============================================================================
613 // Default svc.conf file extension.
614 // ============================================================================
615 #if defined (ACE_USES_CLASSIC_SVC_CONF) && (ACE_USES_CLASSIC_SVC_CONF == 1)
616 # define ACE_DEFAULT_SVC_CONF_EXT ".conf"
618 # define ACE_DEFAULT_SVC_CONF_EXT ".conf.xml"
619 #endif /* ACE_USES_CLASSIC_SVC_CONF && ACE_USES_CLASSIC_SVC_CONF == 1 */
621 // ============================================================================
622 // Miscellaneous macros
623 // ============================================================================
625 #if defined (ACE_USES_EXPLICIT_STD_NAMESPACE)
626 # define ACE_STD_NAMESPACE std
628 # define ACE_STD_NAMESPACE
631 #if !defined (ACE_OS_String)
632 # define ACE_OS_String ACE_OS
633 #endif /* ACE_OS_String */
634 #if !defined (ACE_OS_Memory)
635 # define ACE_OS_Memory ACE_OS
636 #endif /* ACE_OS_Memory */
637 #if !defined (ACE_OS_Dirent)
638 # define ACE_OS_Dirent ACE_OS
639 #endif /* ACE_OS_Dirent */
640 #if !defined (ACE_OS_TLI)
641 # define ACE_OS_TLI ACE_OS
642 #endif /* ACE_OS_TLI */
644 // -------------------------------------------------------------------
645 // Preprocessor symbols will not be expanded if they are
646 // concatenated. Force the preprocessor to expand them during the
647 // argument prescan by calling a macro that itself calls another that
648 // performs the actual concatenation.
649 #define ACE_PREPROC_CONCATENATE_IMPL(A,B) A ## B
650 #define ACE_PREPROC_CONCATENATE(A,B) ACE_PREPROC_CONCATENATE_IMPL(A,B)
651 // -------------------------------------------------------------------
653 /// If MPC is using a lib modifier this define will be set and this then
654 /// is used by the service configurator framework
655 #if defined MPC_LIB_MODIFIER && !defined (ACE_LD_DECORATOR_STR)
656 #define ACE_LD_DECORATOR_STR ACE_TEXT( MPC_LIB_MODIFIER )
657 #endif /* MPC_LIB_MODIFIER */
659 #ifndef ACE_GCC_CONSTRUCTOR_ATTRIBUTE
660 # define ACE_GCC_CONSTRUCTOR_ATTRIBUTE
663 #ifndef ACE_GCC_DESTRUCTOR_ATTRIBUTE
664 # define ACE_GCC_DESTRUCTOR_ATTRIBUTE
667 #ifndef ACE_HAS_TEMPLATE_TYPEDEFS
668 #define ACE_HAS_TEMPLATE_TYPEDEFS
671 #ifndef ACE_GCC_FORMAT_ATTRIBUTE
672 # define ACE_GCC_FORMAT_ATTRIBUTE(TYPE, STR_INDEX, FIRST_INDEX)
675 #ifndef ACE_DEPRECATED
676 # define ACE_DEPRECATED [[deprecated]]
679 #ifndef ACE_HAS_REACTOR_NOTIFICATION_QUEUE
680 # define ACE_HAS_REACTOR_NOTIFICATION_QUEUE
683 // If config.h declared a lack of process-shared mutexes but was silent about
684 // process-shared condition variables, ACE must not attempt to use a
685 // process-shared condition variable (which always requires a mutex too).
686 #if defined ACE_LACKS_MUTEXATTR_PSHARED && !defined ACE_LACKS_CONDATTR_PSHARED
687 # define ACE_LACKS_CONDATTR_PSHARED
690 #ifdef ACE_LACKS_CONDATTR_SETCLOCK
691 # ifdef ACE_HAS_CONDATTR_SETCLOCK
692 # undef ACE_HAS_CONDATTR_SETCLOCK
694 # ifdef ACE_HAS_POSIX_MONOTONIC_CONDITIONS
695 # undef ACE_HAS_POSIX_MONOTONIC_CONDITIONS
697 # ifdef ACE_HAS_MONOTONIC_CONDITIONS
698 # undef ACE_HAS_MONOTONIC_CONDITIONS
702 #if defined (ACE_HAS_CLOCK_GETTIME_MONOTONIC) && !defined (ACE_LACKS_CLOCK_MONOTONIC)
703 # ifndef ACE_HAS_MONOTONIC_TIME_POLICY
704 # define ACE_HAS_MONOTONIC_TIME_POLICY
708 #ifndef ACE_GCC_NO_RETURN
709 # define ACE_GCC_NO_RETURN
712 // ACE_OS::readdir_r was removed in ACE7
713 #ifndef ACE_LACKS_READDIR_R
714 # define ACE_LACKS_READDIR_R
717 #endif /* ACE_CONFIG_MACROS_H */