Fix tst_moc when variadic macros are enabled

moc do not see Q_COMPILER_VARIADIC_MACROS as defined (because it does
not know the builtins defines)

So it would never parse those macro, and never generate the signals or
slot.

Always let moc parse the variadic macro, and put non-macro function in
the header so the generated code would compile on every compiler

Change-Id: Ie9504539ee737c81e831b217f8d623fe810d9e35
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
Olivier Goffart 2013-03-05 12:44:26 +01:00 committed by The Qt Project
parent b7b858595e
commit b8d08c0e9a
2 changed files with 9 additions and 4 deletions

View File

@ -64,7 +64,7 @@
#define PD_CLASSINFO Q_CLASSINFO
#if defined(Q_COMPILER_VARIADIC_MACROS)
#if defined(Q_COMPILER_VARIADIC_MACROS) || defined (Q_MOC_RUN)
#define PD_VARARG(x, ...) x(__VA_ARGS__)
#if defined(Q_CC_GNU) || defined(Q_MOC_RUN)
@ -104,7 +104,7 @@ public slots:
PD_TEST_IDENTIFIER_ARG(void, combined6()) {}
#if defined(Q_COMPILER_VARIADIC_MACROS)
#if defined(Q_COMPILER_VARIADIC_MACROS) || defined (Q_MOC_RUN)
PD_VARARG(void vararg1) {}
PD_VARARG(void vararg2, int) {}
PD_VARARG(void vararg3, int, int) {}
@ -112,6 +112,13 @@ public slots:
PD_VARARGEXT(void vararg4) {}
PD_VARARGEXT(void vararg5, int) {}
PD_VARARGEXT(void vararg6, int, int) {}
#else
void vararg1() {}
void vararg2(int) {}
void vararg3(int,int) {}
void vararg4() {}
void vararg5(int) {}
void vararg6(int,int) {}
#endif
#define OUTERFUNCTION(x) x

View File

@ -2738,7 +2738,6 @@ void tst_Moc::parseDefines()
index = mo->indexOfSlot("combined6()");
QVERIFY(index != -1);
#if defined(Q_COMPILER_VARIADIC_MACROS)
index = mo->indexOfSlot("vararg1()");
QVERIFY(index != -1);
index = mo->indexOfSlot("vararg2(int)");
@ -2751,7 +2750,6 @@ void tst_Moc::parseDefines()
QVERIFY(index != -1);
index = mo->indexOfSlot("vararg6(int,int)");
QVERIFY(index != -1);
#endif
index = mo->indexOfSlot("INNERFUNCTION(int)");
QVERIFY(index != -1);