From 8fd4bcfa337663daab8327987786e8e923933f69 Mon Sep 17 00:00:00 2001 From: Jan Martin Mikkelsen Date: Mon, 12 Jun 2017 10:46:29 +1000 Subject: [PATCH] Add defined() before #if SYM > val evaluations - Change "#if SYM > x" to "#if defined(SYM) && SYM > x" as a pattern. In StringUtils.h this follows the pattern used earlier in the file. --- runtime/Cpp/runtime/src/antlr4-common.h | 2 +- runtime/Cpp/runtime/src/support/StringUtils.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/Cpp/runtime/src/antlr4-common.h b/runtime/Cpp/runtime/src/antlr4-common.h index 4167caddd..dc0596f1d 100644 --- a/runtime/Cpp/runtime/src/antlr4-common.h +++ b/runtime/Cpp/runtime/src/antlr4-common.h @@ -77,7 +77,7 @@ class ANTLR4CPP_PUBLIC std::exception; // Needed for VS 2015. -#elif __APPLE__ +#elif defined(__APPLE__) typedef std::u32string UTF32String; #define GUID_CFUUID diff --git a/runtime/Cpp/runtime/src/support/StringUtils.h b/runtime/Cpp/runtime/src/support/StringUtils.h index ea1b1d0e1..d0a0472a0 100644 --- a/runtime/Cpp/runtime/src/support/StringUtils.h +++ b/runtime/Cpp/runtime/src/support/StringUtils.h @@ -24,7 +24,7 @@ namespace antlrcpp { // Don't make the converter static or we have to serialize access to it. UTF32Converter converter; - #if _MSC_VER >= 1900 && _MSC_VER < 2000 + #if defined(_MSC_VER) && _MSC_VER >= 1900 && _MSC_VER < 2000 auto p = reinterpret_cast(data.data()); return converter.to_bytes(p, p + data.size()); #else @@ -36,7 +36,7 @@ namespace antlrcpp { { UTF32Converter converter; - #if _MSC_VER >= 1900 && _MSC_VER < 2000 + #if defined(_MSC_VER) && _MSC_VER >= 1900 && _MSC_VER < 2000 auto r = converter.from_bytes(first, last); i32string s = reinterpret_cast(r.data()); #else