aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-03-13 00:38:34 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-03-13 13:58:03 +0300
commita82ec3c21ac680e5bf9614bdcf50ea78a52542ce (patch)
tree343ac89888ac8e4eca5899d0cec7f2cb512aee64
parent83ee2939cb9b6766bbf0df60347be2da6d6f0adf (diff)
Add workarounds for all cl releases until 20.00
-rw-r--r--libbutl/manifest-rewriter.cxx8
-rw-r--r--libbutl/regex.cxx4
-rw-r--r--libbutl/standard-version.ixx3
-rw-r--r--tests/base64/driver.cxx2
-rw-r--r--tests/timestamp/driver.cxx4
5 files changed, 14 insertions, 7 deletions
diff --git a/libbutl/manifest-rewriter.cxx b/libbutl/manifest-rewriter.cxx
index f504c35..2be53f1 100644
--- a/libbutl/manifest-rewriter.cxx
+++ b/libbutl/manifest-rewriter.cxx
@@ -13,6 +13,7 @@
#ifndef __cpp_lib_modules
#include <string>
#include <cstdint> // uint64_t
+#include <cstddef> // size_t
#endif
// Other includes.
@@ -99,7 +100,9 @@ namespace butl
os << ' ';
manifest_serializer s (os, path_.string ());
- s.write_value (nv.value, nv.colon_pos - nv.start_pos + 2);
+
+ s.write_value (nv.value,
+ static_cast<size_t> (nv.colon_pos - nv.start_pos + 2));
}
os << suffix;
@@ -132,7 +135,8 @@ namespace butl
if (!nv.value.empty ())
{
os << ' ';
- s.write_value (nv.value, nv.colon_pos - nv.start_pos + 2);
+ s.write_value (nv.value,
+ static_cast<size_t> (nv.colon_pos - nv.start_pos + 2));
}
os << suffix;
diff --git a/libbutl/regex.cxx b/libbutl/regex.cxx
index f988193..ab32693 100644
--- a/libbutl/regex.cxx
+++ b/libbutl/regex.cxx
@@ -15,7 +15,7 @@
#include <ostream>
#include <sstream>
#include <stdexcept> // runtime_error
-#if defined(_MSC_VER) && _MSC_VER < 1920
+#if defined(_MSC_VER) && _MSC_VER < 2000
# include <cstring> // strstr()
#endif
#endif
@@ -52,7 +52,7 @@ namespace std
{
const char* d (e.what ());
-#if defined(_MSC_VER) && _MSC_VER < 1920
+#if defined(_MSC_VER) && _MSC_VER < 2000
// Note: run the regex test like this to check new VC version:
//
// ./driver.exe a '{' b
diff --git a/libbutl/standard-version.ixx b/libbutl/standard-version.ixx
index c0833c4..6142586 100644
--- a/libbutl/standard-version.ixx
+++ b/libbutl/standard-version.ixx
@@ -51,7 +51,8 @@ namespace butl
{
return release () || stub ()
? nullopt
- : optional<std::uint16_t> (version / 10 % 1000);
+ : optional<std::uint16_t> (
+ static_cast<std::uint16_t> (version / 10 % 1000));
}
inline optional<std::uint16_t> standard_version::
diff --git a/tests/base64/driver.cxx b/tests/base64/driver.cxx
index 7870424..7746637 100644
--- a/tests/base64/driver.cxx
+++ b/tests/base64/driver.cxx
@@ -44,6 +44,8 @@ encode (const string& i, const string& o)
is.clear ();
#endif
+ assert (!is.eof ());
+
ostringstream os;
base64_encode (os, is);
r = os.str () == o && is.eof ();
diff --git a/tests/timestamp/driver.cxx b/tests/timestamp/driver.cxx
index c8e5051..198c745 100644
--- a/tests/timestamp/driver.cxx
+++ b/tests/timestamp/driver.cxx
@@ -128,12 +128,12 @@ main ()
//
assert (fail ("Apr 08 19:31:10.123456789 ABC", "%b %d %H:%M:%S%[.N] %Y"));
-// This doesn't work in VC15 because their implementation of std::get_time()
+// This doesn't work in VC16 because their implementation of std::get_time()
// has a bug. Due to this bug std::get_time() parses the input
// "Apr 19:31:10 2016" for the format "%b %d %H:%M:%S %Y" as if the input were
// "Apr 19 00:31:10 2016".
//
-#if !defined(_MSC_VER) || _MSC_VER >= 1920
+#if !defined(_MSC_VER) || _MSC_VER >= 2000
assert (fail ("Apr 19:31:10 2016", "%b %d %H:%M:%S %Y"));
assert (fail (":31 2016", "%H:%M %Y"));
#endif