From: Michael Hanke <mih@debian.org>
Bug-Debian: http://bugs.debian.org/623172
Subject: Make istream availability test more robust

For a yet to be determined reason the 'extra_tests' unit test fails on sid-i386
with GCC 4.5.2 and enabled optimization when ran inside 'make check'. It doesn't
fail when run separately, without optimization or when compiled with an older
GCC. The patch fixes the symptom, but probably not the underlying bug.
--- a/lexerSource.cpp
+++ b/lexerSource.cpp
@@ -112,7 +112,7 @@
 	char real_character;
 	int  character;
 
-	if (_stream != NULL && !_stream->eof()) {
+	if (_stream != NULL && _stream->good() && !_stream->eof()) {
 		_stream->get(real_character);
 		character = (unsigned char)real_character;
 	} else {
