From 21426f281e09b6043e3c1f9b5d3a48644a4965fe Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 12 Oct 2012 13:37:21 +0200 Subject: moc: parse properly the gcc extension for variadic macro Task-number: QTBUG-27547 Change-Id: I983b96b09c405e5330327092e56164b9921a2d0f Reviewed-by: Lars Knoll --- tests/auto/tools/moc/parse-defines.h | 12 ++++++++++++ tests/auto/tools/moc/tst_moc.cpp | 6 ++++++ 2 files changed, 18 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/tools/moc/parse-defines.h b/tests/auto/tools/moc/parse-defines.h index bc22444b5b..eb47253587 100644 --- a/tests/auto/tools/moc/parse-defines.h +++ b/tests/auto/tools/moc/parse-defines.h @@ -65,6 +65,14 @@ #if defined(Q_COMPILER_VARIADIC_MACROS) #define PD_VARARG(x, ...) x(__VA_ARGS__) + +#if defined(Q_CC_GNU) || defined(Q_MOC_RUN) +//GCC extension for variadic macros +#define PD_VARARGEXT(x, y...) x(y) +#else +#define PD_VARARGEXT(x, ...) x(__VA_ARGS__) +#endif + #endif PD_BEGIN_NAMESPACE @@ -95,6 +103,10 @@ public slots: PD_VARARG(void vararg1) {} PD_VARARG(void vararg2, int) {} PD_VARARG(void vararg3, int, int) {} + + PD_VARARGEXT(void vararg4) {} + PD_VARARGEXT(void vararg5, int) {} + PD_VARARGEXT(void vararg6, int, int) {} #endif }; diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index 0cd6c295cc..d861b84e00 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -2744,6 +2744,12 @@ void tst_Moc::parseDefines() QVERIFY(index != -1); index = mo->indexOfSlot("vararg3(int,int)"); QVERIFY(index != -1); + index = mo->indexOfSlot("vararg4()"); + QVERIFY(index != -1); + index = mo->indexOfSlot("vararg5(int)"); + QVERIFY(index != -1); + index = mo->indexOfSlot("vararg6(int,int)"); + QVERIFY(index != -1); #endif int count = 0; -- cgit v1.2.3