Commit 433f4aaa by maxvujovic@gmail.com

Fix always true condition in assert in MacroExpander.cpp.

Issue: 349 Review URL: https://codereview.appspot.com/6420046/ git-svn-id: https://angleproject.googlecode.com/svn/trunk@1228 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 6c0c2d87
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "MacroExpander.h" #include "MacroExpander.h"
#include <algorithm> #include <algorithm>
#include <cassert>
#include <sstream> #include <sstream>
#include "Diagnostics.h" #include "Diagnostics.h"
...@@ -129,7 +128,6 @@ void MacroExpander::ungetToken(const Token& token) ...@@ -129,7 +128,6 @@ void MacroExpander::ungetToken(const Token& token)
{ {
MacroContext* context = mContextStack.back(); MacroContext* context = mContextStack.back();
context->unget(); context->unget();
assert(context->index >= 0);
assert(context->replacements[context->index] == token); assert(context->replacements[context->index] == token);
} }
else else
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#ifndef COMPILER_PREPROCESSOR_MACRO_EXPANDER_H_ #ifndef COMPILER_PREPROCESSOR_MACRO_EXPANDER_H_
#define COMPILER_PREPROCESSOR_MACRO_EXPANDER_H_ #define COMPILER_PREPROCESSOR_MACRO_EXPANDER_H_
#include <cassert>
#include <memory> #include <memory>
#include <vector> #include <vector>
...@@ -58,7 +59,7 @@ class MacroExpander : public Lexer ...@@ -58,7 +59,7 @@ class MacroExpander : public Lexer
MacroContext() : macro(0), index(0) { } MacroContext() : macro(0), index(0) { }
bool empty() const { return index == replacements.size(); } bool empty() const { return index == replacements.size(); }
const Token& get() { return replacements[index++]; } const Token& get() { return replacements[index++]; }
void unget() { --index; } void unget() { assert(index > 0); --index; }
}; };
Lexer* mLexer; Lexer* mLexer;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment