diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2013-03-05 12:44:26 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-17 10:57:49 +0100 |
commit | b8d08c0e9a1f8624b0a23513ebf78a346967342c (patch) | |
tree | d1aed026618bc5cfb8edb4dbca15f23fa1e380f0 /tests/auto/tools | |
parent | b7b858595e6e2d8dcc9debeb45eb8b9b294b9be6 (diff) |
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>
Diffstat (limited to 'tests/auto/tools')
-rw-r--r-- | tests/auto/tools/moc/parse-defines.h | 11 | ||||
-rw-r--r-- | tests/auto/tools/moc/tst_moc.cpp | 2 |
2 files changed, 9 insertions, 4 deletions
diff --git a/tests/auto/tools/moc/parse-defines.h b/tests/auto/tools/moc/parse-defines.h index f12899e368..aaadcef601 100644 --- a/tests/auto/tools/moc/parse-defines.h +++ b/tests/auto/tools/moc/parse-defines.h @@ -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 diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index ee82dc0652..909c220669 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -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); |