compiler_config.hpp 5.5 KB

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