compiler_config.hpp 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. #ifndef DATE_TIME_COMPILER_CONFIG_HPP___
  2. #define DATE_TIME_COMPILER_CONFIG_HPP___
  3. /* Copyright (c) 2002-2004 CrystalClear Software, Inc.
  4. * Subject to the Boost Software License, Version 1.0. (See accompanying
  5. * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  6. * Author: Jeff Garland, Bart Garst
  7. * $Date$
  8. */
  9. #include <cstdlib>
  10. #include <boost/config.hpp>
  11. #include <boost/detail/workaround.hpp>
  12. // With boost release 1.33, date_time will be using a different,
  13. // more flexible, IO system. This new system is not compatible with
  14. // old compilers. The original date_time IO system remains for those
  15. // compilers. They must define this macro to use the legacy IO.
  16. // (defined(__BORLANDC__) && (__BORLANDC__ <= 0x0581) ) ) &&
  17. #if( BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x581) ) \
  18. || BOOST_WORKAROUND( __GNUC__, < 3) \
  19. || (BOOST_WORKAROUND( _MSC_VER, <= 1300) ) \
  20. ) \
  21. && !defined(USE_DATE_TIME_PRE_1_33_FACET_IO)
  22. # define USE_DATE_TIME_PRE_1_33_FACET_IO
  23. #endif
  24. // This file performs some local compiler configurations
  25. #include <boost/date_time/locale_config.hpp> //set up locale configurations
  26. //Set up a configuration parameter for platforms that have
  27. //GetTimeOfDay
  28. #if defined(BOOST_HAS_GETTIMEOFDAY) || defined(BOOST_HAS_FTIME)
  29. #define BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK
  30. #endif
  31. // To Force no default constructors for date & ptime, un-comment following
  32. //#define DATE_TIME_NO_DEFAULT_CONSTRUCTOR
  33. // Include extensions to date_duration - comment out to remove this feature
  34. #define BOOST_DATE_TIME_OPTIONAL_GREGORIAN_TYPES
  35. // these extensions are known to cause problems with gcc295
  36. #if defined(__GNUC__) && (__GNUC__ < 3)
  37. #undef BOOST_DATE_TIME_OPTIONAL_GREGORIAN_TYPES
  38. #endif
  39. #if (defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION) || BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x581) ) )
  40. #define BOOST_DATE_TIME_NO_MEMBER_INIT
  41. #endif
  42. // include these types before we try to re-define them
  43. #include <boost/cstdint.hpp>
  44. //Define INT64_C for compilers that don't have it
  45. #if (!defined(INT64_C))
  46. #define INT64_C(value) int64_t(value)
  47. #endif
  48. /* Workaround for Borland iterator error. Error was "Cannot convert 'istream *' to 'wistream *' in function istream_iterator<>::istream_iterator() */
  49. #if defined(__BORLANDC__) && defined(BOOST_BCB_WITH_RW_LIB)
  50. #define BOOST_DATE_TIME_NO_WISTREAM_ITERATOR
  51. #endif
  52. // Borland v5.64 does not have the following in std namespace; v5.5.1 does
  53. #if defined(__BORLANDC__) && defined(BOOST_BCB_WITH_STLPORT)
  54. #include <locale>
  55. namespace std {
  56. using stlport::tolower;
  57. using stlport::ctype;
  58. using stlport::use_facet;
  59. }
  60. #endif
  61. // workaround for errors associated with output for date classes
  62. // modifications and input streaming for time classes.
  63. // Compilers affected are:
  64. // gcc295, msvc (neither with STLPort), any borland
  65. //
  66. #if (((defined(__GNUC__) && (__GNUC__ < 3)) || \
  67. (defined(_MSC_VER) && (_MSC_VER < 1300)) ) && \
  68. !defined(_STLP_OWN_IOSTREAMS) ) || \
  69. BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x581) )
  70. #define BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS
  71. #endif
  72. // The macro marks up places where compiler complains for missing return statement or
  73. // uninitialized variables after calling to boost::throw_exception.
  74. // BOOST_UNREACHABLE_RETURN doesn't work since even compilers that support
  75. // unreachable statements detection emit such warnings.
  76. #if defined(_MSC_VER)
  77. // Use special MSVC extension to markup unreachable code
  78. # define BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(x) __assume(false)
  79. #elif !defined(BOOST_NO_UNREACHABLE_RETURN_DETECTION)
  80. // Call to a non-returning function should suppress the warning
  81. # if defined(BOOST_NO_STDC_NAMESPACE)
  82. namespace std {
  83. using ::abort;
  84. }
  85. # endif // defined(BOOST_NO_STDC_NAMESPACE)
  86. # define BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(x) std::abort()
  87. #else
  88. // For other poor compilers the specified expression is compiled. Usually, this would be a return statement.
  89. # define BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(x) x
  90. #endif
  91. /* The following handles the definition of the necessary macros
  92. * for dll building on Win32 platforms.
  93. *
  94. * For code that will be placed in the date_time .dll,
  95. * it must be properly prefixed with BOOST_DATE_TIME_DECL.
  96. * The corresponding .cpp file must have BOOST_DATE_TIME_SOURCE
  97. * defined before including its header. For examples see:
  98. * greg_month.hpp & greg_month.cpp
  99. *
  100. */
  101. // we need to import/export our code only if the user has specifically
  102. // asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost
  103. // libraries to be dynamically linked, or BOOST_DATE_TIME_DYN_LINK
  104. // if they want just this one to be dynamically liked:
  105. #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_DATE_TIME_DYN_LINK)
  106. // export if this is our own source, otherwise import:
  107. # ifdef BOOST_DATE_TIME_SOURCE
  108. # define BOOST_DATE_TIME_DECL BOOST_SYMBOL_EXPORT
  109. # else
  110. # define BOOST_DATE_TIME_DECL BOOST_SYMBOL_IMPORT
  111. # endif // BOOST_DATE_TIME_SOURCE
  112. #endif // DYN_LINK
  113. //
  114. // if BOOST_WHATEVER_DECL isn't defined yet define it now:
  115. #ifndef BOOST_DATE_TIME_DECL
  116. # define BOOST_DATE_TIME_DECL
  117. #endif
  118. //
  119. // Automatically link to the correct build variant where possible.
  120. //
  121. #if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_DATE_TIME_NO_LIB) && !defined(BOOST_DATE_TIME_SOURCE)
  122. //
  123. // Set the name of our library, this will get undef'ed by auto_link.hpp
  124. // once it's done with it:
  125. //
  126. #define BOOST_LIB_NAME boost_date_time
  127. //
  128. // If we're importing code from a dll, then tell auto_link.hpp about it:
  129. //
  130. #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_DATE_TIME_DYN_LINK)
  131. # define BOOST_DYN_LINK
  132. #endif
  133. //
  134. // And include the header that does the work:
  135. //
  136. #include <boost/config/auto_link.hpp>
  137. #endif // auto-linking disabled
  138. #if defined(BOOST_HAS_THREADS)
  139. # if defined(_MSC_VER) || defined(__MWERKS__) || defined(__MINGW32__) || defined(__BORLANDC__)
  140. //no reentrant posix functions (eg: localtime_r)
  141. # elif (!defined(__hpux) || (defined(__hpux) && defined(_REENTRANT)))
  142. # define BOOST_DATE_TIME_HAS_REENTRANT_STD_FUNCTIONS
  143. # endif
  144. #endif
  145. #if defined(BOOST_NO_CXX11_NULLPTR)
  146. # define BOOST_DATE_TIME_NULLPTR 0
  147. #else
  148. # define BOOST_DATE_TIME_NULLPTR nullptr
  149. #endif
  150. #endif