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