Enable the c++14 CONSTDATA code path for VS2017 and fix const const warning.

This commit is contained in:
gm
2017-01-01 18:01:20 +13:00
parent 6889dc69fb
commit 07d9e8a0fe
2 changed files with 6 additions and 6 deletions

6
date.h
View File

@@ -60,15 +60,15 @@ namespace date
// MSVC's constexpr support is still a WIP, even in VS2015. // MSVC's constexpr support is still a WIP, even in VS2015.
// Fall back to a lesser mode to support it. // Fall back to a lesser mode to support it.
// TODO: Remove this or retest later once MSVC's constexpr improves. // TODO: Remove this or retest later once MSVC's constexpr improves.
#if defined(_MSC_VER) && ! defined(__clang__) #if defined(_MSC_VER) && _MSC_VER <= 1900 && ! defined(__clang__)
// MS cl compiler. // MS cl compiler pre VS2017
# define CONSTDATA const # define CONSTDATA const
# define CONSTCD11 # define CONSTCD11
# define CONSTCD14 # define CONSTCD14
# define NOEXCEPT _NOEXCEPT # define NOEXCEPT _NOEXCEPT
#elif __cplusplus >= 201402 #elif __cplusplus >= 201402
// C++14 // C++14
# define CONSTDATA constexpr # define CONSTDATA constexpr const
# define CONSTCD11 constexpr # define CONSTCD11 constexpr
# define CONSTCD14 constexpr # define CONSTCD14 constexpr
# define NOEXCEPT noexcept # define NOEXCEPT noexcept

6
tz.cpp
View File

@@ -724,7 +724,7 @@ static
unsigned unsigned
parse_dow(std::istream& in) parse_dow(std::istream& in)
{ {
const char*const dow_names[] = CONSTDATA char*const dow_names[] =
{"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
auto s = parse3(in); auto s = parse3(in);
auto dow = std::find(std::begin(dow_names), std::end(dow_names), s) - dow_names; auto dow = std::find(std::begin(dow_names), std::end(dow_names), s) - dow_names;
@@ -737,7 +737,7 @@ static
unsigned unsigned
parse_month(std::istream& in) parse_month(std::istream& in)
{ {
const char*const month_names[] = CONSTDATA char*const month_names[] =
{"Jan", "Feb", "Mar", "Apr", "May", "Jun", {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
auto s = parse3(in); auto s = parse3(in);
@@ -2800,7 +2800,7 @@ init_tzdb()
db.version = get_version(path); db.version = get_version(path);
#endif // !AUTO_DOWNLOAD #endif // !AUTO_DOWNLOAD
CONSTDATA const char* files[] = CONSTDATA char*const files[] =
{ {
"africa", "antarctica", "asia", "australasia", "backward", "etcetera", "europe", "africa", "antarctica", "asia", "australasia", "backward", "etcetera", "europe",
"pacificnew", "northamerica", "southamerica", "systemv", "leapseconds" "pacificnew", "northamerica", "southamerica", "systemv", "leapseconds"