Visual Studio build fixes for previous C++ patch.

VS 2013 doesn't accept certain C++11 constants like std::numeric_limits, so we have to return to the code used before that mentioned patch.
This commit is contained in:
Mike Lischke 2017-07-02 14:29:54 +02:00
parent f33fca6789
commit b7060ba1f5
13 changed files with 130 additions and 15 deletions

View File

@ -321,6 +321,8 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\ANTLRErrorListener.cpp" />
<ClCompile Include="src\ANTLRErrorStrategy.cpp" />
<ClCompile Include="src\ANTLRFileStream.cpp" />
<ClCompile Include="src\ANTLRInputStream.cpp" />
<ClCompile Include="src\atn\AbstractPredicateTransition.cpp" />
@ -339,6 +341,7 @@
<ClCompile Include="src\atn\BasicBlockStartState.cpp" />
<ClCompile Include="src\atn\BasicState.cpp" />
<ClCompile Include="src\atn\BlockEndState.cpp" />
<ClCompile Include="src\atn\BlockStartState.cpp" />
<ClCompile Include="src\atn\ContextSensitivityInfo.cpp" />
<ClCompile Include="src\atn\DecisionEventInfo.cpp" />
<ClCompile Include="src\atn\DecisionInfo.cpp" />
@ -346,6 +349,7 @@
<ClCompile Include="src\atn\EmptyPredictionContext.cpp" />
<ClCompile Include="src\atn\EpsilonTransition.cpp" />
<ClCompile Include="src\atn\ErrorInfo.cpp" />
<ClCompile Include="src\atn\LexerAction.cpp" />
<ClCompile Include="src\atn\LexerActionExecutor.cpp" />
<ClCompile Include="src\atn\LexerATNConfig.cpp" />
<ClCompile Include="src\atn\LexerATNSimulator.cpp" />
@ -412,6 +416,7 @@
<ClCompile Include="src\misc\Interval.cpp" />
<ClCompile Include="src\misc\IntervalSet.cpp" />
<ClCompile Include="src\misc\MurmurHash.cpp" />
<ClCompile Include="src\misc\Predicate.cpp" />
<ClCompile Include="src\NoViableAltException.cpp" />
<ClCompile Include="src\Parser.cpp" />
<ClCompile Include="src\ParserInterpreter.cpp" />
@ -422,16 +427,23 @@
<ClCompile Include="src\RuleContext.cpp" />
<ClCompile Include="src\RuleContextWithAltNum.cpp" />
<ClCompile Include="src\RuntimeMetaData.cpp" />
<ClCompile Include="src\support\Any.cpp" />
<ClCompile Include="src\support\Arrays.cpp" />
<ClCompile Include="src\support\CPPUtils.cpp" />
<ClCompile Include="src\support\guid.cpp" />
<ClCompile Include="src\support\StringUtils.cpp" />
<ClCompile Include="src\Token.cpp" />
<ClCompile Include="src\TokenSource.cpp" />
<ClCompile Include="src\TokenStream.cpp" />
<ClCompile Include="src\TokenStreamRewriter.cpp" />
<ClCompile Include="src\tree\ErrorNode.cpp" />
<ClCompile Include="src\tree\ErrorNodeImpl.cpp" />
<ClCompile Include="src\tree\IterativeParseTreeWalker.cpp" />
<ClCompile Include="src\tree\ParseTree.cpp" />
<ClCompile Include="src\tree\ParseTreeListener.cpp" />
<ClCompile Include="src\tree\ParseTreeVisitor.cpp" />
<ClCompile Include="src\tree\ParseTreeWalker.cpp" />
<ClCompile Include="src\tree\pattern\Chunk.cpp" />
<ClCompile Include="src\tree\pattern\ParseTreeMatch.cpp" />
<ClCompile Include="src\tree\pattern\ParseTreePattern.cpp" />
<ClCompile Include="src\tree\pattern\ParseTreePatternMatcher.cpp" />
@ -439,6 +451,7 @@
<ClCompile Include="src\tree\pattern\TagChunk.cpp" />
<ClCompile Include="src\tree\pattern\TextChunk.cpp" />
<ClCompile Include="src\tree\pattern\TokenTagToken.cpp" />
<ClCompile Include="src\tree\TerminalNode.cpp" />
<ClCompile Include="src\tree\TerminalNodeImpl.cpp" />
<ClCompile Include="src\tree\Trees.cpp" />
<ClCompile Include="src\tree\xpath\XPath.cpp" />
@ -454,6 +467,7 @@
<ClCompile Include="src\UnbufferedCharStream.cpp" />
<ClCompile Include="src\UnbufferedTokenStream.cpp" />
<ClCompile Include="src\Vocabulary.cpp" />
<ClCompile Include="src\WritableToken.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\antlr4-common.h" />
@ -620,4 +634,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@ -938,5 +938,47 @@
<ClCompile Include="src\tree\IterativeParseTreeWalker.cpp">
<Filter>Source Files\tree</Filter>
</ClCompile>
<ClCompile Include="src\ANTLRErrorListener.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\ANTLRErrorStrategy.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Token.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\TokenSource.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\WritableToken.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\tree\ErrorNode.cpp">
<Filter>Source Files\tree</Filter>
</ClCompile>
<ClCompile Include="src\tree\ParseTreeListener.cpp">
<Filter>Source Files\tree</Filter>
</ClCompile>
<ClCompile Include="src\tree\ParseTreeVisitor.cpp">
<Filter>Source Files\tree</Filter>
</ClCompile>
<ClCompile Include="src\tree\TerminalNode.cpp">
<Filter>Source Files\tree</Filter>
</ClCompile>
<ClCompile Include="src\support\Any.cpp">
<Filter>Source Files\support</Filter>
</ClCompile>
<ClCompile Include="src\atn\BlockStartState.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\LexerAction.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\tree\pattern\Chunk.cpp">
<Filter>Source Files\tree\pattern</Filter>
</ClCompile>
<ClCompile Include="src\misc\Predicate.cpp">
<Filter>Source Files\misc</Filter>
</ClCompile>
</ItemGroup>
</Project>
</Project>

