summaryrefslogtreecommitdiffstats
path: root/tests/auto/tools/moc/parse-defines.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2012-11-22 11:03:39 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-11-23 17:04:00 +0100
commitaea68c93ae437a761584719f0f1ca93eaf6f7484 (patch)
tree09f7bb24a1ec26c96db27be9bfeb61ed6c3da8e4 /tests/auto/tools/moc/parse-defines.h
parent436e3dc4f961b4ea6c541d1fdf82e476ac10597c (diff)
Proper macro replacment and branch evaluation
Correclty replace macros according to the C++ standard. Use the correct replacement method also to evaluate With this moc correctly processes boost headers. Task-number: QTBUG-27546 Change-Id: I001b3054c5fcdc34d46cfa53d1387bd19436f361 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'tests/auto/tools/moc/parse-defines.h')
-rw-r--r--tests/auto/tools/moc/parse-defines.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/auto/tools/moc/parse-defines.h b/tests/auto/tools/moc/parse-defines.h
index eb47253587..60415ac69a 100644
--- a/tests/auto/tools/moc/parse-defines.h
+++ b/tests/auto/tools/moc/parse-defines.h
@@ -52,6 +52,7 @@
#define PD_CLASSNAME ParseDefine
#define PD_STRINGIFY(a) #a
+#define PD_XSTRINGIFY(a) PD_STRINGIFY(a)
#define PD_SCOPED_STRING(a, b) PD_STRINGIFY(a) "::" PD_STRINGIFY(b)
#define PD_DEFINE1(a,b) a##b
#define PD_DEFINE2(a,b) a comb##b
@@ -81,7 +82,8 @@ class PD_CLASSNAME : public QObject
{
Q_OBJECT
Q_CLASSINFO("TestString", PD_STRINGIFY(PD_CLASSNAME))
- PD_CLASSINFO("TestString2", "TestValue")
+ Q_CLASSINFO("TestString2", PD_XSTRINGIFY(PD_CLASSNAME))
+ PD_CLASSINFO("TestString3", "TestValue")
public:
PD_CLASSNAME() {}
@@ -108,6 +110,24 @@ public slots:
PD_VARARGEXT(void vararg5, int) {}
PD_VARARGEXT(void vararg6, int, int) {}
#endif
+
+#define OUTERFUNCTION(x) x
+#define INNERFUNCTION(x) OUTERFUNCTION(x)
+#define INNER INNERFUNCTION
+
+ void INNERFUNCTION(INNERFUNCTION)(int) {}
+ void OUTERFUNCTION(INNERFUNCTION)(inner_expanded(int)) {}
+ void expanded_method OUTERFUNCTION(INNER)((int)) {}
+
+#undef INNERFUNCTION
+
+#define cond1() 0x1
+#define cond2() 0x2
+
+#if !(cond1() & cond2())
+ void conditionSlot() {}
+#endif
+
};
#undef QString