Merge pull request #128 from JoakimSoderberg/lex_unget_unsave_fix

BUGFIX: Compilation error with -DNDEBUG defined.
This commit is contained in:
Petri Lehtinen 2013-07-01 21:41:55 -07:00
commit ef666519f7

View File

@ -253,9 +253,18 @@ static void lex_unget(lex_t *lex, int c)
static void lex_unget_unsave(lex_t *lex, int c) static void lex_unget_unsave(lex_t *lex, int c)
{ {
if(c != STREAM_STATE_EOF && c != STREAM_STATE_ERROR) { if(c != STREAM_STATE_EOF && c != STREAM_STATE_ERROR) {
/* Since we treat warnings as errors, when assertions are turned
* off the "d" variable would be set but never used. Which is
* treated as an error by GCC.
*/
#ifndef NDEBUG
char d; char d;
#endif
stream_unget(&lex->stream, c); stream_unget(&lex->stream, c);
d = strbuffer_pop(&lex->saved_text); #ifndef NDEBUG
d =
#endif
strbuffer_pop(&lex->saved_text);
assert(c == d); assert(c == d);
} }
} }