View File

@ -334,6 +334,8 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\ANTLRErrorListener.cpp" />
<ClCompile Include="src\ANTLRErrorStrategy.cpp" />
<ClCompile Include="src\ANTLRFileStream.cpp" />
<ClCompile Include="src\ANTLRInputStream.cpp" />
<ClCompile Include="src\atn\AbstractPredicateTransition.cpp" />
@ -352,6 +354,7 @@
<ClCompile Include="src\atn\BasicBlockStartState.cpp" />
<ClCompile Include="src\atn\BasicState.cpp" />
<ClCompile Include="src\atn\BlockEndState.cpp" />
<ClCompile Include="src\atn\BlockStartState.cpp" />
<ClCompile Include="src\atn\ContextSensitivityInfo.cpp" />
<ClCompile Include="src\atn\DecisionEventInfo.cpp" />
<ClCompile Include="src\atn\DecisionInfo.cpp" />
@ -359,6 +362,7 @@
<ClCompile Include="src\atn\EmptyPredictionContext.cpp" />
<ClCompile Include="src\atn\EpsilonTransition.cpp" />
<ClCompile Include="src\atn\ErrorInfo.cpp" />
<ClCompile Include="src\atn\LexerAction.cpp" />
<ClCompile Include="src\atn\LexerActionExecutor.cpp" />
<ClCompile Include="src\atn\LexerATNConfig.cpp" />
<ClCompile Include="src\atn\LexerATNSimulator.cpp" />
@ -425,6 +429,7 @@
<ClCompile Include="src\misc\Interval.cpp" />
<ClCompile Include="src\misc\IntervalSet.cpp" />
<ClCompile Include="src\misc\MurmurHash.cpp" />
<ClCompile Include="src\misc\Predicate.cpp" />
<ClCompile Include="src\NoViableAltException.cpp" />
<ClCompile Include="src\Parser.cpp" />
<ClCompile Include="src\ParserInterpreter.cpp" />
@ -435,16 +440,23 @@
<ClCompile Include="src\RuleContext.cpp" />
<ClCompile Include="src\RuleContextWithAltNum.cpp" />
<ClCompile Include="src\RuntimeMetaData.cpp" />
<ClCompile Include="src\support\Any.cpp" />
<ClCompile Include="src\support\Arrays.cpp" />
<ClCompile Include="src\support\CPPUtils.cpp" />
<ClCompile Include="src\support\guid.cpp" />
<ClCompile Include="src\support\StringUtils.cpp" />
<ClCompile Include="src\Token.cpp" />
<ClCompile Include="src\TokenSource.cpp" />
<ClCompile Include="src\TokenStream.cpp" />
<ClCompile Include="src\TokenStreamRewriter.cpp" />
<ClCompile Include="src\tree\ErrorNode.cpp" />
<ClCompile Include="src\tree\ErrorNodeImpl.cpp" />
<ClCompile Include="src\tree\IterativeParseTreeWalker.cpp" />
<ClCompile Include="src\tree\ParseTree.cpp" />
<ClCompile Include="src\tree\ParseTreeListener.cpp" />
<ClCompile Include="src\tree\ParseTreeVisitor.cpp" />
<ClCompile Include="src\tree\ParseTreeWalker.cpp" />
<ClCompile Include="src\tree\pattern\Chunk.cpp" />
<ClCompile Include="src\tree\pattern\ParseTreeMatch.cpp" />
<ClCompile Include="src\tree\pattern\ParseTreePattern.cpp" />
<ClCompile Include="src\tree\pattern\ParseTreePatternMatcher.cpp" />
@ -452,6 +464,7 @@
<ClCompile Include="src\tree\pattern\TagChunk.cpp" />
<ClCompile Include="src\tree\pattern\TextChunk.cpp" />
<ClCompile Include="src\tree\pattern\TokenTagToken.cpp" />
<ClCompile Include="src\tree\TerminalNode.cpp" />
<ClCompile Include="src\tree\TerminalNodeImpl.cpp" />
<ClCompile Include="src\tree\Trees.cpp" />
<ClCompile Include="src\tree\xpath\XPath.cpp" />
@ -467,6 +480,7 @@
<ClCompile Include="src\UnbufferedCharStream.cpp" />
<ClCompile Include="src\UnbufferedTokenStream.cpp" />
<ClCompile Include="src\Vocabulary.cpp" />
<ClCompile Include="src\WritableToken.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\antlr4-common.h" />
@ -633,4 +647,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@ -938,5 +938,47 @@
<ClCompile Include="src\tree\IterativeParseTreeWalker.cpp">
<Filter>Source Files\tree</Filter>
</ClCompile>
<ClCompile Include="src\ANTLRErrorListener.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\ANTLRErrorStrategy.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\atn\BlockStartState.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\LexerAction.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\misc\Predicate.cpp">
<Filter>Source Files\misc</Filter>
</ClCompile>
<ClCompile Include="src\Token.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\TokenSource.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\WritableToken.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\support\Any.cpp">
<Filter>Source Files\support</Filter>
</ClCompile>
<ClCompile Include="src\tree\ErrorNode.cpp">
<Filter>Source Files\tree</Filter>
</ClCompile>
<ClCompile Include="src\tree\ParseTreeListener.cpp">
<Filter>Source Files\tree</Filter>
</ClCompile>
<ClCompile Include="src\tree\ParseTreeVisitor.cpp">
<Filter>Source Files\tree</Filter>
</ClCompile>
<ClCompile Include="src\tree\TerminalNode.cpp">
<Filter>Source Files\tree</Filter>
</ClCompile>
<ClCompile Include="src\tree\pattern\Chunk.cpp">
<Filter>Source Files\tree\pattern</Filter>
</ClCompile>
</ItemGroup>
</Project>
</Project>

