3 //==========================================================================
5 * @file config-macros.h
7 * @author (Originally in OS.h)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 filting 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 and Solaris 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) && !defined (ACE_HAS_PHARLAP)) || \
105 defined (ACE_WINCE) || defined (ACE_OPENVMS)
106 # define ACE_HAS_PROCESS_SPAWN 1
108 # endif /* ACE_HAS_PROCESS_SPAWN */
110 # if !defined (ACE_HAS_DYNAMIC_LINKING)
111 # if defined (ACE_HAS_SVR4_DYNAMIC_LINKING) || defined (ACE_WIN32) || defined (ACE_VXWORKS) || defined (__hpux)
112 # define ACE_HAS_DYNAMIC_LINKING 1
114 # endif /* ACE_HAS_DYNAMIC_LINKING */
116 # if defined (ACE_HAS_DYNAMIC_LINKING) && ACE_HAS_DYNAMIC_LINKING == 0 && \
117 defined (ACE_HAS_SVR4_DYNAMIC_LINKING)
118 # undef ACE_HAS_SVR4_DYNAMIC_LINKING
119 # endif /* ACE_HAS_DYNAMIC_LINKING == 0 */
121 # if defined (ACE_USES_FIFO_SEM)
122 # if defined (ACE_HAS_POSIX_SEM) || defined (ACE_LACKS_MKFIFO) || defined (ACE_LACKS_FCNTL)
123 # undef ACE_USES_FIFO_SEM
125 # endif /* ACE_USES_FIFO_SEM */
127 # ifndef ACE_LACKS_POSIX_DEVCTL
128 # define ACE_LACKS_POSIX_DEVCTL
131 // =========================================================================
134 // These macros handle all the inlining of code via the .i or .inl files
135 // =========================================================================
137 #if defined (ACE_LACKS_INLINE_FUNCTIONS) && !defined (ACE_NO_INLINE)
138 # define ACE_NO_INLINE
139 #endif /* defined (ACE_LACKS_INLINE_FUNCTIONS) && !defined (ACE_NO_INLINE) */
141 // ACE inlining has been explicitly disabled. Implement
142 // internally within ACE by undefining __ACE_INLINE__.
143 #if defined (ACE_NO_INLINE)
144 # undef __ACE_INLINE__
145 #endif /* ! ACE_NO_INLINE */
147 #if defined (__ACE_INLINE__)
148 # define ACE_INLINE inline
149 # if !defined (ACE_HAS_INLINED_OSCALLS)
150 # define ACE_HAS_INLINED_OSCALLS
151 # endif /* !ACE_HAS_INLINED_OSCALLS */
154 #endif /* __ACE_INLINE__ */
156 // ============================================================================
159 // Since Win32 DLL's do not export all symbols by default, they must be
160 // explicitly exported (which is done by *_Export macros).
161 // ============================================================================
163 // Win32 should have already defined the macros in config-win32-common.h
164 #if !defined (ACE_HAS_CUSTOM_EXPORT_MACROS)
165 # define ACE_Proper_Export_Flag
166 # define ACE_Proper_Import_Flag
167 # define ACE_EXPORT_SINGLETON_DECLARATION(T)
168 # define ACE_IMPORT_SINGLETON_DECLARATION(T)
169 # define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
170 # define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
172 // An export macro should at the very least have been defined.
174 # ifndef ACE_Proper_Import_Flag
175 # define ACE_Proper_Import_Flag
176 # endif /* !ACE_Proper_Import_Flag */
178 # ifndef ACE_EXPORT_SINGLETON_DECLARATION
179 # define ACE_EXPORT_SINGLETON_DECLARATION(T)
180 # endif /* !ACE_EXPORT_SINGLETON_DECLARATION */
182 # ifndef ACE_IMPORT_SINGLETON_DECLARATION
183 # define ACE_IMPORT_SINGLETON_DECLARATION(T)
184 # endif /* !ACE_IMPORT_SINGLETON_DECLARATION */
186 # ifndef ACE_EXPORT_SINGLETON_DECLARE
187 # define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
188 # endif /* !ACE_EXPORT_SINGLETON_DECLARE */
190 # ifndef ACE_IMPORT_SINGLETON_DECLARE
191 # define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
192 # endif /* !ACE_IMPORT_SINGLETON_DECLARE */
194 #endif /* !ACE_HAS_CUSTOM_EXPORT_MACROS */
196 #if defined (ACE_HAS_EXPLICIT_TEMPLATE_CLASS_INSTANTIATION)
197 # define ACE_SINGLETON_TEMPLATE_INSTANTIATION(T) \
199 # define ACE_SINGLETON_TEMPLATE_INSTANTIATE(SINGLETON_TYPE, CLASS, LOCK) \
200 template class SINGLETON_TYPE < CLASS, LOCK >;
201 #elif defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION)
202 # define ACE_SINGLETON_TEMPLATE_INSTANTIATION(T) \
203 template T * T::singleton_;
204 # define ACE_SINGLETON_TEMPLATE_INSTANTIATE(SINGLETON_TYPE, CLASS, LOCK) \
205 template SINGLETON_TYPE < CLASS, LOCK > * SINGLETON_TYPE < CLASS, LOCK >::singleton_;
206 #endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */
208 #if !defined(ACE_SINGLETON_TEMPLATE_INSTANTIATION)
209 # define ACE_SINGLETON_TEMPLATE_INSTANTIATION(T)
211 #if !defined(ACE_SINGLETON_TEMPLATE_INSTANTIATE)
212 # define ACE_SINGLETON_TEMPLATE_INSTANTIATE(SINGLETON_TYPE, CLASS, LOCK)
215 // This is a whim of mine -- that instead of annotating a class with
216 // ACE_Export in its declaration, we make the declaration near the TOP
217 // of the file with ACE_DECLARE_EXPORT.
218 // TS = type specifier (e.g., class, struct, int, etc.)
220 // So, how do you use it? Most of the time, just use ...
221 // ACE_DECLARE_EXPORT(class, someobject);
222 // If there are global functions to be exported, then use ...
223 // ACE_DECLARE_EXPORT(void, globalfunction) (int, ...);
224 // Someday, when template libraries are supported, we made need ...
225 // ACE_DECLARE_EXPORT(template class, sometemplate) <class TYPE, class LOCK>;
226 # define ACE_DECLARE_EXPORT(TS,ID) TS ACE_Export ID
228 // ============================================================================
231 // These macros are used to choose between the old cast style and the new
232 // *_cast<> operators
233 // ============================================================================
235 # define ACE_sap_any_cast(TYPE) reinterpret_cast<TYPE> (const_cast<ACE_Addr &> (ACE_Addr::sap_any))
237 # if !defined (ACE_CAST_CONST)
238 // Sun CC 4.2, for example, requires const in reinterpret casts of
239 // data members in const member functions. But, other compilers
240 // complain about the useless const. This keeps everyone happy.
241 # if defined (__SUNPRO_CC)
242 # define ACE_CAST_CONST const
243 # else /* ! __SUNPRO_CC */
244 # define ACE_CAST_CONST
245 # endif /* ! __SUNPRO_CC */
246 # endif /* ! ACE_CAST_CONST */
248 // ============================================================================
249 // Compiler Silencing macros
251 // Some compilers complain about parameters that are not used. This macro
252 // should keep them quiet.
253 // ============================================================================
255 #if !defined (ACE_UNUSED_ARG)
256 # if defined (__GNUC__) || (defined (__BORLANDC__) && defined (__clang__))
257 # define ACE_UNUSED_ARG(a) (void) (a)
258 # elif defined (ghs) || defined (__hpux) || defined (__DECCXX) || defined (__rational__) || defined (__USLC__) || defined (ACE_RM544) || defined (__DCC__) || defined (__PGI)
259 // Some compilers complain about "statement with no effect" with (a).
260 // This eliminates the warnings, and no code is generated for the null
261 // conditional statement. @note that may only be true if -O is enabled,
262 // such as with GreenHills (ghs) 1.8.8.
263 # define ACE_UNUSED_ARG(a) do {/* null */} while (&a == 0)
264 # elif defined (__DMC__)
265 #define ACE_UNUSED_ID(identifier)
267 inline void ACE_UNUSED_ARG(const T
& ACE_UNUSED_ID(t
)) { }
268 # else /* ghs ..... */
269 # define ACE_UNUSED_ARG(a) (a)
270 # endif /* ghs ..... */
271 #endif /* !ACE_UNUSED_ARG */
273 #if defined (_MSC_VER) || defined (ghs) || defined (__DECCXX) || defined(__BORLANDC__) || defined (ACE_RM544) || defined (__USLC__) || defined (__DCC__) || defined (__PGI) || (defined (__HP_aCC) && (__HP_aCC < 39000 || __HP_aCC >= 60500)) || defined (__IAR_SYSTEMS_ICC__)
274 # define ACE_NOTREACHED(a)
275 #else /* ghs || ..... */
276 # define ACE_NOTREACHED(a) a
277 #endif /* ghs || ..... */
279 // ============================================================================
280 // ACE_ALLOC_HOOK* macros
282 // Macros to declare and define class-specific allocation operators.
283 // ============================================================================
285 # if defined (ACE_HAS_ALLOC_HOOKS)
286 # define ACE_ALLOC_HOOK_DECLARE \
287 void *operator new (size_t bytes); \
288 void *operator new (size_t bytes, void *ptr); \
289 void *operator new (size_t bytes, const std::nothrow_t &) throw (); \
290 void operator delete (void *ptr); \
291 void operator delete (void *ptr, const std::nothrow_t &); \
292 void *operator new[] (size_t size); \
293 void operator delete[] (void *ptr); \
294 void *operator new[] (size_t size, const std::nothrow_t &) throw (); \
295 void operator delete[] (void *ptr, const std::nothrow_t &)
297 # define ACE_GENERIC_ALLOCS(MAKE_PREFIX, CLASS) \
298 MAKE_PREFIX (void *, CLASS)::operator new (size_t bytes) \
300 void *const ptr = ACE_Allocator::instance ()->malloc (bytes); \
302 throw std::bad_alloc (); \
305 MAKE_PREFIX (void *, CLASS)::operator new (size_t, void *ptr) { return ptr; }\
306 MAKE_PREFIX (void *, CLASS)::operator new (size_t bytes, \
307 const std::nothrow_t &) throw () \
308 { return ACE_Allocator::instance ()->malloc (bytes); } \
309 MAKE_PREFIX (void, CLASS)::operator delete (void *ptr) \
310 { if (ptr) ACE_Allocator::instance ()->free (ptr); } \
311 MAKE_PREFIX (void, CLASS)::operator delete (void *ptr, \
312 const std::nothrow_t &) \
313 { if (ptr) ACE_Allocator::instance ()->free (ptr); } \
314 MAKE_PREFIX (void *, CLASS)::operator new[] (size_t size) \
316 void *const ptr = ACE_Allocator::instance ()->malloc (size); \
318 throw std::bad_alloc (); \
321 MAKE_PREFIX (void, CLASS)::operator delete[] (void *ptr) \
322 { if (ptr) ACE_Allocator::instance ()->free (ptr); } \
323 MAKE_PREFIX (void *, CLASS)::operator new[] (size_t size, \
324 const std::nothrow_t &) throw ()\
325 { return ACE_Allocator::instance ()->malloc (size); } \
326 MAKE_PREFIX (void, CLASS)::operator delete[] (void *ptr, \
327 const std::nothrow_t &) \
328 { if (ptr) ACE_Allocator::instance ()->free (ptr); }
330 # define ACE_ALLOC_HOOK_HELPER(RET, CLASS) RET CLASS
331 # define ACE_ALLOC_HOOK_DEFINE(CLASS) \
332 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER, CLASS)
334 # define ACE_ALLOC_HOOK_HELPER_Tt(RET, CLASS) \
335 template <typename T1> RET CLASS<T1>
336 # define ACE_ALLOC_HOOK_DEFINE_Tt(CLASS) \
337 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tt, CLASS)
339 # define ACE_ALLOC_HOOK_HELPER_Tc(RET, CLASS) template <class T1> RET CLASS<T1>
340 # define ACE_ALLOC_HOOK_DEFINE_Tc(CLASS) \
341 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tc, CLASS)
343 # define ACE_ALLOC_HOOK_HELPER_Ty(RET, CLASS) \
344 template <ACE_SYNCH_DECL> RET CLASS<ACE_SYNCH_USE>
345 # define ACE_ALLOC_HOOK_DEFINE_Ty(CLASS) \
346 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Ty, CLASS)
348 # define ACE_ALLOC_HOOK_HELPER_Tyc(RET, CLASS) \
349 template <ACE_SYNCH_DECL, class T1> RET CLASS<ACE_SYNCH_USE, T1>
350 # define ACE_ALLOC_HOOK_DEFINE_Tyc(CLASS) \
351 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tyc, CLASS)
353 # define ACE_ALLOC_HOOK_HELPER_Tycc(RET, CLASS) \
354 template <ACE_SYNCH_DECL, class T1, class T2> RET CLASS<ACE_SYNCH_USE, T1, T2>
355 # define ACE_ALLOC_HOOK_DEFINE_Tycc(CLASS) \
356 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tycc, CLASS)
358 # define ACE_ALLOC_HOOK_HELPER_Tcy(RET, CLASS) \
359 template <class T1, ACE_SYNCH_DECL> RET CLASS<T1, ACE_SYNCH_USE>
360 # define ACE_ALLOC_HOOK_DEFINE_Tcy(CLASS) \
361 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tcy, CLASS)
363 # define ACE_ALLOC_HOOK_HELPER_Tcyc(RET, CLASS) \
364 template <class T0, ACE_SYNCH_DECL, class T1> RET CLASS<T0, ACE_SYNCH_USE, T1>
365 # define ACE_ALLOC_HOOK_DEFINE_Tcyc(CLASS) \
366 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tcyc, CLASS)
368 # define ACE_ALLOC_HOOK_HELPER_Tca(RET, CLASS) \
369 template <class T1, ACE_PEER_ACCEPTOR_1> RET CLASS<T1, ACE_PEER_ACCEPTOR_2>
370 # define ACE_ALLOC_HOOK_DEFINE_Tca(CLASS) \
371 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tca, CLASS)
373 # define ACE_ALLOC_HOOK_HELPER_Tco(RET, CLASS) \
374 template <class T1, ACE_PEER_CONNECTOR_1> RET CLASS<T1, ACE_PEER_CONNECTOR_2>
375 # define ACE_ALLOC_HOOK_DEFINE_Tco(CLASS) \
376 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tco, CLASS)
378 # define ACE_ALLOC_HOOK_HELPER_Tcoccc(RET, CLASS) \
379 template <class T1, ACE_PEER_CONNECTOR_1, class T3, class T4, class T5> RET \
380 CLASS<T1, ACE_PEER_CONNECTOR_2, T3, T4, T5>
381 # define ACE_ALLOC_HOOK_DEFINE_Tcoccc(CLASS) \
382 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tcoccc, CLASS)
384 # define ACE_ALLOC_HOOK_HELPER_Tcc(RET, CLASS) \
385 template <class T1, class T2> RET CLASS<T1, T2>
386 # define ACE_ALLOC_HOOK_DEFINE_Tcc(CLASS) \
387 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tcc, CLASS)
389 # define ACE_ALLOC_HOOK_HELPER_Tccc(RET, CLASS) \
390 template <class T1, class T2, class T3> RET CLASS<T1, T2, T3>
391 # define ACE_ALLOC_HOOK_DEFINE_Tccc(CLASS) \
392 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tccc, CLASS)
394 # define ACE_ALLOC_HOOK_HELPER_Tccct(RET, CLASS) \
395 template <class T1, class T2, class T3, typename T4> RET CLASS<T1, T2, T3, T4>
396 # define ACE_ALLOC_HOOK_DEFINE_Tccct(CLASS) \
397 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tccct, CLASS)
399 # define ACE_ALLOC_HOOK_HELPER_Tc4(RET, CLASS) \
400 template <class T1, class T2, class T3, class T4> RET CLASS<T1, T2, T3, T4>
401 # define ACE_ALLOC_HOOK_DEFINE_Tc4(CLASS) \
402 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tc4, CLASS)
404 # define ACE_ALLOC_HOOK_HELPER_Tc5(RET, CLASS) \
405 template <class T1, class T2, class T3, class T4, class T5> RET \
406 CLASS<T1, T2, T3, T4, T5>
407 # define ACE_ALLOC_HOOK_DEFINE_Tc5(CLASS) \
408 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tc5, CLASS)
410 # define ACE_ALLOC_HOOK_HELPER_Tc6(RET, CLASS) \
411 template <class T1, class T2, class T3, class T4, class T5, class T6> RET \
412 CLASS<T1, T2, T3, T4, T5, T6>
413 # define ACE_ALLOC_HOOK_DEFINE_Tc6(CLASS) \
414 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tc6, CLASS)
416 # define ACE_ALLOC_HOOK_HELPER_Tc7(RET, CLASS) \
417 template <class T1, class T2, class T3, class T4, class T5, class T6, \
418 class T7> RET CLASS<T1, T2, T3, T4, T5, T6, T7>
419 # define ACE_ALLOC_HOOK_DEFINE_Tc7(CLASS) \
420 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tc7, CLASS)
422 # define ACE_ALLOC_HOOK_HELPER_Tcs(RET, CLASS) \
423 template <class T1, size_t T2> RET CLASS<T1, T2>
424 # define ACE_ALLOC_HOOK_DEFINE_Tcs(CLASS) \
425 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tcs, CLASS)
427 # define ACE_ALLOC_HOOK_HELPER_Tmcc(RET, CLASS) \
428 template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> RET \
429 CLASS<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>
430 # define ACE_ALLOC_HOOK_DEFINE_Tmcc(CLASS) \
431 ACE_GENERIC_ALLOCS (ACE_ALLOC_HOOK_HELPER_Tmcc, CLASS)
434 # define ACE_ALLOC_HOOK_DECLARE struct Ace_ {} /* Just need a dummy... */
435 # define ACE_ALLOC_HOOK_DEFINE(CLASS)
436 # define ACE_ALLOC_HOOK_DEFINE_Tt(CLASS)
437 # define ACE_ALLOC_HOOK_DEFINE_Tc(CLASS)
438 # define ACE_ALLOC_HOOK_DEFINE_Tcc(CLASS)
439 # define ACE_ALLOC_HOOK_DEFINE_Tccc(CLASS)
440 # define ACE_ALLOC_HOOK_DEFINE_Tccct(CLASS)
441 # define ACE_ALLOC_HOOK_DEFINE_Tc4(CLASS)
442 # define ACE_ALLOC_HOOK_DEFINE_Tc5(CLASS)
443 # define ACE_ALLOC_HOOK_DEFINE_Tc6(CLASS)
444 # define ACE_ALLOC_HOOK_DEFINE_Tc7(CLASS)
445 # define ACE_ALLOC_HOOK_DEFINE_Ty(CLASS)
446 # define ACE_ALLOC_HOOK_DEFINE_Tyc(CLASS)
447 # define ACE_ALLOC_HOOK_DEFINE_Tycc(CLASS)
448 # define ACE_ALLOC_HOOK_DEFINE_Tcy(CLASS)
449 # define ACE_ALLOC_HOOK_DEFINE_Tcyc(CLASS)
450 # define ACE_ALLOC_HOOK_DEFINE_Tca(CLASS)
451 # define ACE_ALLOC_HOOK_DEFINE_Tco(CLASS)
452 # define ACE_ALLOC_HOOK_DEFINE_Tcoccc(CLASS)
453 # define ACE_ALLOC_HOOK_DEFINE_Tcs(CLASS)
454 # define ACE_ALLOC_HOOK_DEFINE_Tmcc(CLASS)
455 # endif /* ACE_HAS_ALLOC_HOOKS */
457 // ============================================================================
461 * @deprecated ACE_OSCALL_RETURN and ACE_OSCALL should not be used.
462 * Please restart system calls in your application code.
463 * See the @c sigaction(2) man page for documentation
464 * regarding enabling restartable system calls across
465 * signals via the @c SA_RESTART flag.
467 * The following two macros used ensure that system calls are properly
468 * restarted (if necessary) when interrupts occur. However, that
469 * capability was never enabled by any of our supported platforms.
470 * In fact, some parts of ACE would not function properly when that
471 * ability was enabled. Furthermore, they assumed that ability to
472 * restart system calls was determined statically. That assumption
473 * does not hold for modern platforms, where that ability is
474 * determined dynamically at run-time.
476 // ============================================================================
478 #define ACE_OSCALL_RETURN(X,TYPE,FAILVALUE) \
482 #define ACE_OSCALL(X,TYPE,FAILVALUE,RESULT) \
484 RESULT = (TYPE) (X); \
487 #if defined (ACE_WIN32)
488 # define ACE_WIN32CALL_RETURN(X,TYPE,FAILVALUE) \
491 ace_result_ = (TYPE) X; \
492 if (ace_result_ == FAILVALUE) \
493 ACE_OS::set_errno_to_last_error (); \
494 return ace_result_; \
496 # define ACE_WIN32CALL(X,TYPE,FAILVALUE,RESULT) \
499 if (RESULT == FAILVALUE) \
500 ACE_OS::set_errno_to_last_error (); \
502 #endif /* ACE_WIN32 */
504 // The C99 security-improved run-time returns an error value on failure;
506 #if defined (ACE_HAS_TR24731_2005_CRT)
507 # define ACE_SECURECRTCALL(X,TYPE,FAILVALUE,RESULT) \
510 if (___ != 0) { errno = ___; RESULT = FAILVALUE; } \
512 #endif /* ACE_HAS_TR24731_2005_CRT */
514 // ============================================================================
516 // ============================================================================
518 #if defined (ACE_WIN32)
520 typedef HANDLE ACE_HANDLE
;
521 typedef SOCKET ACE_SOCKET
;
522 # define ACE_INVALID_HANDLE INVALID_HANDLE_VALUE
524 #else /* ! ACE_WIN32 */
526 typedef int ACE_HANDLE
;
527 typedef ACE_HANDLE ACE_SOCKET
;
528 # define ACE_INVALID_HANDLE -1
530 #endif /* ACE_WIN32 */
532 // Define the type that's returned from the platform's native thread
533 // functions. ACE_THR_FUNC_RETURN is the type defined as the thread
534 // function's return type, except when the thread function doesn't return
535 // anything (pSoS). The ACE_THR_FUNC_NO_RETURN_VAL macro is used to
536 // indicate that the actual thread function doesn't return anything. The
537 // rest of ACE uses a real type so there's no a ton of conditional code
538 // everywhere to deal with the possibility of no return type.
539 # if defined (ACE_VXWORKS) && !defined (ACE_HAS_PTHREADS)
540 # include /**/ <taskLib.h>
541 typedef int ACE_THR_FUNC_RETURN
;
542 #define ACE_HAS_INTEGRAL_TYPE_THR_FUNC_RETURN
543 # elif defined (ACE_WIN32)
544 typedef DWORD ACE_THR_FUNC_RETURN
;
545 #define ACE_HAS_INTEGRAL_TYPE_THR_FUNC_RETURN
547 typedef void* ACE_THR_FUNC_RETURN
;
548 # endif /* ACE_VXWORKS */
549 typedef ACE_THR_FUNC_RETURN (*ACE_THR_FUNC
)(void *);
553 #endif /* __cplusplus */
554 typedef void (*ACE_THR_C_DEST
)(void *);
557 #endif /* __cplusplus */
558 typedef void (*ACE_THR_DEST
)(void *);
560 // Now some platforms have special requirements...
561 # if defined (ACE_VXWORKS) && !defined (ACE_HAS_PTHREADS)
562 typedef FUNCPTR ACE_THR_FUNC_INTERNAL
; // where typedef int (*FUNCPTR) (...)
564 typedef ACE_THR_FUNC ACE_THR_FUNC_INTERNAL
;
565 # endif /* ACE_VXWORKS */
570 # endif /* __cplusplus */
571 # if defined (ACE_VXWORKS) && !defined (ACE_HAS_PTHREADS)
572 typedef FUNCPTR ACE_THR_C_FUNC
; // where typedef int (*FUNCPTR) (...)
574 typedef ACE_THR_FUNC_RETURN (*ACE_THR_C_FUNC
)(void *);
575 # endif /* ACE_VXWORKS */
578 # endif /* __cplusplus */
580 // ============================================================================
581 // Macros for controlling the lifetimes of dlls loaded by ACE_DLL--including
582 // all dlls loaded via the ACE Service Config framework.
584 // Please don't change these values or add new ones wantonly, since we use
585 // the ACE_BIT_ENABLED, etc..., macros to test them.
586 // ============================================================================
588 // Per-process policy that unloads dlls eagerly.
589 #define ACE_DLL_UNLOAD_POLICY_PER_PROCESS 0
590 // Apply policy on a per-dll basis. If the dll doesn't use one of the macros
591 // below, the current per-process policy will be used.
592 #define ACE_DLL_UNLOAD_POLICY_PER_DLL 1
593 // Don't unload dll when refcount reaches zero, i.e., wait for either an
594 // explicit unload request or program exit.
595 #define ACE_DLL_UNLOAD_POLICY_LAZY 2
596 // Default policy allows dlls to control their own destinies, but will
597 // unload those that don't make a choice eagerly.
598 #define ACE_DLL_UNLOAD_POLICY_DEFAULT ACE_DLL_UNLOAD_POLICY_PER_DLL
600 // Add this macro you one of your cpp file in your dll. X should
601 // be either ACE_DLL_UNLOAD_POLICY_DEFAULT or ACE_DLL_UNLOAD_POLICY_LAZY.
602 #define ACE_DLL_UNLOAD_POLICY(CLS,X) \
603 extern "C" u_long CLS##_Export _get_dll_unload_policy (void) \
606 // ============================================================================
607 // ACE_USES_CLASSIC_SVC_CONF macro
608 // ============================================================================
610 // For now, default is to use the classic svc.conf format.
611 #if !defined (ACE_USES_CLASSIC_SVC_CONF)
612 # if defined (ACE_HAS_CLASSIC_SVC_CONF) && defined (ACE_HAS_XML_SVC_CONF)
613 # error You can only use either CLASSIC or XML svc.conf, not both.
615 // Change the ACE_HAS_XML_SVC_CONF to ACE_HAS_CLASSIC_SVC_CONF when
616 // we switch ACE to use XML svc.conf as default format.
617 # if defined (ACE_HAS_XML_SVC_CONF)
618 # define ACE_USES_CLASSIC_SVC_CONF 0
620 # define ACE_USES_CLASSIC_SVC_CONF 1
621 # endif /* ACE_HAS_XML_SVC_CONF */
622 #endif /* ACE_USES_CLASSIC_SVC_CONF */
624 // ============================================================================
625 // Default svc.conf file extension.
626 // ============================================================================
627 #if defined (ACE_USES_CLASSIC_SVC_CONF) && (ACE_USES_CLASSIC_SVC_CONF == 1)
628 # define ACE_DEFAULT_SVC_CONF_EXT ".conf"
630 # define ACE_DEFAULT_SVC_CONF_EXT ".conf.xml"
631 #endif /* ACE_USES_CLASSIC_SVC_CONF && ACE_USES_CLASSIC_SVC_CONF == 1 */
633 // ============================================================================
634 // Miscellaneous macros
635 // ============================================================================
637 #if defined (ACE_USES_EXPLICIT_STD_NAMESPACE)
638 # define ACE_STD_NAMESPACE std
640 # define ACE_STD_NAMESPACE
643 #if !defined (ACE_OS_String)
644 # define ACE_OS_String ACE_OS
645 #endif /* ACE_OS_String */
646 #if !defined (ACE_OS_Memory)
647 # define ACE_OS_Memory ACE_OS
648 #endif /* ACE_OS_Memory */
649 #if !defined (ACE_OS_Dirent)
650 # define ACE_OS_Dirent ACE_OS
651 #endif /* ACE_OS_Dirent */
652 #if !defined (ACE_OS_TLI)
653 # define ACE_OS_TLI ACE_OS
654 #endif /* ACE_OS_TLI */
656 // -------------------------------------------------------------------
657 // Preprocessor symbols will not be expanded if they are
658 // concatenated. Force the preprocessor to expand them during the
659 // argument prescan by calling a macro that itself calls another that
660 // performs the actual concatenation.
661 #define ACE_PREPROC_CONCATENATE_IMPL(A,B) A ## B
662 #define ACE_PREPROC_CONCATENATE(A,B) ACE_PREPROC_CONCATENATE_IMPL(A,B)
663 // -------------------------------------------------------------------
665 /// If MPC is using a lib modifier this define will be set and this then
666 /// is used by the service configurator framework
667 #if defined MPC_LIB_MODIFIER && !defined (ACE_LD_DECORATOR_STR)
668 #define ACE_LD_DECORATOR_STR ACE_TEXT( MPC_LIB_MODIFIER )
669 #endif /* MPC_LIB_MODIFIER */
671 #ifndef ACE_GCC_CONSTRUCTOR_ATTRIBUTE
672 # define ACE_GCC_CONSTRUCTOR_ATTRIBUTE
675 #ifndef ACE_GCC_DESTRUCTOR_ATTRIBUTE
676 # define ACE_GCC_DESTRUCTOR_ATTRIBUTE
679 #ifndef ACE_HAS_TEMPLATE_TYPEDEFS
680 #define ACE_HAS_TEMPLATE_TYPEDEFS
683 #ifndef ACE_GCC_FORMAT_ATTRIBUTE
684 # define ACE_GCC_FORMAT_ATTRIBUTE(TYPE, STR_INDEX, FIRST_INDEX)
687 #ifndef ACE_DEPRECATED
688 # define ACE_DEPRECATED
691 #ifndef ACE_HAS_REACTOR_NOTIFICATION_QUEUE
692 # define ACE_HAS_REACTOR_NOTIFICATION_QUEUE
695 // If config.h declared a lack of process-shared mutexes but was silent about
696 // process-shared condition variables, ACE must not attempt to use a
697 // process-shared condition variable (which always requires a mutex too).
698 #if defined ACE_LACKS_MUTEXATTR_PSHARED && !defined ACE_LACKS_CONDATTR_PSHARED
699 # define ACE_LACKS_CONDATTR_PSHARED
702 #ifdef ACE_LACKS_CONDATTR_SETCLOCK
703 # ifdef ACE_HAS_CONDATTR_SETCLOCK
704 # undef ACE_HAS_CONDATTR_SETCLOCK
706 # ifdef ACE_HAS_POSIX_MONOTONIC_CONDITIONS
707 # undef ACE_HAS_POSIX_MONOTONIC_CONDITIONS
709 # ifdef ACE_HAS_MONOTONIC_CONDITIONS
710 # undef ACE_HAS_MONOTONIC_CONDITIONS
714 #if defined (ACE_HAS_CLOCK_GETTIME_MONOTONIC) && !defined (ACE_LACKS_CLOCK_MONOTONIC)
715 # ifndef ACE_HAS_MONOTONIC_TIME_POLICY
716 # define ACE_HAS_MONOTONIC_TIME_POLICY
720 #ifndef ACE_GCC_NO_RETURN
721 # define ACE_GCC_NO_RETURN
724 // ACE_OS::readdir_r was removed in ACE7
725 #ifndef ACE_LACKS_READDIR_R
726 # define ACE_LACKS_READDIR_R
729 #endif /* ACE_CONFIG_MACROS_H */