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 || ..... */
264 // Compiler-specific configs can define ACE_FALLTHROUGH but if not,
265 // and it's a C++17 or higher compiler, use the defined mechanism.
266 #if !defined ACE_FALLTHROUGH
267 # if defined ACE_HAS_CPP17
268 # define ACE_FALLTHROUGH [[fallthrough]]
270 # define ACE_FALLTHROUGH
271 # endif /* ACE_HAS_CPP17 */
272 #endif /* ACE_FALLTHROUGH */
274 // ============================================================================
275 // ACE_ALLOC_HOOK* macros
277 // Macros to declare and define class-specific allocation operators.
278 // ============================================================================
280 # if defined (ACE_HAS_ALLOC_HOOKS)
281 # define ACE_ALLOC_HOOK_DECLARE \
282 void *operator new (size_t bytes); \
283 void *operator new (size_t bytes, void *ptr); \
284 void *operator new (size_t bytes, const std::nothrow_t &) noexcept; \
285 void operator delete (void *ptr); \
286 void operator delete (void *ptr, const std::nothrow_t &); \
287 void *operator new[] (size_t size); \
288 void operator delete[] (void *ptr); \
289 void *operator new[] (size_t size, const std::nothrow_t &) noexcept; \
290 void operator delete[] (void *ptr, const std::nothrow_t &)
292 # define ACE_GENERIC_ALLOCS(MAKE_PREFIX, CLASS) \
293 MAKE_PREFIX (void *, CLASS)::operator new (size_t bytes) \
295 void *const ptr = ACE_Allocator::instance ()->malloc (bytes); \
297 throw std::bad_alloc (); \
300 MAKE_PREFIX (void *, CLASS)::operator new (size_t, void *ptr) { return ptr; }\
301 MAKE_PREFIX (void *, CLASS)::operator new (size_t bytes, \
302 const std::nothrow_t &) noexcept \
303 { return ACE_Allocator::instance ()->malloc (bytes); } \
304 MAKE_PREFIX (void, CLASS)::operator delete (void *ptr) \
305 { if (ptr) ACE_Allocator::instance ()->free (ptr); } \
306 MAKE_PREFIX (void, CLASS)::operator delete (void *ptr, \
307 const std::nothrow_t &) \
308 { if (ptr) ACE_Allocator::instance ()->free (ptr); } \
309 MAKE_PREFIX (void *, CLASS)::operator new[] (size_t size) \
311 void *const ptr = ACE_Allocator::instance ()->malloc (size); \
313 throw std::bad_alloc (); \
316 MAKE_PREFIX (void, CLASS)::operator delete[] (void *ptr) \
317 { if (ptr) ACE_Allocator::instance ()->free (ptr); } \
318 MAKE_PREFIX (void *, CLASS)::operator new[] (size_t size, \
319 const std::nothrow_t &) noexcept\
320 { return ACE_Allocator::instance ()->malloc (size); } \
321 MAKE_PREFIX (void, CLASS)::operator delete[] (void *ptr, \
322 const std::nothrow_t &) \
323 { if (ptr) ACE_Allocator::instance ()->free (ptr); }
325 # define ACE_ALLOC_HOOK_HELPER(RET, CLASS) RET CLASS
326 # define ACE_ALLOC_HOOK_DEFINE(CLASS) \
327 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER, CLASS)
329 # define ACE_ALLOC_HOOK_HELPER_Tt(RET, CLASS) \
330 template <typename T1> RET CLASS<T1>
331 # define ACE_ALLOC_HOOK_DEFINE_Tt(CLASS) \
332 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tt, CLASS)
334 # define ACE_ALLOC_HOOK_HELPER_Tc(RET, CLASS) template <class T1> RET CLASS<T1>
335 # define ACE_ALLOC_HOOK_DEFINE_Tc(CLASS) \
336 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tc, CLASS)
338 # define ACE_ALLOC_HOOK_HELPER_Ty(RET, CLASS) \
339 template <ACE_SYNCH_DECL> RET CLASS<ACE_SYNCH_USE>
340 # define ACE_ALLOC_HOOK_DEFINE_Ty(CLASS) \
341 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Ty, CLASS)
343 # define ACE_ALLOC_HOOK_HELPER_Tyc(RET, CLASS) \
344 template <ACE_SYNCH_DECL, class T1> RET CLASS<ACE_SYNCH_USE, T1>
345 # define ACE_ALLOC_HOOK_DEFINE_Tyc(CLASS) \
346 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tyc, CLASS)
348 # define ACE_ALLOC_HOOK_HELPER_Tycc(RET, CLASS) \
349 template <ACE_SYNCH_DECL, class T1, class T2> RET CLASS<ACE_SYNCH_USE, T1, T2>
350 # define ACE_ALLOC_HOOK_DEFINE_Tycc(CLASS) \
351 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tycc, CLASS)
353 # define ACE_ALLOC_HOOK_HELPER_Tcy(RET, CLASS) \
354 template <class T1, ACE_SYNCH_DECL> RET CLASS<T1, ACE_SYNCH_USE>
355 # define ACE_ALLOC_HOOK_DEFINE_Tcy(CLASS) \
356 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tcy, CLASS)
358 # define ACE_ALLOC_HOOK_HELPER_Tcyc(RET, CLASS) \
359 template <class T0, ACE_SYNCH_DECL, class T1> RET CLASS<T0, ACE_SYNCH_USE, T1>
360 # define ACE_ALLOC_HOOK_DEFINE_Tcyc(CLASS) \
361 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tcyc, CLASS)
363 # define ACE_ALLOC_HOOK_HELPER_Tca(RET, CLASS) \
364 template <class T1, ACE_PEER_ACCEPTOR_1> RET CLASS<T1, ACE_PEER_ACCEPTOR_2>
365 # define ACE_ALLOC_HOOK_DEFINE_Tca(CLASS) \
366 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tca, CLASS)
368 # define ACE_ALLOC_HOOK_HELPER_Tco(RET, CLASS) \
369 template <class T1, ACE_PEER_CONNECTOR_1> RET CLASS<T1, ACE_PEER_CONNECTOR_2>
370 # define ACE_ALLOC_HOOK_DEFINE_Tco(CLASS) \
371 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tco, CLASS)
373 # define ACE_ALLOC_HOOK_HELPER_Tcoccc(RET, CLASS) \
374 template <class T1, ACE_PEER_CONNECTOR_1, class T3, class T4, class T5> RET \
375 CLASS<T1, ACE_PEER_CONNECTOR_2, T3, T4, T5>
376 # define ACE_ALLOC_HOOK_DEFINE_Tcoccc(CLASS) \
377 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tcoccc, CLASS)
379 # define ACE_ALLOC_HOOK_HELPER_Tcc(RET, CLASS) \
380 template <class T1, class T2> RET CLASS<T1, T2>
381 # define ACE_ALLOC_HOOK_DEFINE_Tcc(CLASS) \
382 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tcc, CLASS)
384 # define ACE_ALLOC_HOOK_HELPER_Tccc(RET, CLASS) \
385 template <class T1, class T2, class T3> RET CLASS<T1, T2, T3>
386 # define ACE_ALLOC_HOOK_DEFINE_Tccc(CLASS) \
387 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tccc, CLASS)
389 # define ACE_ALLOC_HOOK_HELPER_Tccct(RET, CLASS) \
390 template <class T1, class T2, class T3, typename T4> RET CLASS<T1, T2, T3, T4>
391 # define ACE_ALLOC_HOOK_DEFINE_Tccct(CLASS) \
392 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tccct, CLASS)
394 # define ACE_ALLOC_HOOK_HELPER_Tc4(RET, CLASS) \
395 template <class T1, class T2, class T3, class T4> RET CLASS<T1, T2, T3, T4>
396 # define ACE_ALLOC_HOOK_DEFINE_Tc4(CLASS) \
397 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tc4, CLASS)
399 # define ACE_ALLOC_HOOK_HELPER_Tc5(RET, CLASS) \
400 template <class T1, class T2, class T3, class T4, class T5> RET \
401 CLASS<T1, T2, T3, T4, T5>
402 # define ACE_ALLOC_HOOK_DEFINE_Tc5(CLASS) \
403 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tc5, CLASS)
405 # define ACE_ALLOC_HOOK_HELPER_Tc6(RET, CLASS) \
406 template <class T1, class T2, class T3, class T4, class T5, class T6> RET \
407 CLASS<T1, T2, T3, T4, T5, T6>
408 # define ACE_ALLOC_HOOK_DEFINE_Tc6(CLASS) \
409 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tc6, CLASS)
411 # define ACE_ALLOC_HOOK_HELPER_Tc7(RET, CLASS) \
412 template <class T1, class T2, class T3, class T4, class T5, class T6, \
413 class T7> RET CLASS<T1, T2, T3, T4, T5, T6, T7>
414 # define ACE_ALLOC_HOOK_DEFINE_Tc7(CLASS) \
415 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tc7, CLASS)
417 # define ACE_ALLOC_HOOK_HELPER_Tcs(RET, CLASS) \
418 template <class T1, size_t T2> RET CLASS<T1, T2>
419 # define ACE_ALLOC_HOOK_DEFINE_Tcs(CLASS) \
420 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tcs, CLASS)
422 # define ACE_ALLOC_HOOK_HELPER_Tmcc(RET, CLASS) \
423 template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> RET \
424 CLASS<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>
425 # define ACE_ALLOC_HOOK_DEFINE_Tmcc(CLASS) \
426 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tmcc, CLASS)
429 # define ACE_ALLOC_HOOK_DECLARE struct Ace_ {} /* Just need a dummy... */
430 # define ACE_ALLOC_HOOK_DEFINE(CLASS)
431 # define ACE_ALLOC_HOOK_DEFINE_Tt(CLASS)
432 # define ACE_ALLOC_HOOK_DEFINE_Tc(CLASS)
433 # define ACE_ALLOC_HOOK_DEFINE_Tcc(CLASS)
434 # define ACE_ALLOC_HOOK_DEFINE_Tccc(CLASS)
435 # define ACE_ALLOC_HOOK_DEFINE_Tccct(CLASS)
436 # define ACE_ALLOC_HOOK_DEFINE_Tc4(CLASS)
437 # define ACE_ALLOC_HOOK_DEFINE_Tc5(CLASS)
438 # define ACE_ALLOC_HOOK_DEFINE_Tc6(CLASS)
439 # define ACE_ALLOC_HOOK_DEFINE_Tc7(CLASS)
440 # define ACE_ALLOC_HOOK_DEFINE_Ty(CLASS)
441 # define ACE_ALLOC_HOOK_DEFINE_Tyc(CLASS)
442 # define ACE_ALLOC_HOOK_DEFINE_Tycc(CLASS)
443 # define ACE_ALLOC_HOOK_DEFINE_Tcy(CLASS)
444 # define ACE_ALLOC_HOOK_DEFINE_Tcyc(CLASS)
445 # define ACE_ALLOC_HOOK_DEFINE_Tca(CLASS)
446 # define ACE_ALLOC_HOOK_DEFINE_Tco(CLASS)
447 # define ACE_ALLOC_HOOK_DEFINE_Tcoccc(CLASS)
448 # define ACE_ALLOC_HOOK_DEFINE_Tcs(CLASS)
449 # define ACE_ALLOC_HOOK_DEFINE_Tmcc(CLASS)
450 # endif /* ACE_HAS_ALLOC_HOOKS */
452 // ============================================================================
456 * @deprecated ACE_OSCALL_RETURN and ACE_OSCALL should not be used.
457 * Please restart system calls in your application code.
458 * See the @c sigaction(2) man page for documentation
459 * regarding enabling restartable system calls across
460 * signals via the @c SA_RESTART flag.
462 * The following two macros used ensure that system calls are properly
463 * restarted (if necessary) when interrupts occur. However, that
464 * capability was never enabled by any of our supported platforms.
465 * In fact, some parts of ACE would not function properly when that
466 * ability was enabled. Furthermore, they assumed that ability to
467 * restart system calls was determined statically. That assumption
468 * does not hold for modern platforms, where that ability is
469 * determined dynamically at run-time.
471 // ============================================================================
473 #define ACE_OSCALL_RETURN(X,TYPE) \
477 #define ACE_OSCALL(X,TYPE,RESULT) \
479 RESULT = (TYPE) (X); \
482 #if defined (ACE_WIN32)
483 # define ACE_WIN32CALL_RETURN(X,TYPE,FAILVALUE) \
486 ace_result_ = (TYPE) X; \
487 if (ace_result_ == FAILVALUE) \
488 ACE_OS::set_errno_to_last_error (); \
489 return ace_result_; \
491 # define ACE_WIN32CALL(X,TYPE,FAILVALUE,RESULT) \
494 if (RESULT == FAILVALUE) \
495 ACE_OS::set_errno_to_last_error (); \
497 #endif /* ACE_WIN32 */
499 // The C99 security-improved run-time returns an error value on failure;
501 #if defined (ACE_HAS_TR24731_2005_CRT)
502 # define ACE_SECURECRTCALL(X,TYPE,FAILVALUE,RESULT) \
505 if (___ != 0) { errno = ___; RESULT = FAILVALUE; } \
507 #endif /* ACE_HAS_TR24731_2005_CRT */
509 // ============================================================================
511 // ============================================================================
513 #if defined (ACE_WIN32)
515 typedef HANDLE ACE_HANDLE
;
516 typedef SOCKET ACE_SOCKET
;
517 # define ACE_INVALID_HANDLE INVALID_HANDLE_VALUE
519 #else /* ! ACE_WIN32 */
521 typedef int ACE_HANDLE
;
522 typedef ACE_HANDLE ACE_SOCKET
;
523 # define ACE_INVALID_HANDLE -1
525 #endif /* ACE_WIN32 */
527 // Define the type that's returned from the platform's native thread
528 // functions. ACE_THR_FUNC_RETURN is the type defined as the thread
529 // function's return type, except when the thread function doesn't return
530 // anything (pSoS). The ACE_THR_FUNC_NO_RETURN_VAL macro is used to
531 // indicate that the actual thread function doesn't return anything. The
532 // rest of ACE uses a real type so there's no a ton of conditional code
533 // everywhere to deal with the possibility of no return type.
534 # if defined (ACE_VXWORKS) && !defined (ACE_HAS_PTHREADS)
535 # include /**/ <taskLib.h>
536 typedef int ACE_THR_FUNC_RETURN
;
537 #define ACE_HAS_INTEGRAL_TYPE_THR_FUNC_RETURN
538 # elif defined (ACE_WIN32)
539 typedef DWORD ACE_THR_FUNC_RETURN
;
540 #define ACE_HAS_INTEGRAL_TYPE_THR_FUNC_RETURN
542 typedef void* ACE_THR_FUNC_RETURN
;
543 # endif /* ACE_VXWORKS */
544 typedef ACE_THR_FUNC_RETURN (*ACE_THR_FUNC
)(void *);
548 #endif /* __cplusplus */
549 typedef void (*ACE_THR_C_DEST
)(void *);
552 #endif /* __cplusplus */
553 typedef void (*ACE_THR_DEST
)(void *);
555 // Now some platforms have special requirements...
556 # if defined (ACE_VXWORKS) && !defined (ACE_HAS_PTHREADS)
557 typedef FUNCPTR ACE_THR_FUNC_INTERNAL
; // where typedef int (*FUNCPTR) (...)
559 typedef ACE_THR_FUNC ACE_THR_FUNC_INTERNAL
;
560 # endif /* ACE_VXWORKS */
565 # endif /* __cplusplus */
566 # if defined (ACE_VXWORKS) && !defined (ACE_HAS_PTHREADS)
567 typedef FUNCPTR ACE_THR_C_FUNC
; // where typedef int (*FUNCPTR) (...)
569 typedef ACE_THR_FUNC_RETURN (*ACE_THR_C_FUNC
)(void *);
570 # endif /* ACE_VXWORKS */
573 # endif /* __cplusplus */
575 // ============================================================================
576 // Macros for controlling the lifetimes of dlls loaded by ACE_DLL--including
577 // all dlls loaded via the ACE Service Config framework.
579 // Please don't change these values or add new ones wantonly, since we use
580 // the ACE_BIT_ENABLED, etc..., macros to test them.
581 // ============================================================================
583 // Per-process policy that unloads dlls eagerly.
584 #define ACE_DLL_UNLOAD_POLICY_PER_PROCESS 0
585 // Apply policy on a per-dll basis. If the dll doesn't use one of the macros
586 // below, the current per-process policy will be used.
587 #define ACE_DLL_UNLOAD_POLICY_PER_DLL 1
588 // Don't unload dll when refcount reaches zero, i.e., wait for either an
589 // explicit unload request or program exit.
590 #define ACE_DLL_UNLOAD_POLICY_LAZY 2
591 // Default policy allows dlls to control their own destinies, but will
592 // unload those that don't make a choice eagerly.
593 #define ACE_DLL_UNLOAD_POLICY_DEFAULT ACE_DLL_UNLOAD_POLICY_PER_DLL
595 // Add this macro you one of your cpp file in your dll. X should
596 // be either ACE_DLL_UNLOAD_POLICY_DEFAULT or ACE_DLL_UNLOAD_POLICY_LAZY.
597 #define ACE_DLL_UNLOAD_POLICY(CLS,X) \
598 extern "C" u_long CLS##_Export _get_dll_unload_policy () \
601 // ============================================================================
602 // ACE_USES_CLASSIC_SVC_CONF macro
603 // ============================================================================
605 // For now, default is to use the classic svc.conf format.
606 #if !defined (ACE_USES_CLASSIC_SVC_CONF)
607 # if defined (ACE_HAS_CLASSIC_SVC_CONF) && defined (ACE_HAS_XML_SVC_CONF)
608 # error You can only use either CLASSIC or XML svc.conf, not both.
610 // Change the ACE_HAS_XML_SVC_CONF to ACE_HAS_CLASSIC_SVC_CONF when
611 // we switch ACE to use XML svc.conf as default format.
612 # if defined (ACE_HAS_XML_SVC_CONF)
613 # define ACE_USES_CLASSIC_SVC_CONF 0
615 # define ACE_USES_CLASSIC_SVC_CONF 1
616 # endif /* ACE_HAS_XML_SVC_CONF */
617 #endif /* ACE_USES_CLASSIC_SVC_CONF */
619 // ============================================================================
620 // Default svc.conf file extension.
621 // ============================================================================
622 #if defined (ACE_USES_CLASSIC_SVC_CONF) && (ACE_USES_CLASSIC_SVC_CONF == 1)
623 # define ACE_DEFAULT_SVC_CONF_EXT ".conf"
625 # define ACE_DEFAULT_SVC_CONF_EXT ".conf.xml"
626 #endif /* ACE_USES_CLASSIC_SVC_CONF && ACE_USES_CLASSIC_SVC_CONF == 1 */
628 // ============================================================================
629 // Miscellaneous macros
630 // ============================================================================
632 #if defined (ACE_USES_EXPLICIT_STD_NAMESPACE)
633 # define ACE_STD_NAMESPACE std
635 # define ACE_STD_NAMESPACE
638 #if !defined (ACE_OS_String)
639 # define ACE_OS_String ACE_OS
640 #endif /* ACE_OS_String */
641 #if !defined (ACE_OS_Memory)
642 # define ACE_OS_Memory ACE_OS
643 #endif /* ACE_OS_Memory */
644 #if !defined (ACE_OS_Dirent)
645 # define ACE_OS_Dirent ACE_OS
646 #endif /* ACE_OS_Dirent */
647 #if !defined (ACE_OS_TLI)
648 # define ACE_OS_TLI ACE_OS
649 #endif /* ACE_OS_TLI */
651 // -------------------------------------------------------------------
652 // Preprocessor symbols will not be expanded if they are
653 // concatenated. Force the preprocessor to expand them during the
654 // argument prescan by calling a macro that itself calls another that
655 // performs the actual concatenation.
656 #define ACE_PREPROC_CONCATENATE_IMPL(A,B) A ## B
657 #define ACE_PREPROC_CONCATENATE(A,B) ACE_PREPROC_CONCATENATE_IMPL(A,B)
658 // -------------------------------------------------------------------
660 /// If MPC is using a lib modifier this define will be set and this then
661 /// is used by the service configurator framework
662 #if defined MPC_LIB_MODIFIER && !defined (ACE_LD_DECORATOR_STR)
663 #define ACE_LD_DECORATOR_STR ACE_TEXT( MPC_LIB_MODIFIER )
664 #endif /* MPC_LIB_MODIFIER */
666 #ifndef ACE_GCC_CONSTRUCTOR_ATTRIBUTE
667 # define ACE_GCC_CONSTRUCTOR_ATTRIBUTE
670 #ifndef ACE_GCC_DESTRUCTOR_ATTRIBUTE
671 # define ACE_GCC_DESTRUCTOR_ATTRIBUTE
674 #ifndef ACE_HAS_TEMPLATE_TYPEDEFS
675 #define ACE_HAS_TEMPLATE_TYPEDEFS
678 #ifndef ACE_GCC_FORMAT_ATTRIBUTE
679 # define ACE_GCC_FORMAT_ATTRIBUTE(TYPE, STR_INDEX, FIRST_INDEX)
682 #ifndef ACE_DEPRECATED
683 # define ACE_DEPRECATED
686 #ifndef ACE_HAS_REACTOR_NOTIFICATION_QUEUE
687 # define ACE_HAS_REACTOR_NOTIFICATION_QUEUE
690 // If config.h declared a lack of process-shared mutexes but was silent about
691 // process-shared condition variables, ACE must not attempt to use a
692 // process-shared condition variable (which always requires a mutex too).
693 #if defined ACE_LACKS_MUTEXATTR_PSHARED && !defined ACE_LACKS_CONDATTR_PSHARED
694 # define ACE_LACKS_CONDATTR_PSHARED
697 #ifdef ACE_LACKS_CONDATTR_SETCLOCK
698 # ifdef ACE_HAS_CONDATTR_SETCLOCK
699 # undef ACE_HAS_CONDATTR_SETCLOCK
701 # ifdef ACE_HAS_POSIX_MONOTONIC_CONDITIONS
702 # undef ACE_HAS_POSIX_MONOTONIC_CONDITIONS
704 # ifdef ACE_HAS_MONOTONIC_CONDITIONS
705 # undef ACE_HAS_MONOTONIC_CONDITIONS
709 #if defined (ACE_HAS_CLOCK_GETTIME_MONOTONIC) && !defined (ACE_LACKS_CLOCK_MONOTONIC)
710 # ifndef ACE_HAS_MONOTONIC_TIME_POLICY
711 # define ACE_HAS_MONOTONIC_TIME_POLICY
715 #ifndef ACE_GCC_NO_RETURN
716 # define ACE_GCC_NO_RETURN
719 // ACE_OS::readdir_r was removed in ACE7
720 #ifndef ACE_LACKS_READDIR_R
721 # define ACE_LACKS_READDIR_R
724 #endif /* ACE_CONFIG_MACROS_H */