final merges for 1.74 (#164)

* Change greg_month and greg_weekday to be not marked as exported/imported (#146)

* Changed greg_month and greg_weekday to be not marked as exported/imported.

Both greg_month and greg_weekday classes are implemented completely in headers,
so they need not be marked with BOOST_DATE_TIME_DECL. For consistency with other
similar classes, they are now marked with BOOST_SYMBOL_VISIBLE.

This should fix linking errors on Windows/MSVC, where all members of greg_month
and greg_weekday classes remain unresolved as they are expected to be
implemented in a shared library.

* Enabled shared and static linking in AppVeyor CI.

* fix new msvc warning in date_parsing with Warn4 - issue #148

* Cast month numbers to the correct type in map init (#152)

Since the map contains unsigned short for month numbers, it is more correct to explicitly cast constants to that type rather than short.

* 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>

* tune: add initial cmake configuration (#151)

* tune: add initial cmake configuration

* bugfix: Incorrect library alias

Co-authored-by: Jeff Garland <jeff@crystalclearsoftware.com>

* Use BOOST_OVERRIDE to fix GCC -Wsuggest-override and Clang-tidy modernize-use-override warnings. (#155)

Also fix Clang -Wextra-semi-stmt and Clang-tidy readability-container-size-empty warnings.
Alphabetical order of STL headers.
Fix some misspellings.

Co-authored-by: Eugene Zelenko <eugene@diakopto.com>

* Break DateTime <-> Serialization circular dependency (#154)

Breaks DateTime -> Serialization -> Spirit -> Thread -> DateTime chain.

The Serialization documentation seems to be explicitly allow this:
https://www.boost.org/doc/libs/1_73_0/libs/serialization/doc/traits.html#version
https://www.boost.org/doc/libs/1_73_0/libs/serialization/doc/serialization.html#splitting

Co-authored-by: Jeff Garland <jeff@crystalclearsoftware.com>

* Fix clang 10 C++17 warnings about deprecated implicit assignment operators. (#158)

C++17 deprecates implicit generation of assignment operator in presence of
explicitly declared copy constructor. In future standards this behavior may
be removed.

In the affected Boost.DateTime classes, the explicitly defined copy
constructors are functionally equivalent to those would be generated
implicitly, so we can just remove them. The additional benefit is that the
implicitly generated ones will have constexpr and noexcept specifications,
and will also allow implicit move constructors and assignment operators.

* Suppress MSVC CRT deprecations on Clang (#160)

Co-authored-by: Jeff Garland <jeff@crystalclearsoftware.com>

* Add BOOST_CXX14_CONSTEXPR to CV assign() (#161)

Without this change the BOOST_CXX14_CONSTEXPR on the constructors has no
effect, as they invoke assign()

Co-authored-by: Jeff Garland <jeff@crystalclearsoftware.com>

* add constexpr tests to date, ptime, constrained_value (#162)

* merge some doc changes for constexpr fix (#163)

* add constexpr tests to date, ptime, constrained_value

* add some docs for 1.74 release

Co-authored-by: Andrey Semashev <Lastique@users.noreply.github.com>
Co-authored-by: Edward Diener <eldlistmailingz@tropicsoft.com>
Co-authored-by: tapika <tapika@yahoo.com>
Co-authored-by: EugeneZelenko <eugene.zelenko@gmail.com>
Co-authored-by: Eugene Zelenko <eugene@diakopto.com>
Co-authored-by: Nikita Kniazev <nok.raven@gmail.com>
Co-authored-by: Roger Orr <rogero@howzatt.co.uk>
This commit is contained in:
Jeff Garland
2020-07-16 09:01:11 -07:00
committed by GitHub
parent ab066e3601
commit fa46e55ca8
6 changed files with 96 additions and 7 deletions

View File

@@ -90,10 +90,13 @@ namespace date_time {
}
#else // BOOST_DATE_TIME_HAS_REENTRANT_STD_FUNCTIONS
#if (defined(_MSC_VER) && (_MSC_VER >= 1400))
#if defined(__clang__) // Clang has to be checked before MSVC
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif (defined(_MSC_VER) && (_MSC_VER >= 1400))
#pragma warning(push) // preserve warning settings
#pragma warning(disable : 4996) // disable depricated localtime/gmtime warning on vc8
#endif // _MSC_VER >= 1400
#endif
//! requires a pointer to a user created std::tm struct
inline
static std::tm* localtime(const std::time_t* t, std::tm* result)
@@ -112,9 +115,11 @@ namespace date_time {
boost::throw_exception(std::runtime_error("could not convert calendar time to UTC time"));
return result;
}
#if (defined(_MSC_VER) && (_MSC_VER >= 1400))
#if defined(__clang__) // Clang has to be checked before MSVC
#pragma clang diagnostic pop
#elif (defined(_MSC_VER) && (_MSC_VER >= 1400))
#pragma warning(pop) // restore warnings to previous state
#endif // _MSC_VER >= 1400
#endif
#endif // BOOST_DATE_TIME_HAS_REENTRANT_STD_FUNCTIONS
};

View File

@@ -65,7 +65,7 @@ namespace CV {
protected:
value_type value_;
private:
void assign(value_type value)
BOOST_CXX14_CONSTEXPR void assign(value_type value)
{
//adding 1 below gets rid of a compiler warning which occurs when the
//min_value is 0 and the type is unsigned....

View File

@@ -34,6 +34,25 @@ main()
date def;
check("Default constructor", def == date(not_a_date_time));
#endif
#ifdef BOOST_NO_CXX14_CONSTEXPR
check("constexpr not configured", true);
#else
//check constexpr case
{
constexpr date d1(1900,1,1);
static_assert(d1.day() == 1, "constexpr construction day()");
static_assert(d1.month() == 1, "constexpr construction month()");
static_assert(d1.year() == 1900, "constexpr construction year()");
constexpr date d2 = date(2000,12,31);
constexpr date d3(d2);
static_assert(d3.day() == 31, "constexpr construct and copy day()");
static_assert(d3.month() == 12, "constexpr construct and copy month()");
static_assert(d3.year() == 2000, "constexpr construct and copy year()");
check("constexpr tests compiled", true);
}
#endif
date d1(1900,1,1);
date d2 = date(2000,1,1);

View File

@@ -29,6 +29,28 @@ void special_values_tests()
}
#endif // DATE_TIME_NO_DEFAULT_CONSTRUCTOR
#ifdef BOOST_NO_CXX14_CONSTEXPR
check("constexpr not configured", true);
#else
//check constexpr case
{
constexpr date d1(1970,1,1);
constexpr ptime t1(d1);
static_assert(t1.date().day() == 1, "constexpr construction day()");
static_assert(t1.date().month() == 1, "constexpr construction month()");
static_assert(t1.date().year() == 1970, "constexpr construction year()");
static_assert(t1.time_of_day().hours() == 0, "constexpr construction hour()");
static_assert(t1.time_of_day().minutes() == 0, "constexpr construction minute()");
static_assert(t1.time_of_day().seconds() == 0, "constexpr construction second()");
constexpr ptime t2(d1, time_duration(1,2,3));
static_assert(t2.time_of_day().hours() == 1, "constexpr contruct with duration hour()");
static_assert(t2.time_of_day().minutes() == 2, "constexpr contruct with duration minute()");
static_assert(t2.time_of_day().seconds() == 3, "constexpr contruct with duration second()");
check("constexpr tests compiled", true);
}
#endif
{ // special values construction tests
ptime p_sv1(pos_infin);
std::string s("+infinity");

View File

@@ -17,8 +17,8 @@ class day_value_policies
{
public:
typedef unsigned int value_type;
static unsigned int min BOOST_PREVENT_MACRO_SUBSTITUTION () { return 0; };
static unsigned int max BOOST_PREVENT_MACRO_SUBSTITUTION () { return 31;};
static BOOST_CXX14_CONSTEXPR unsigned int min BOOST_PREVENT_MACRO_SUBSTITUTION () { return 0; };
static BOOST_CXX14_CONSTEXPR unsigned int max BOOST_PREVENT_MACRO_SUBSTITUTION () { return 31;};
static void on_error(unsigned int&, unsigned int, boost::CV::violation_enum)
{
throw bad_day();
@@ -41,6 +41,14 @@ int main()
unsigned int i = cv1;
check("test conversion", i == cv1);
#ifdef BOOST_NO_CXX14_CONSTEXPR
check("constexpr not configured", true);
#else
//check constexpr case
constexpr constrained_value<day_value_policies> cv3(1);
static_assert(cv3 == 1, "constexpr construction/conversion");
check("constexpr constrained value construct and equal", true);
#endif
try {
constrained_value<one_to_ten_range_policy> cv3(11);

View File

@@ -12,6 +12,41 @@
<!-- if each new change tgroup has a "Bug Fix" as the first "Type", the columns will line up nicely -->
<bridgehead renderas="sect3">Changes from Boost 1.73 to 1.74 </bridgehead>
<informaltable frame="all">
<tgroup cols="2">
<thead>
<row>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>Bug-Fix</entry>
<entry>
Fix constrained_value::assign to be constexpr so ptime and date construction are constexpr. See:
<ulink url="https://github.com/boostorg/date_time/pull/161">pull 161</ulink> and
<ulink url="https://github.com/boostorg/date_time/pull/162">pull 161</ulink>.
</entry>
</row>
<row>
<entry>Bug-Fix</entry>
<entry>
Suppress MSVC CRT deprecations on Clang. See:
<ulink url="https://github.com/boostorg/date_time/pull/160">pull 160</ulink>.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<bridgehead renderas="sect3">Changes from Boost 1.72 to 1.73 </bridgehead>
<informaltable frame="all">
<tgroup cols="2">