github.com/searKing/golang/go@v1.2.74/os/signal/cgo/include/boost/config/stdlib/libstdcpp3.hpp (about)

     1  //  (C) Copyright John Maddock 2001.
     2  //  (C) Copyright Jens Maurer 2001.
     3  //  Use, modification and distribution are subject to the
     4  //  Boost Software License, Version 1.0. (See accompanying file
     5  //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
     6  
     7  //  See http://www.boost.org for most recent version.
     8  
     9  //  config for libstdc++ v3
    10  //  not much to go in here:
    11  
    12  #define BOOST_GNU_STDLIB 1
    13  
    14  #ifdef __GLIBCXX__
    15  #define BOOST_STDLIB "GNU libstdc++ version " BOOST_STRINGIZE(__GLIBCXX__)
    16  #else
    17  #define BOOST_STDLIB "GNU libstdc++ version " BOOST_STRINGIZE(__GLIBCPP__)
    18  #endif
    19  
    20  #if !defined(_GLIBCPP_USE_WCHAR_T) && !defined(_GLIBCXX_USE_WCHAR_T)
    21  #  define BOOST_NO_CWCHAR
    22  #  define BOOST_NO_CWCTYPE
    23  #  define BOOST_NO_STD_WSTRING
    24  #  define BOOST_NO_STD_WSTREAMBUF
    25  #endif
    26  
    27  #if defined(__osf__) && !defined(_REENTRANT) \
    28    && ( defined(_GLIBCXX_HAVE_GTHR_DEFAULT) || defined(_GLIBCPP_HAVE_GTHR_DEFAULT) )
    29  // GCC 3 on Tru64 forces the definition of _REENTRANT when any std lib header
    30  // file is included, therefore for consistency we define it here as well.
    31  #  define _REENTRANT
    32  #endif
    33  
    34  #ifdef __GLIBCXX__ // gcc 3.4 and greater:
    35  #  if defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
    36          || defined(_GLIBCXX__PTHREADS) \
    37          || defined(_GLIBCXX_HAS_GTHREADS) \
    38          || defined(_WIN32) \
    39          || defined(_AIX) \
    40          || defined(__HAIKU__)
    41        //
    42        // If the std lib has thread support turned on, then turn it on in Boost
    43        // as well.  We do this because some gcc-3.4 std lib headers define _REENTANT
    44        // while others do not...
    45        //
    46  #     define BOOST_HAS_THREADS
    47  #  else
    48  #     define BOOST_DISABLE_THREADS
    49  #  endif
    50  #elif defined(__GLIBCPP__) \
    51          && !defined(_GLIBCPP_HAVE_GTHR_DEFAULT) \
    52          && !defined(_GLIBCPP__PTHREADS)
    53     // disable thread support if the std lib was built single threaded:
    54  #  define BOOST_DISABLE_THREADS
    55  #endif
    56  
    57  #if (defined(linux) || defined(__linux) || defined(__linux__)) && defined(__arm__) && defined(_GLIBCPP_HAVE_GTHR_DEFAULT)
    58  // linux on arm apparently doesn't define _REENTRANT
    59  // so just turn on threading support whenever the std lib is thread safe:
    60  #  define BOOST_HAS_THREADS
    61  #endif
    62  
    63  #if !defined(_GLIBCPP_USE_LONG_LONG) \
    64      && !defined(_GLIBCXX_USE_LONG_LONG)\
    65      && defined(BOOST_HAS_LONG_LONG)
    66  // May have been set by compiler/*.hpp, but "long long" without library
    67  // support is useless.
    68  #  undef BOOST_HAS_LONG_LONG
    69  #endif
    70  
    71  // Apple doesn't seem to reliably defined a *unix* macro
    72  #if !defined(CYGWIN) && (  defined(__unix__)  \
    73                          || defined(__unix)    \
    74                          || defined(unix)      \
    75                          || defined(__APPLE__) \
    76                          || defined(__APPLE)   \
    77                          || defined(APPLE))
    78  #  include <unistd.h>
    79  #endif
    80  
    81  #ifndef __VXWORKS__ // VxWorks uses Dinkum, not GNU STL with GCC 
    82  #if defined(__GLIBCXX__) || (defined(__GLIBCPP__) && __GLIBCPP__>=20020514) // GCC >= 3.1.0
    83  #  define BOOST_STD_EXTENSION_NAMESPACE __gnu_cxx
    84  #  define BOOST_HAS_SLIST
    85  #  define BOOST_HAS_HASH
    86  #  define BOOST_SLIST_HEADER <ext/slist>
    87  # if !defined(__GNUC__) || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3)
    88  #   define BOOST_HASH_SET_HEADER <ext/hash_set>
    89  #   define BOOST_HASH_MAP_HEADER <ext/hash_map>
    90  # else
    91  #   define BOOST_HASH_SET_HEADER <backward/hash_set>
    92  #   define BOOST_HASH_MAP_HEADER <backward/hash_map>
    93  # endif
    94  #endif
    95  #endif
    96  
    97  //
    98  // Decide whether we have C++11 support turned on:
    99  //
   100  #if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103)
   101  #  define BOOST_LIBSTDCXX11
   102  #endif
   103  
   104  //
   105  //  Decide which version of libstdc++ we have, normally
   106  //  libstdc++ C++0x support is detected via __GNUC__, __GNUC_MINOR__, and possibly
   107  //  __GNUC_PATCHLEVEL__ at the suggestion of Jonathan Wakely, one of the libstdc++
   108  //  developers. He also commented:
   109  //
   110  //       "I'm not sure how useful __GLIBCXX__ is for your purposes, for instance in
   111  //       GCC 4.2.4 it is set to 20080519 but in GCC 4.3.0 it is set to 20080305.
   112  //       Although 4.3.0 was released earlier than 4.2.4, it has better C++0x support
   113  //       than any release in the 4.2 series."
   114  //
   115  //  Another resource for understanding libstdc++ features is:
   116  //  http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#manual.intro.status.standard.200x
   117  //
   118  //  However, using the GCC version number fails when the compiler is clang since this
   119  //  only ever claims to emulate GCC-4.2, see https://svn.boost.org/trac/boost/ticket/7473
   120  //  for a long discussion on this issue.  What we can do though is use clang's __has_include
   121  //  to detect the presence of a C++11 header that was introduced with a specific GCC release.
   122  //  We still have to be careful though as many such headers were buggy and/or incomplete when
   123  //  first introduced, so we only check for headers that were fully featured from day 1, and then
   124  //  use that to infer the underlying GCC version:
   125  //
   126  #ifdef __clang__
   127  
   128  #if __has_include(<experimental/memory_resource>)
   129  #  define BOOST_LIBSTDCXX_VERSION 60100
   130  #elif __has_include(<experimental/any>)
   131  #  define BOOST_LIBSTDCXX_VERSION 50100
   132  #elif __has_include(<shared_mutex>)
   133  #  define BOOST_LIBSTDCXX_VERSION 40900
   134  #elif __has_include(<ext/cmath>)
   135  #  define BOOST_LIBSTDCXX_VERSION 40800
   136  #elif __has_include(<scoped_allocator>)
   137  #  define BOOST_LIBSTDCXX_VERSION 40700
   138  #elif __has_include(<typeindex>)
   139  #  define BOOST_LIBSTDCXX_VERSION 40600
   140  #elif __has_include(<future>)
   141  #  define BOOST_LIBSTDCXX_VERSION 40500
   142  #elif  __has_include(<ratio>)
   143  #  define BOOST_LIBSTDCXX_VERSION 40400
   144  #elif __has_include(<array>)
   145  #  define BOOST_LIBSTDCXX_VERSION 40300
   146  #endif
   147  
   148  #if (BOOST_LIBSTDCXX_VERSION < 50100)
   149  // libstdc++ does not define this function as it's deprecated in C++11, but clang still looks for it,
   150  // defining it here is a terrible cludge, but should get things working:
   151  extern "C" char *gets (char *__s);
   152  #endif
   153  //
   154  // clang is unable to parse some GCC headers, add those workarounds here:
   155  //
   156  #if BOOST_LIBSTDCXX_VERSION < 50000
   157  #  define BOOST_NO_CXX11_HDR_REGEX
   158  #endif
   159  //
   160  // GCC 4.7.x has no __cxa_thread_atexit which
   161  // thread_local objects require for cleanup:
   162  //
   163  #if BOOST_LIBSTDCXX_VERSION < 40800
   164  #  define BOOST_NO_CXX11_THREAD_LOCAL
   165  #endif
   166  //
   167  // Early clang versions can handle <chrono>, not exactly sure which versions
   168  // but certainly up to clang-3.8 and gcc-4.6:
   169  //
   170  #if (__clang_major__ < 5)
   171  #  if BOOST_LIBSTDCXX_VERSION < 40800
   172  #     define BOOST_NO_CXX11_HDR_FUTURE
   173  #     define BOOST_NO_CXX11_HDR_MUTEX
   174  #     define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
   175  #     define BOOST_NO_CXX11_HDR_CHRONO
   176  #  endif
   177  #endif
   178  
   179  //
   180  //  GCC 4.8 and 9 add working versions of <atomic> and <regex> respectively.
   181  //  However, we have no test for these as the headers were present but broken
   182  //  in early GCC versions.
   183  //
   184  #endif
   185  
   186  #if defined(__SUNPRO_CC) && (__SUNPRO_CC >= 0x5130) && (__cplusplus >= 201103L)
   187  //
   188  // Oracle Solaris compiler uses it's own verison of libstdc++ but doesn't 
   189  // set __GNUC__
   190  //
   191  #if __SUNPRO_CC >= 0x5140
   192  #define BOOST_LIBSTDCXX_VERSION 50100
   193  #else
   194  #define BOOST_LIBSTDCXX_VERSION 40800
   195  #endif
   196  #endif
   197  
   198  #if !defined(BOOST_LIBSTDCXX_VERSION)
   199  #  define BOOST_LIBSTDCXX_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
   200  #endif
   201  
   202  // std::auto_ptr isn't provided with _GLIBCXX_DEPRECATED=0 (GCC 4.5 and earlier)
   203  // or _GLIBCXX_USE_DEPRECATED=0 (GCC 4.6 and later).
   204  #if defined(BOOST_LIBSTDCXX11)
   205  #  if BOOST_LIBSTDCXX_VERSION < 40600
   206  #     if !_GLIBCXX_DEPRECATED
   207  #        define BOOST_NO_AUTO_PTR
   208  #     endif
   209  #  elif !_GLIBCXX_USE_DEPRECATED
   210  #     define BOOST_NO_AUTO_PTR
   211  #  endif
   212  #endif
   213  
   214  //  C++0x headers in GCC 4.3.0 and later
   215  //
   216  #if (BOOST_LIBSTDCXX_VERSION < 40300) || !defined(BOOST_LIBSTDCXX11)
   217  #  define BOOST_NO_CXX11_HDR_ARRAY
   218  #  define BOOST_NO_CXX11_HDR_TUPLE
   219  #  define BOOST_NO_CXX11_HDR_UNORDERED_MAP
   220  #  define BOOST_NO_CXX11_HDR_UNORDERED_SET
   221  #  define BOOST_NO_CXX11_HDR_FUNCTIONAL
   222  #endif
   223  
   224  //  C++0x headers in GCC 4.4.0 and later
   225  //
   226  #if (BOOST_LIBSTDCXX_VERSION < 40400) || !defined(BOOST_LIBSTDCXX11)
   227  #  define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
   228  #  define BOOST_NO_CXX11_HDR_FORWARD_LIST
   229  #  define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
   230  #  define BOOST_NO_CXX11_HDR_MUTEX
   231  #  define BOOST_NO_CXX11_HDR_RATIO
   232  #  define BOOST_NO_CXX11_HDR_SYSTEM_ERROR
   233  #  define BOOST_NO_CXX11_SMART_PTR
   234  #else
   235  #  define BOOST_HAS_TR1_COMPLEX_INVERSE_TRIG 
   236  #  define BOOST_HAS_TR1_COMPLEX_OVERLOADS 
   237  #endif
   238  
   239  //  C++0x features in GCC 4.5.0 and later
   240  //
   241  #if (BOOST_LIBSTDCXX_VERSION < 40500) || !defined(BOOST_LIBSTDCXX11)
   242  #  define BOOST_NO_CXX11_NUMERIC_LIMITS
   243  #  define BOOST_NO_CXX11_HDR_FUTURE
   244  #  define BOOST_NO_CXX11_HDR_RANDOM
   245  #endif
   246  
   247  //  C++0x features in GCC 4.6.0 and later
   248  //
   249  #if (BOOST_LIBSTDCXX_VERSION < 40600) || !defined(BOOST_LIBSTDCXX11)
   250  #  define BOOST_NO_CXX11_HDR_TYPEINDEX
   251  #  define BOOST_NO_CXX11_ADDRESSOF
   252  #  define BOOST_NO_CXX17_ITERATOR_TRAITS
   253  #endif
   254  
   255  //  C++0x features in GCC 4.7.0 and later
   256  //
   257  #if (BOOST_LIBSTDCXX_VERSION < 40700) || !defined(BOOST_LIBSTDCXX11)
   258  // Note that although <chrono> existed prior to 4.7, "steady_clock" is spelled "monotonic_clock"
   259  // so 4.7.0 is the first truly conforming one.
   260  #  define BOOST_NO_CXX11_HDR_CHRONO
   261  #  define BOOST_NO_CXX11_ALLOCATOR
   262  #  define BOOST_NO_CXX11_POINTER_TRAITS
   263  #endif
   264  //  C++0x features in GCC 4.8.0 and later
   265  //
   266  #if (BOOST_LIBSTDCXX_VERSION < 40800) || !defined(BOOST_LIBSTDCXX11)
   267  // Note that although <atomic> existed prior to gcc 4.8 it was largely unimplemented for many types:
   268  #  define BOOST_NO_CXX11_HDR_ATOMIC
   269  #  define BOOST_NO_CXX11_HDR_THREAD
   270  #endif
   271  //  C++0x features in GCC 4.9.0 and later
   272  //
   273  #if (BOOST_LIBSTDCXX_VERSION < 40900) || !defined(BOOST_LIBSTDCXX11)
   274  // Although <regex> is present and compilable against, the actual implementation is not functional
   275  // even for the simplest patterns such as "\d" or "[0-9]". This is the case at least in gcc up to 4.8, inclusively.
   276  #  define BOOST_NO_CXX11_HDR_REGEX
   277  #endif
   278  #if (BOOST_LIBSTDCXX_VERSION < 40900) || (__cplusplus <= 201103)
   279  #  define BOOST_NO_CXX14_STD_EXCHANGE
   280  #endif
   281  
   282  #if defined(__clang_major__) && ((__clang_major__ < 3) || ((__clang_major__ == 3) && (__clang_minor__ < 7)))
   283  // As of clang-3.6, libstdc++ header <atomic> throws up errors with clang:
   284  #  define BOOST_NO_CXX11_HDR_ATOMIC
   285  #endif
   286  //
   287  //  C++0x features in GCC 5.1 and later
   288  //
   289  #if (BOOST_LIBSTDCXX_VERSION < 50100) || !defined(BOOST_LIBSTDCXX11)
   290  #  define BOOST_NO_CXX11_HDR_TYPE_TRAITS
   291  #  define BOOST_NO_CXX11_HDR_CODECVT
   292  #  define BOOST_NO_CXX11_ATOMIC_SMART_PTR
   293  #  define BOOST_NO_CXX11_STD_ALIGN
   294  #endif
   295  
   296  //
   297  //  C++17 features in GCC 7.1 and later
   298  //
   299  #if (BOOST_LIBSTDCXX_VERSION < 70100) || (__cplusplus <= 201402L)
   300  #  define BOOST_NO_CXX17_STD_INVOKE
   301  #  define BOOST_NO_CXX17_STD_APPLY
   302  #  define BOOST_NO_CXX17_HDR_OPTIONAL
   303  #  define BOOST_NO_CXX17_HDR_STRING_VIEW
   304  #  define BOOST_NO_CXX17_HDR_VARIANT
   305  #endif
   306  
   307  #if defined(__has_include)
   308  #if !__has_include(<shared_mutex>)
   309  #  define BOOST_NO_CXX14_HDR_SHARED_MUTEX
   310  #elif __cplusplus <= 201103
   311  #  define BOOST_NO_CXX14_HDR_SHARED_MUTEX
   312  #endif
   313  #elif __cplusplus < 201402 || (BOOST_LIBSTDCXX_VERSION < 40900) || !defined(BOOST_LIBSTDCXX11)
   314  #  define BOOST_NO_CXX14_HDR_SHARED_MUTEX
   315  #endif
   316  
   317  //
   318  // Headers not present on Solaris with the Oracle compiler:
   319  #if defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x5140)
   320  #define BOOST_NO_CXX11_HDR_FUTURE
   321  #define BOOST_NO_CXX11_HDR_FORWARD_LIST 
   322  #define BOOST_NO_CXX11_HDR_ATOMIC
   323  // shared_ptr is present, but is not convertible to bool
   324  // which causes all kinds of problems especially in Boost.Thread
   325  // but probably elsewhere as well.
   326  #define BOOST_NO_CXX11_SMART_PTR
   327  #endif
   328  
   329  #if (!defined(_GLIBCXX_HAS_GTHREADS) || !defined(_GLIBCXX_USE_C99_STDINT_TR1))
   330     // Headers not always available:
   331  #  ifndef BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
   332  #     define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
   333  #  endif
   334  #  ifndef BOOST_NO_CXX11_HDR_MUTEX
   335  #     define BOOST_NO_CXX11_HDR_MUTEX
   336  #  endif
   337  #  ifndef BOOST_NO_CXX11_HDR_THREAD
   338  #     define BOOST_NO_CXX11_HDR_THREAD
   339  #  endif
   340  #  ifndef BOOST_NO_CXX14_HDR_SHARED_MUTEX
   341  #     define BOOST_NO_CXX14_HDR_SHARED_MUTEX
   342  #  endif
   343  #endif
   344  
   345  #if (!defined(_GTHREAD_USE_MUTEX_TIMEDLOCK) || (_GTHREAD_USE_MUTEX_TIMEDLOCK == 0)) && !defined(BOOST_NO_CXX11_HDR_MUTEX)
   346  // Timed mutexes are not always available:
   347  #  define BOOST_NO_CXX11_HDR_MUTEX
   348  #endif
   349  
   350  //  --- end ---