source: NonGTP/Boost/boost/config/suffix.hpp @ 857

Revision 857, 17.8 KB checked in by igarcia, 19 years ago (diff)
Line 
1//  Boost config.hpp configuration header file  ------------------------------//
2
3//  (C) Copyright John Maddock 2001 - 2003.
4//  (C) Copyright Darin Adler 2001.
5//  (C) Copyright Peter Dimov 2001.
6//  (C) Copyright Bill Kempf 2002.
7//  (C) Copyright Jens Maurer 2002.
8//  (C) Copyright David Abrahams 2002 - 2003.
9//  (C) Copyright Gennaro Prota 2003.
10//  (C) Copyright Eric Friedman 2003.
11//  Use, modification and distribution are subject to the
12//  Boost Software License, Version 1.0. (See accompanying file
13//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
14
15//  See http://www.boost.org for most recent version.
16
17//  Boost config.hpp policy and rationale documentation has been moved to
18//  http://www.boost.org/libs/config
19//
20//  This file is intended to be stable, and relatively unchanging.
21//  It should contain boilerplate code only - no compiler specific
22//  code unless it is unavoidable - no changes unless unavoidable.
23
24#ifndef BOOST_CONFIG_SUFFIX_HPP
25#define BOOST_CONFIG_SUFFIX_HPP
26
27//
28// look for long long by looking for the appropriate macros in <limits.h>.
29// Note that we use limits.h rather than climits for maximal portability,
30// remember that since these just declare a bunch of macros, there should be
31// no namespace issues from this.
32//
33#include <limits.h>
34# if !defined(BOOST_HAS_LONG_LONG)                                              \
35   && !defined(BOOST_MSVC) && !defined(__BORLANDC__)     \
36   && (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX))
37#  define BOOST_HAS_LONG_LONG
38#endif
39
40// TODO: Remove the following lines after the 1.33 release because the presence
41// of an integral 64 bit type has nothing to do with support for long long.
42
43#if !defined(BOOST_HAS_LONG_LONG) && !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(__DECCXX_VER)
44#  define BOOST_NO_INTEGRAL_INT64_T
45#endif
46
47// GCC 3.x will clean up all of those nasty macro definitions that
48// BOOST_NO_CTYPE_FUNCTIONS is intended to help work around, so undefine
49// it under GCC 3.x.
50#if defined(__GNUC__) && (__GNUC__ >= 3) && defined(BOOST_NO_CTYPE_FUNCTIONS)
51#  undef BOOST_NO_CTYPE_FUNCTIONS
52#endif
53
54
55//
56// Assume any extensions are in namespace std:: unless stated otherwise:
57//
58#  ifndef BOOST_STD_EXTENSION_NAMESPACE
59#    define BOOST_STD_EXTENSION_NAMESPACE std
60#  endif
61
62//
63// If cv-qualified specializations are not allowed, then neither are cv-void ones:
64//
65#  if defined(BOOST_NO_CV_SPECIALIZATIONS) \
66      && !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS)
67#     define BOOST_NO_CV_VOID_SPECIALIZATIONS
68#  endif
69
70//
71// If there is no numeric_limits template, then it can't have any compile time
72// constants either!
73//
74#  if defined(BOOST_NO_LIMITS) \
75      && !defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS)
76#     define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
77#     define BOOST_NO_MS_INT64_NUMERIC_LIMITS
78#     define BOOST_NO_LONG_LONG_NUMERIC_LIMITS
79#  endif
80
81//
82// if there is no long long then there is no specialisation
83// for numeric_limits<long long> either:
84//
85#if !defined(BOOST_HAS_LONG_LONG) && !defined(BOOST_NO_LONG_LONG_NUMERIC_LIMITS)
86#  define BOOST_NO_LONG_LONG_NUMERIC_LIMITS
87#endif
88
89//
90// if there is no __int64 then there is no specialisation
91// for numeric_limits<__int64> either:
92//
93#if !defined(BOOST_HAS_MS_INT64) && !defined(BOOST_NO_MS_INT64_NUMERIC_LIMITS)
94#  define BOOST_NO_MS_INT64_NUMERIC_LIMITS
95#endif
96
97//
98// if member templates are supported then so is the
99// VC6 subset of member templates:
100//
101#  if !defined(BOOST_NO_MEMBER_TEMPLATES) \
102       && !defined(BOOST_MSVC6_MEMBER_TEMPLATES)
103#     define BOOST_MSVC6_MEMBER_TEMPLATES
104#  endif
105
106//
107// Without partial specialization, can't test for partial specialisation bugs:
108//
109#  if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
110      && !defined(BOOST_BCB_PARTIAL_SPECIALIZATION_BUG)
111#     define BOOST_BCB_PARTIAL_SPECIALIZATION_BUG
112#  endif
113
114//
115// Without partial specialization, we can't have array-type partial specialisations:
116//
117#  if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
118      && !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS)
119#     define BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS
120#  endif
121
122//
123// Without partial specialization, std::iterator_traits can't work:
124//
125#  if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
126      && !defined(BOOST_NO_STD_ITERATOR_TRAITS)
127#     define BOOST_NO_STD_ITERATOR_TRAITS
128#  endif
129
130//
131// Without member template support, we can't have template constructors
132// in the standard library either:
133//
134#  if defined(BOOST_NO_MEMBER_TEMPLATES) \
135      && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) \
136      && !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
137#     define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
138#  endif
139
140//
141// Without member template support, we can't have a conforming
142// std::allocator template either:
143//
144#  if defined(BOOST_NO_MEMBER_TEMPLATES) \
145      && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) \
146      && !defined(BOOST_NO_STD_ALLOCATOR)
147#     define BOOST_NO_STD_ALLOCATOR
148#  endif
149
150//
151// without ADL support then using declarations will break ADL as well:
152//
153#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) && !defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL)
154#  define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
155#endif
156
157//
158// If we have a standard allocator, then we have a partial one as well:
159//
160#if !defined(BOOST_NO_STD_ALLOCATOR)
161#  define BOOST_HAS_PARTIAL_STD_ALLOCATOR
162#endif
163
164//
165// We can't have a working std::use_facet if there is no std::locale:
166//
167#  if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_USE_FACET)
168#     define BOOST_NO_STD_USE_FACET
169#  endif
170
171//
172// We can't have a std::messages facet if there is no std::locale:
173//
174#  if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_MESSAGES)
175#     define BOOST_NO_STD_MESSAGES
176#  endif
177
178//
179// We can't have a working std::wstreambuf if there is no std::locale:
180//
181#  if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_WSTREAMBUF)
182#     define BOOST_NO_STD_WSTREAMBUF
183#  endif
184
185//
186// We can't have a <cwctype> if there is no <cwchar>:
187//
188#  if defined(BOOST_NO_CWCHAR) && !defined(BOOST_NO_CWCTYPE)
189#     define BOOST_NO_CWCTYPE
190#  endif
191
192//
193// We can't have a swprintf if there is no <cwchar>:
194//
195#  if defined(BOOST_NO_CWCHAR) && !defined(BOOST_NO_SWPRINTF)
196#     define BOOST_NO_SWPRINTF
197#  endif
198
199//
200// If Win32 support is turned off, then we must turn off
201// threading support also, unless there is some other
202// thread API enabled:
203//
204#if defined(BOOST_DISABLE_WIN32) && defined(_WIN32) \
205   && !defined(BOOST_DISABLE_THREADS) && !defined(BOOST_HAS_PTHREADS)
206#  define BOOST_DISABLE_THREADS
207#endif
208
209//
210// Turn on threading support if the compiler thinks that it's in
211// multithreaded mode.  We put this here because there are only a
212// limited number of macros that identify this (if there's any missing
213// from here then add to the appropriate compiler section):
214//
215#if (defined(__MT__) || defined(_MT) || defined(_REENTRANT) \
216    || defined(_PTHREADS)) && !defined(BOOST_HAS_THREADS)
217#  define BOOST_HAS_THREADS
218#endif
219
220//
221// Turn threading support off if BOOST_DISABLE_THREADS is defined:
222//
223#if defined(BOOST_DISABLE_THREADS) && defined(BOOST_HAS_THREADS)
224#  undef BOOST_HAS_THREADS
225#endif
226
227//
228// Turn threading support off if we don't recognise the threading API:
229//
230#if defined(BOOST_HAS_THREADS) && !defined(BOOST_HAS_PTHREADS)\
231      && !defined(BOOST_HAS_WINTHREADS) && !defined(BOOST_HAS_BETHREADS)\
232      && !defined(BOOST_HAS_MPTASKS)
233#  undef BOOST_HAS_THREADS
234#endif
235
236//
237// Turn threading detail macros off if we don't (want to) use threading
238//
239#ifndef BOOST_HAS_THREADS
240#  undef BOOST_HAS_PTHREADS
241#  undef BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE
242#  undef BOOST_HAS_WINTHREADS
243#  undef BOOST_HAS_BETHREADS
244#  undef BOOST_HAS_MPTASKS
245#endif
246
247//
248// If the compiler claims to be C99 conformant, then it had better
249// have a <stdint.h>:
250//
251#  if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)
252#     define BOOST_HAS_STDINT_H
253#  endif
254
255//
256// Define BOOST_NO_SLIST and BOOST_NO_HASH if required.
257// Note that this is for backwards compatibility only.
258//
259#  ifndef BOOST_HAS_SLIST
260#     define BOOST_NO_SLIST
261#  endif
262
263#  ifndef BOOST_HAS_HASH
264#     define BOOST_NO_HASH
265#  endif
266
267//  BOOST_HAS_ABI_HEADERS
268//  This macro gets set if we have headers that fix the ABI,
269//  and prevent ODR violations when linking to external libraries:
270#if defined(BOOST_ABI_PREFIX) && defined(BOOST_ABI_SUFFIX) && !defined(BOOST_HAS_ABI_HEADERS)
271#  define BOOST_HAS_ABI_HEADERS
272#endif
273
274#if defined(BOOST_HAS_ABI_HEADERS) && defined(BOOST_DISABLE_ABI_HEADERS)
275#  undef BOOST_HAS_ABI_HEADERS
276#endif
277
278//  BOOST_NO_STDC_NAMESPACE workaround  --------------------------------------//
279//  Because std::size_t usage is so common, even in boost headers which do not
280//  otherwise use the C library, the <cstddef> workaround is included here so
281//  that ugly workaround code need not appear in many other boost headers.
282//  NOTE WELL: This is a workaround for non-conforming compilers; <cstddef>
283//  must still be #included in the usual places so that <cstddef> inclusion
284//  works as expected with standard conforming compilers.  The resulting
285//  double inclusion of <cstddef> is harmless.
286
287# ifdef BOOST_NO_STDC_NAMESPACE
288#   include <cstddef>
289    namespace std { using ::ptrdiff_t; using ::size_t; }
290# endif
291
292//  Workaround for the unfortunate min/max macros defined by some platform headers
293
294#define BOOST_PREVENT_MACRO_SUBSTITUTION
295
296#ifndef BOOST_USING_STD_MIN
297#  define BOOST_USING_STD_MIN() using std::min
298#endif
299
300#ifndef BOOST_USING_STD_MAX
301#  define BOOST_USING_STD_MAX() using std::max
302#endif
303
304//  BOOST_NO_STD_MIN_MAX workaround  -----------------------------------------//
305
306#  ifdef BOOST_NO_STD_MIN_MAX
307
308namespace std {
309  template <class _Tp>
310  inline const _Tp& min BOOST_PREVENT_MACRO_SUBSTITUTION (const _Tp& __a, const _Tp& __b) {
311    return __b < __a ? __b : __a;
312  }
313  template <class _Tp>
314  inline const _Tp& max BOOST_PREVENT_MACRO_SUBSTITUTION (const _Tp& __a, const _Tp& __b) {
315    return  __a < __b ? __b : __a;
316  }
317}
318
319#  endif
320
321// BOOST_STATIC_CONSTANT workaround --------------------------------------- //
322// On compilers which don't allow in-class initialization of static integral
323// constant members, we must use enums as a workaround if we want the constants
324// to be available at compile-time. This macro gives us a convenient way to
325// declare such constants.
326
327#  ifdef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
328#       define BOOST_STATIC_CONSTANT(type, assignment) enum { assignment }
329#  else
330#     define BOOST_STATIC_CONSTANT(type, assignment) static const type assignment
331#  endif
332
333// BOOST_USE_FACET / HAS_FACET workaround ----------------------------------//
334// When the standard library does not have a conforming std::use_facet there
335// are various workarounds available, but they differ from library to library.
336// The same problem occurs with has_facet.
337// These macros provide a consistent way to access a locale's facets.
338// Usage:
339//    replace
340//       std::use_facet<Type>(loc);
341//    with
342//       BOOST_USE_FACET(Type, loc);
343//    Note do not add a std:: prefix to the front of BOOST_USE_FACET!
344//  Use for BOOST_HAS_FACET is analagous.
345
346#if defined(BOOST_NO_STD_USE_FACET)
347#  ifdef BOOST_HAS_TWO_ARG_USE_FACET
348#     define BOOST_USE_FACET(Type, loc) std::use_facet(loc, static_cast<Type*>(0))
349#     define BOOST_HAS_FACET(Type, loc) std::has_facet(loc, static_cast<Type*>(0))
350#  elif defined(BOOST_HAS_MACRO_USE_FACET)
351#     define BOOST_USE_FACET(Type, loc) std::_USE(loc, Type)
352#     define BOOST_HAS_FACET(Type, loc) std::_HAS(loc, Type)
353#  elif defined(BOOST_HAS_STLP_USE_FACET)
354#     define BOOST_USE_FACET(Type, loc) (*std::_Use_facet<Type >(loc))
355#     define BOOST_HAS_FACET(Type, loc) std::has_facet< Type >(loc)
356#  endif
357#else
358#  define BOOST_USE_FACET(Type, loc) std::use_facet< Type >(loc)
359#  define BOOST_HAS_FACET(Type, loc) std::has_facet< Type >(loc)
360#endif
361
362// BOOST_NESTED_TEMPLATE workaround ------------------------------------------//
363// Member templates are supported by some compilers even though they can't use
364// the A::template member<U> syntax, as a workaround replace:
365//
366// typedef typename A::template rebind<U> binder;
367//
368// with:
369//
370// typedef typename A::BOOST_NESTED_TEMPLATE rebind<U> binder;
371
372#ifndef BOOST_NO_MEMBER_TEMPLATE_KEYWORD
373#  define BOOST_NESTED_TEMPLATE template
374#else
375#  define BOOST_NESTED_TEMPLATE
376#endif
377
378// BOOST_UNREACHABLE_RETURN(x) workaround -------------------------------------//
379// Normally evaluates to nothing, unless BOOST_NO_UNREACHABLE_RETURN_DETECTION
380// is defined, in which case it evaluates to return x; Use when you have a return
381// statement that can never be reached.
382
383#ifdef BOOST_NO_UNREACHABLE_RETURN_DETECTION
384#  define BOOST_UNREACHABLE_RETURN(x) return x;
385#else
386#  define BOOST_UNREACHABLE_RETURN(x)
387#endif
388
389// BOOST_DEDUCED_TYPENAME workaround ------------------------------------------//
390//
391// Some compilers don't support the use of `typename' for dependent
392// types in deduced contexts, e.g.
393//
394//     template <class T> void f(T, typename T::type);
395//                                  ^^^^^^^^
396// Replace these declarations with:
397//
398//     template <class T> void f(T, BOOST_DEDUCED_TYPENAME T::type);
399
400#ifndef BOOST_NO_DEDUCED_TYPENAME
401#  define BOOST_DEDUCED_TYPENAME typename
402#else
403#  define BOOST_DEDUCED_TYPENAME
404#endif
405
406// long long workaround ------------------------------------------//
407// On gcc (and maybe other compilers?) long long is alway supported
408// but it's use may generate either warnings (with -ansi), or errors
409// (with -pedantic -ansi) unless it's use is prefixed by __extension__
410//
411#if defined(BOOST_HAS_LONG_LONG)
412namespace boost{
413#  ifdef __GNUC__
414   __extension__ typedef long long long_long_type;
415   __extension__ typedef unsigned long long ulong_long_type;
416#  else
417   typedef long long long_long_type;
418   typedef unsigned long long ulong_long_type;
419#  endif
420}
421#endif
422
423// BOOST_[APPEND_]EXPLICIT_TEMPLATE_[NON_]TYPE macros --------------------------//
424//
425// Some compilers have problems with function templates whose
426// template parameters don't appear in the function parameter
427// list (basically they just link one instantiation of the
428// template in the final executable). These macros provide a
429// uniform way to cope with the problem with no effects on the
430// calling syntax.
431
432// Example:
433//
434//  #include <iostream>
435//  #include <ostream>
436//  #include <typeinfo>
437//
438//  template <int n>
439//  void f() { std::cout << n << ' '; }
440//
441//  template <typename T>
442//  void g() { std::cout << typeid(T).name() << ' '; }
443//
444//  int main() {
445//    f<1>();
446//    f<2>();
447//
448//    g<int>();
449//    g<double>();
450//  }
451//
452// With VC++ 6.0 the output is:
453//
454//   2 2 double double
455//
456// To fix it, write
457//
458//   template <int n>
459//   void f(BOOST_EXPLICIT_TEMPLATE_NON_TYPE(int, n)) { ... }
460//
461//   template <typename T>
462//   void g(BOOST_EXPLICIT_TEMPLATE_TYPE(T)) { ... }
463//
464
465
466#if defined BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
467
468#  include "boost/type.hpp"
469#  include "boost/non_type.hpp"
470
471#  define BOOST_EXPLICIT_TEMPLATE_TYPE(t)         boost::type<t>* = 0
472#  define BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t)    boost::type<t>*
473#  define BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v)  boost::non_type<t, v>* = 0
474#  define BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)  boost::non_type<t, v>*
475
476#  define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(t)         \
477             , BOOST_EXPLICIT_TEMPLATE_TYPE(t)
478#  define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t)    \
479             , BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t)
480#  define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v)  \
481             , BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
482#  define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)  \
483             , BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)
484
485#else
486
487// no workaround needed: expand to nothing
488
489#  define BOOST_EXPLICIT_TEMPLATE_TYPE(t)
490#  define BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t)
491#  define BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
492#  define BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)
493
494#  define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(t)
495#  define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t)
496#  define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
497#  define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)
498
499
500#endif // defined BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
501
502
503// ---------------------------------------------------------------------------//
504
505//
506// Helper macro BOOST_STRINGIZE:
507// Converts the parameter X to a string after macro replacement
508// on X has been performed.
509//
510#define BOOST_STRINGIZE(X) BOOST_DO_STRINGIZE(X)
511#define BOOST_DO_STRINGIZE(X) #X
512
513//
514// Helper macro BOOST_JOIN:
515// The following piece of macro magic joins the two
516// arguments together, even when one of the arguments is
517// itself a macro (see 16.3.1 in C++ standard).  The key
518// is that macro expansion of macro arguments does not
519// occur in BOOST_DO_JOIN2 but does in BOOST_DO_JOIN.
520//
521#define BOOST_JOIN( X, Y ) BOOST_DO_JOIN( X, Y )
522#define BOOST_DO_JOIN( X, Y ) BOOST_DO_JOIN2(X,Y)
523#define BOOST_DO_JOIN2( X, Y ) X##Y
524
525//
526// Set some default values for compiler/library/platform names.
527// These are for debugging config setup only:
528//
529#  ifndef BOOST_COMPILER
530#     define BOOST_COMPILER "Unknown ISO C++ Compiler"
531#  endif
532#  ifndef BOOST_STDLIB
533#     define BOOST_STDLIB "Unknown ISO standard library"
534#  endif
535#  ifndef BOOST_PLATFORM
536#     if defined(unix) || defined(__unix) || defined(_XOPEN_SOURCE) \
537         || defined(_POSIX_SOURCE)
538#        define BOOST_PLATFORM "Generic Unix"
539#     else
540#        define BOOST_PLATFORM "Unknown"
541#     endif
542#  endif
543
544#endif
545
546
547
Note: See TracBrowser for help on using the repository browser.