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