compiler_config.hpp 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. #if (defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION) || BOOST_WORKAROUND( BOOST_BORLANDC, BOOST_TESTED_AT(0x581) ) )
  24. #define BOOST_DATE_TIME_NO_MEMBER_INIT
  25. #endif
  26. // include these types before we try to re-define them
  27. #include <boost/cstdint.hpp>
  28. //Define INT64_C for compilers that don't have it
  29. #if (!defined(INT64_C))
  30. #define INT64_C(value) int64_t(value)
  31. #endif
  32. /* Workaround for Borland iterator error. Error was "Cannot convert 'istream *' to 'wistream *' in function istream_iterator<>::istream_iterator() */
  33. #if defined(BOOST_BORLANDC) && defined(BOOST_BCB_WITH_RW_LIB)
  34. #define BOOST_DATE_TIME_NO_WISTREAM_ITERATOR
  35. #endif
  36. // Borland v5.64 does not have the following in std namespace; v5.5.1 does
  37. #if defined(BOOST_BORLANDC) && defined(BOOST_BCB_WITH_STLPORT)
  38. #include <locale>
  39. namespace std {
  40. using stlport::tolower;
  41. using stlport::ctype;
  42. using stlport::use_facet;
  43. }
  44. #endif
  45. // workaround for errors associated with output for date classes
  46. // modifications and input streaming for time classes.
  47. // Compilers affected are:
  48. // gcc295, msvc (neither with STLPort), any borland
  49. //
  50. #if (((defined(__GNUC__) && (__GNUC__ < 3)) || \
  51. (defined(_MSC_VER) && (_MSC_VER < 1300)) ) && \
  52. !defined(_STLP_OWN_IOSTREAMS) ) || \
  53. BOOST_WORKAROUND( BOOST_BORLANDC, BOOST_TESTED_AT(0x581) )
  54. #define BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS
  55. #endif
  56. // The macro marks up places where compiler complains for missing return statement or
  57. // uninitialized variables after calling to boost::throw_exception.
  58. // BOOST_UNREACHABLE_RETURN doesn't work since even compilers that support
  59. // unreachable statements detection emit such warnings.
  60. #if defined(_MSC_VER)
  61. // Use special MSVC extension to markup unreachable code
  62. # define BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(x) __assume(false)
  63. #elif !defined(BOOST_NO_UNREACHABLE_RETURN_DETECTION)
  64. // Call to a non-returning function should suppress the warning
  65. # if defined(BOOST_NO_STDC_NAMESPACE)
  66. namespace std {
  67. using ::abort;
  68. }
  69. # endif // defined(BOOST_NO_STDC_NAMESPACE)
  70. # define BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(x) std::abort()
  71. #else
  72. // For other poor compilers the specified expression is compiled. Usually, this would be a return statement.
  73. # define BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(x) x
  74. #endif
  75. /* The following handles the definition of the necessary macros
  76. * for dll building on Win32 platforms.
  77. *
  78. * For code that will be placed in the date_time .dll,
  79. * it must be properly prefixed with BOOST_DATE_TIME_DECL.
  80. * The corresponding .cpp file must have BOOST_DATE_TIME_SOURCE
  81. * defined before including its header. For examples see:
  82. * greg_month.hpp & greg_month.cpp
  83. *
  84. */
  85. // we need to import/export our code only if the user has specifically
  86. // asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost
  87. // libraries to be dynamically linked, or BOOST_DATE_TIME_DYN_LINK
  88. // if they want just this one to be dynamically liked:
  89. #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_DATE_TIME_DYN_LINK)
  90. // export if this is our own source, otherwise import:
  91. # ifdef BOOST_DATE_TIME_SOURCE
  92. # define BOOST_DATE_TIME_DECL BOOST_SYMBOL_EXPORT
  93. # else
  94. # define BOOST_DATE_TIME_DECL BOOST_SYMBOL_IMPORT
  95. # endif // BOOST_DATE_TIME_SOURCE
  96. #endif // DYN_LINK
  97. //
  98. // if BOOST_WHATEVER_DECL isn't defined yet define it now:
  99. #ifndef BOOST_DATE_TIME_DECL
  100. # define BOOST_DATE_TIME_DECL
  101. #endif
  102. #if defined(BOOST_HAS_THREADS)
  103. # if defined(_MSC_VER) || defined(__MWERKS__) || defined(__MINGW32__) || defined(__BORLANDC__)
  104. //no reentrant posix functions (eg: localtime_r)
  105. # elif (!defined(__hpux) || (defined(__hpux) && defined(_REENTRANT)))
  106. # define BOOST_DATE_TIME_HAS_REENTRANT_STD_FUNCTIONS
  107. # endif
  108. #endif
  109. #if defined(BOOST_NO_CXX11_NULLPTR)
  110. # define BOOST_DATE_TIME_NULLPTR 0
  111. #else
  112. # define BOOST_DATE_TIME_NULLPTR nullptr
  113. #endif
  114. #endif