forked from qt-creator/qt-creator
Preprocessor: fix expanding macro arguments.
Expanding macro arguments can add or remove argument for a nested macro, so the actual parameters list was not correct. Also, remove unused arguments reference list and reserve space for the expected number of arguments. Change-Id: I4cf369cbb3909927c6bf65750bd715fa6f070fad Reviewed-by: Erik Verbruggen <erik.verbruggen@nokia.com>
This commit is contained in:
committed by
Erik Verbruggen
parent
3e9105e401
commit
558b6e08ae
@@ -44,6 +44,7 @@ private Q_SLOTS:
|
||||
void va_args();
|
||||
void named_va_args();
|
||||
void first_empty_macro_arg();
|
||||
void param_expanding_as_multiple_params();
|
||||
void unfinished_function_like_macro_call();
|
||||
void nasty_macro_expansion();
|
||||
void tstst();
|
||||
@@ -100,6 +101,19 @@ void tst_Preprocessor::first_empty_macro_arg()
|
||||
QVERIFY(preprocessed.contains("int Val2;"));
|
||||
}
|
||||
|
||||
void tst_Preprocessor::param_expanding_as_multiple_params()
|
||||
{
|
||||
Client *client = 0; // no client.
|
||||
Environment env;
|
||||
|
||||
Preprocessor preprocess(client, &env);
|
||||
QByteArray preprocessed = preprocess(QLatin1String("<stdin>"),
|
||||
QByteArray("\n#define foo(a,b) int f(a,b);"
|
||||
"\n#define ARGS(t) t a,t b"
|
||||
"\nfoo(ARGS(int))"));
|
||||
QVERIFY(preprocessed.contains("int f(int a,int b);"));
|
||||
}
|
||||
|
||||
void tst_Preprocessor::unfinished_function_like_macro_call()
|
||||
{
|
||||
Client *client = 0; // no client.
|
||||
|
||||
Reference in New Issue
Block a user