View File

@ -27,7 +27,7 @@ namespace antlr4 {
/// </summary>
class ANTLR4CPP_PUBLIC IntStream {
public:
static const size_t EOF = std::numeric_limits<size_t>::max();
static const size_t EOF = (size_t)-1; // std::numeric_limits<size_t>::max(); doesn't work in VS 2013
/// The value returned by <seealso cref="#LA LA()"/> when the end of the stream is
/// reached.

View File

@ -11,7 +11,7 @@ namespace antlr4 {
class ANTLR4CPP_PUBLIC Recognizer {
public:
static const size_t EOF = std::numeric_limits<size_t>::max();
static const size_t EOF = (size_t)-1; // std::numeric_limits<size_t>::max(); doesn't work in VS 2013.
Recognizer();
Recognizer(Recognizer const&) = delete;

View File

@ -18,7 +18,7 @@ namespace antlr4 {
/// During lookahead operations, this "token" signifies we hit rule end ATN state
/// and did not follow it despite needing to.
static const size_t EPSILON = std::numeric_limits<size_t>::max() - 1;
static const size_t EPSILON = (size_t)-2;
static const size_t MIN_USER_TOKEN_TYPE = 1;
static const size_t EOF = IntStream::EOF;

View File

@ -52,7 +52,7 @@ void UnbufferedCharStream::sync(size_t want) {
size_t UnbufferedCharStream::fill(size_t n) {
for (size_t i = 0; i < n; i++) {
if (_data.size() > 0 && _data.back() == (uint32_t)EOF) {
if (_data.size() > 0 && _data.back() == 0xFFFF) {
return i;
}
@ -101,7 +101,7 @@ size_t UnbufferedCharStream::LA(ssize_t i) {
return EOF;
}
if (_data[(size_t)index] == (uint32_t)EOF) {
if (_data[(size_t)index] == 0xFFFF) {
return EOF;
}

View File

@ -63,6 +63,8 @@
typedef std::basic_string<__int32> i32string;
typedef i32string UTF32String;
#else
typedef std::u32string UTF32String;
#endif
#ifdef ANTLR4CPP_EXPORTS

View File

@ -77,7 +77,7 @@ namespace atn {
virtual ~ATNState();
static const size_t INITIAL_NUM_TRANSITIONS = 4;
static const size_t INVALID_STATE_NUMBER = std::numeric_limits<size_t>::max();
static const size_t INVALID_STATE_NUMBER = (size_t)-1; // std::numeric_limits<size_t>::max();
enum {
ATN_INVALID_TYPE = 0,

View File

@ -17,7 +17,6 @@ namespace atn {
class PredictionContextMergeCache;
typedef std::unordered_set<Ref<PredictionContext>, PredictionContextHasher, PredictionContextComparer> PredictionContextCache;
//typedef std::map<std::pair<Ref<PredictionContext>, Ref<PredictionContext>>, Ref<PredictionContext>> PredictionContextMergeCache;
class ANTLR4CPP_PUBLIC PredictionContext {
public:
@ -31,7 +30,7 @@ namespace atn {
// ml: originally Integer.MAX_VALUE, which would be (size_t)-1 for us, but this is already used in places where
// -1 is converted to unsigned, so we use a different value here. Any value does the job provided it doesn't
// conflict with real return states.
static const size_t EMPTY_RETURN_STATE = std::numeric_limits<size_t>::max() - 9;
static const size_t EMPTY_RETURN_STATE = (size_t)-10; // std::numeric_limits<size_t>::max() - 9;
private:
static const size_t INITIAL_HASH = 1;

View File

@ -5,10 +5,12 @@
#include "Any.h"
antlrcpp::Any::~Any()
using namespace antlrcpp;
Any::~Any()
{
delete _ptr;
}
antlrcpp::Any::Base::~Base() {
Any::Base::~Base() {
}

View File

@ -19,7 +19,7 @@ namespace antlrcpp {
template<class T>
using StorageType = typename std::decay<T>::type;
struct Any
struct ANTLR4CPP_PUBLIC Any
{
bool isNull() const { return _ptr == nullptr; }
bool isNotNull() const { return _ptr != nullptr; }