mirror of
https://github.com/boostorg/date_time.git
synced 2026-01-19 04:12:07 +00:00
Changes for Embarcadero C++ clang-based compilers, targeting Boost 1.74 (#150)
* Change __BORLANDC__ to BOOST_BORLANDC, which is defined in Boost config for the Embarcadero non-clang-based compilers.
* Change BOOST_BORLANDC back to __BORLANDC__ for non-posix functionality.
* Include the header file.
* Inline friend function definitions for exported/imported classes must become declarations and inline definitions outside the class for Embarcadero C++ clang-based compilers. This bug has been reported to Embarcadero.
* Revert "Inline friend function definitions for exported/imported classes must become declarations and inline definitions outside the class for Embarcadero C++ clang-based compilers. This bug has been reported to Embarcadero."
This reverts commit 88e45e951b.
* Inline friend function definitions for exported/imported classes must become declarations and inline definitions outside the class for Embarcadero C++ clang-based compilers. This bug has been reported to Embarcadero.
* Remove separate outside of template class friend functions.
* Define all the friend functions outside the class to conform with the necessity of Embarcadero C++ clang-based compilers that need the friend functions in exported/imported classes to be defined outside the class. This is an Embarcadero C++ clang-based compiler bug which i reported to Embarcadero.
Co-authored-by: Jeff Garland <jeff@crystalclearsoftware.com>
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
#undef BOOST_DATE_TIME_OPTIONAL_GREGORIAN_TYPES
|
||||
#endif
|
||||
|
||||
#if (defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION) || BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x581) ) )
|
||||
#if (defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION) || BOOST_WORKAROUND( BOOST_BORLANDC, BOOST_TESTED_AT(0x581) ) )
|
||||
#define BOOST_DATE_TIME_NO_MEMBER_INIT
|
||||
#endif
|
||||
|
||||
@@ -47,13 +47,13 @@
|
||||
|
||||
|
||||
/* Workaround for Borland iterator error. Error was "Cannot convert 'istream *' to 'wistream *' in function istream_iterator<>::istream_iterator() */
|
||||
#if defined(__BORLANDC__) && defined(BOOST_BCB_WITH_RW_LIB)
|
||||
#if defined(BOOST_BORLANDC) && defined(BOOST_BCB_WITH_RW_LIB)
|
||||
#define BOOST_DATE_TIME_NO_WISTREAM_ITERATOR
|
||||
#endif
|
||||
|
||||
|
||||
// Borland v5.64 does not have the following in std namespace; v5.5.1 does
|
||||
#if defined(__BORLANDC__) && defined(BOOST_BCB_WITH_STLPORT)
|
||||
#if defined(BOOST_BORLANDC) && defined(BOOST_BCB_WITH_STLPORT)
|
||||
#include <locale>
|
||||
namespace std {
|
||||
using stlport::tolower;
|
||||
@@ -70,7 +70,7 @@ namespace std {
|
||||
#if (((defined(__GNUC__) && (__GNUC__ < 3)) || \
|
||||
(defined(_MSC_VER) && (_MSC_VER < 1300)) ) && \
|
||||
!defined(_STLP_OWN_IOSTREAMS) ) || \
|
||||
BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x581) )
|
||||
BOOST_WORKAROUND( BOOST_BORLANDC, BOOST_TESTED_AT(0x581) )
|
||||
#define BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS
|
||||
#endif
|
||||
|
||||
|
||||
@@ -128,7 +128,6 @@ namespace date_time {
|
||||
_m = _m - y.number_of_years() * 12;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//
|
||||
BOOST_CXX14_CONSTEXPR friend date_type operator+(const date_type& d, const months_type& m)
|
||||
{
|
||||
@@ -148,7 +147,6 @@ namespace date_time {
|
||||
// get_neg_offset returns a negative duration, so we add
|
||||
return d += m.get_neg_offset(d);
|
||||
}
|
||||
|
||||
private:
|
||||
int_rep _m;
|
||||
};
|
||||
@@ -240,7 +238,6 @@ namespace date_time {
|
||||
{
|
||||
return(months_type(_y * 12 - m.number_of_months()));
|
||||
}
|
||||
|
||||
//
|
||||
BOOST_CXX14_CONSTEXPR friend date_type operator+(const date_type& d, const years_type& y)
|
||||
{
|
||||
@@ -260,11 +257,9 @@ namespace date_time {
|
||||
// get_neg_offset returns a negative duration, so we add
|
||||
return d += y.get_neg_offset(d);
|
||||
}
|
||||
|
||||
private:
|
||||
int_rep _y;
|
||||
};
|
||||
|
||||
}} // namespace boost::date_time
|
||||
|
||||
#endif // DATE_DURATION_TYPES_HPP___
|
||||
|
||||
@@ -84,12 +84,9 @@ namespace gregorian {
|
||||
base_type::operator-= (rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
BOOST_CXX14_CONSTEXPR friend
|
||||
date_duration operator- (date_duration rhs, date_duration const& lhs)
|
||||
{
|
||||
rhs -= lhs;
|
||||
return rhs;
|
||||
}
|
||||
date_duration operator- (date_duration rhs, date_duration const& lhs);
|
||||
|
||||
//! Add a duration -- result is signed
|
||||
BOOST_CXX14_CONSTEXPR date_duration& operator+= (const date_duration& rhs)
|
||||
@@ -97,12 +94,9 @@ namespace gregorian {
|
||||
base_type::operator+= (rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
BOOST_CXX14_CONSTEXPR friend
|
||||
date_duration operator+ (date_duration rhs, date_duration const& lhs)
|
||||
{
|
||||
rhs += lhs;
|
||||
return rhs;
|
||||
}
|
||||
date_duration operator+ (date_duration rhs, date_duration const& lhs);
|
||||
|
||||
//! unary- Allows for dd = -date_duration(2); -> dd == -2
|
||||
BOOST_CXX14_CONSTEXPR date_duration operator- ()const
|
||||
@@ -116,11 +110,8 @@ namespace gregorian {
|
||||
base_type::operator/= (divisor);
|
||||
return *this;
|
||||
}
|
||||
BOOST_CXX14_CONSTEXPR friend date_duration operator/ (date_duration rhs, int lhs)
|
||||
{
|
||||
rhs /= lhs;
|
||||
return rhs;
|
||||
}
|
||||
|
||||
BOOST_CXX14_CONSTEXPR friend date_duration operator/ (date_duration rhs, int lhs);
|
||||
|
||||
//! Returns the smallest duration -- used by to calculate 'end'
|
||||
static BOOST_CXX14_CONSTEXPR date_duration unit()
|
||||
@@ -129,6 +120,26 @@ namespace gregorian {
|
||||
}
|
||||
};
|
||||
|
||||
inline BOOST_CXX14_CONSTEXPR
|
||||
date_duration operator- (date_duration rhs, date_duration const& lhs)
|
||||
{
|
||||
rhs -= lhs;
|
||||
return rhs;
|
||||
}
|
||||
|
||||
inline BOOST_CXX14_CONSTEXPR
|
||||
date_duration operator+ (date_duration rhs, date_duration const& lhs)
|
||||
{
|
||||
rhs += lhs;
|
||||
return rhs;
|
||||
}
|
||||
|
||||
inline BOOST_CXX14_CONSTEXPR date_duration operator/ (date_duration rhs, int lhs)
|
||||
{
|
||||
rhs /= lhs;
|
||||
return rhs;
|
||||
}
|
||||
|
||||
//! Shorthand for date_duration
|
||||
typedef date_duration days;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//This file basically becomes a noop if locales are not properly supported
|
||||
#if (defined(BOOST_NO_STD_LOCALE) \
|
||||
|| (BOOST_WORKAROUND( BOOST_MSVC, < 1300)) \
|
||||
|| (BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x581 )) ) \
|
||||
|| (BOOST_WORKAROUND( BOOST_BORLANDC, BOOST_TESTED_AT( 0x581 )) ) \
|
||||
|| (BOOST_WORKAROUND( BOOST_XLCPP_ZOS, BOOST_TESTED_AT( 0x42010000 )) ) /* <cctype> "shadows" the locale enabled overloads from <locale> */ \
|
||||
)
|
||||
#define BOOST_DATE_TIME_NO_LOCALE
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <iterator>
|
||||
#include "boost/date_time/special_defs.hpp"
|
||||
|
||||
namespace boost { namespace date_time {
|
||||
|
||||
@@ -84,7 +84,7 @@ operator<<(std::basic_ostream<charT>& os, parse_match_result<charT>& mr)
|
||||
template<typename charT>
|
||||
struct string_parse_tree
|
||||
{
|
||||
#if BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x581) )
|
||||
#if BOOST_WORKAROUND( BOOST_BORLANDC, BOOST_TESTED_AT(0x581) )
|
||||
typedef std::multimap<charT, string_parse_tree< charT> > ptree_coll;
|
||||
#else
|
||||
typedef std::multimap<charT, string_parse_tree > ptree_coll;
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace date_time {
|
||||
private:
|
||||
BOOST_STATIC_CONSTANT(int_type, ticks_per_day = INT64_C(86400) * config::tick_per_second);
|
||||
public:
|
||||
# if BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0X581) )
|
||||
# if BOOST_WORKAROUND( BOOST_BORLANDC, BOOST_TESTED_AT(0X581) )
|
||||
typedef date_time::wrapping_int< split_timedate_system::int_type, split_timedate_system::ticks_per_day> wrap_int_type;
|
||||
# else
|
||||
typedef date_time::wrapping_int<int_type, ticks_per_day> wrap_int_type;
|
||||
|
||||
Reference in New Issue
Block a user