vcpkg/ports/antlr4/Fix-building-in-Visual-Studio-2017.patch
2017-03-21 20:53:26 -07:00

53 lines
2.1 KiB
Diff

diff --git a/runtime/src/ANTLRInputStream.h b/runtime/src/ANTLRInputStream.h
index 3d85bed..813451c 100644
--- a/runtime/src/ANTLRInputStream.h
+++ b/runtime/src/ANTLRInputStream.h
@@ -16,7 +16,7 @@ namespace antlr4 {
protected:
/// The data being scanned.
// UTF-32
-#if defined(_MSC_VER) && _MSC_VER == 1900
+#if defined(_MSC_VER) && _MSC_VER >= 1900
i32string _data; // Custom type for VS 2015.
#else
std::u32string _data;
diff --git a/runtime/src/UnbufferedCharStream.h b/runtime/src/UnbufferedCharStream.h
index b489f18..295804c 100644
--- a/runtime/src/UnbufferedCharStream.h
+++ b/runtime/src/UnbufferedCharStream.h
@@ -52,7 +52,7 @@ namespace antlr4 {
/// we keep adding to buffer. Otherwise, <seealso cref="#consume consume()"/> resets so
/// we start filling at index 0 again.
// UTF-32 encoded.
-#if defined(_MSC_VER) && _MSC_VER == 1900
+#if defined(_MSC_VER) && _MSC_VER >= 1900
i32string _data; // Custom type for VS 2015.
#else
std::u32string _data;
diff --git a/runtime/src/antlr4-common.h b/runtime/src/antlr4-common.h
index 197fd6d..8357b3e 100644
--- a/runtime/src/antlr4-common.h
+++ b/runtime/src/antlr4-common.h
@@ -52,7 +52,7 @@
typedef __int32 ssize_t;
#endif
- #if _MSC_VER == 1900
+ #if _MSC_VER >= 1900
// VS 2015 has a known bug when using std::codecvt_utf8<char32_t>
// so we have to temporarily use __int32 instead.
// https://connect.microsoft.com/VisualStudio/feedback/details/1403302/unresolved-external-when-using-codecvt-utf8
diff --git a/runtime/src/support/StringUtils.h b/runtime/src/support/StringUtils.h
index cb751a7..be14bbb 100644
--- a/runtime/src/support/StringUtils.h
+++ b/runtime/src/support/StringUtils.h
@@ -10,7 +10,7 @@
namespace antlrcpp {
// For all conversions utf8 <-> utf32.
// VS 2015 has a bug in std::codecvt_utf8<char32_t> (VS 2013 works fine).
-#if defined(_MSC_VER) && _MSC_VER == 1900
+#if defined(_MSC_VER) && _MSC_VER >= 1900
static std::wstring_convert<std::codecvt_utf8<__int32>, __int32> utfConverter;
#else
static std::wstring_convert<std::codecvt_utf8<char32_t>, char32_t> utfConverter;