[C++] Add error recovery for namespace declarations.

Change-Id: I884ff9901c95467524e5eba38e91f75992d30e14
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
Reviewed-by: Flex Ferrum <flexferrum@gmail.com>
This commit is contained in:
Erik Verbruggen
2012-02-24 13:06:21 +01:00
parent 164db0feeb
commit a621c99a0f
3 changed files with 101 additions and 2 deletions

View File

@@ -43,6 +43,7 @@ Q_OBJECT
private Q_SLOTS:
void unfinished_function_like_macro_call();
void nasty_macro_expansion();
void tstst();
};
void tst_Preprocessor::unfinished_function_like_macro_call()
@@ -111,5 +112,28 @@ void tst_Preprocessor::nasty_macro_expansion()
QVERIFY(!preprocessed.contains("FIELD32"));
}
void tst_Preprocessor::tstst()
{
Client *client = 0; // no client.
Environment env;
Preprocessor preprocess(client, &env);
QByteArray preprocessed = preprocess(
QLatin1String("<stdin>"),
QByteArray("\n"
"# define _GLIBCXX_VISIBILITY(V) __attribute__ ((__visibility__ (#V)))\n"
"namespace std _GLIBCXX_VISIBILITY(default) {\n"
"}\n"
));
qDebug() << preprocessed;
/*
# define _GLIBCXX_VISIBILITY(V) __attribute__ ((__visibility__ (#V)))
namespace std _GLIBCXX_VISIBILITY(default)
*/
}
QTEST_APPLESS_MAIN(tst_Preprocessor)
#include "tst_preprocessor.moc"