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