1
/****************************************************************************
3
** Copyright (C) 2016 The Qt Company Ltd.
4
** Contact: https://www.qt.io/licensing/
6
** This file is part of the tools applications of the Qt Toolkit.
8
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
9
** Commercial License Usage
10
** Licensees holding valid commercial Qt licenses may use this file in
11
** accordance with the commercial license agreement provided with the
12
** Software or, alternatively, in accordance with the terms contained in
13
** a written agreement between you and The Qt Company. For licensing terms
14
** and conditions see https://www.qt.io/terms-conditions. For further
15
** information use the contact form at https://www.qt.io/contact-us.
17
** GNU General Public License Usage
18
** Alternatively, this file may be used under the terms of the GNU
19
** General Public License version 3 as published by the Free Software
20
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21
** included in the packaging of this file. Please review the following
22
** information to ensure the GNU General Public License requirements will
23
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
27
****************************************************************************/
29
#ifndef PARSE_DEFINES_H
30
#define PARSE_DEFINES_H
34
// this is intentionally ugly to test moc's preprocessing capabilities
35
#define PD_NAMESPACE PD
36
#define PD_BEGIN_NAMESPACE namespace PD_NAMESPACE {
37
#define PD_END_NAMESPACE }
38
#define PD_VOIDFUNCTION() voidFunction()
39
#define PD_CLASSNAME ParseDefine
41
#define PD_STRINGIFY(a) #a
42
#define PD_XSTRINGIFY(a) PD_STRINGIFY(a)
43
#define PD_SCOPED_STRING(a, b) PD_STRINGIFY(a) "::" PD_STRINGIFY(b)
44
#define PD_DEFINE1(a,b) a##b
45
#define PD_DEFINE2(a,b) a comb##b
46
#define PD_DEFINE3(a,b) a b##ined3()
47
#define PD_COMBINE(a,b) a b
48
#define PD_TEST_IDENTIFIER_ARG(if, while) if while
50
#define QString() error_type
52
#define PD_CLASSINFO Q_CLASSINFO
54
#if defined(Q_COMPILER_VARIADIC_MACROS) || defined (Q_MOC_RUN)
55
#define PD_VARARG(x, ...) x(__VA_ARGS__)
57
#if defined(Q_CC_GNU) || defined(Q_MOC_RUN)
58
//GCC extension for variadic macros
59
#define PD_VARARGEXT(x, y...) x(y)
61
#define PD_VARARGEXT(x, ...) x(__VA_ARGS__)
66
#define PD_ADD_SUFFIX(x) PD_DEFINE1(x,_SUFFIX)
67
#define PD_DEFINE_ITSELF PD_ADD_SUFFIX(PD_DEFINE_ITSELF)
70
// macro defined on the command line (in tst_moc.pro)
71
#define DEFINE_CMDLINE_EMPTY
72
#define DEFINE_CMDLINE_SIGNAL void cmdlineSignal(const QMap<int, int> &i)
79
class DEFINE_CMDLINE_EMPTY PD_CLASSNAME DEFINE_CMDLINE_EMPTY
80
: public DEFINE_CMDLINE_EMPTY QObject DEFINE_CMDLINE_EMPTY
83
Q_CLASSINFO("TestString", PD_STRINGIFY(PD_CLASSNAME))
84
Q_CLASSINFO("TestString2", PD_XSTRINGIFY(PD_CLASSNAME))
85
PD_CLASSINFO("TestString3", "TestValue")
90
void PD_VOIDFUNCTION() {}
92
QString stringMethod() { return QString::fromLatin1(""); }
94
void PD_DEFINE1(comb, ined1()) {}
95
PD_DEFINE2(void, ined2()) {}
96
PD_DEFINE3(void, comb) {}
97
PD_COMBINE(void combined4(int, int), {})
99
PD_COMBINE(void combined5() {, })
101
PD_TEST_IDENTIFIER_ARG(void, combined6()) {}
103
#if defined(Q_COMPILER_VARIADIC_MACROS) || defined (Q_MOC_RUN)
104
PD_VARARG(void vararg1) {}
105
PD_VARARG(void vararg2, int) {}
106
PD_VARARG(void vararg3, int, int) {}
108
PD_VARARGEXT(void vararg4) {}
109
PD_VARARGEXT(void vararg5, int) {}
110
PD_VARARGEXT(void vararg6, int, int) {}
114
void vararg3(int,int) {}
117
void vararg6(int,int) {}
120
#define OUTERFUNCTION(x) x
121
#define INNERFUNCTION(x) OUTERFUNCTION(x)
122
#define INNER INNERFUNCTION
124
void INNERFUNCTION(INNERFUNCTION)(int) {}
125
void OUTERFUNCTION(INNERFUNCTION)(inner_expanded(int)) {}
126
void expanded_method OUTERFUNCTION(INNER)((int)) {}
133
#if !(cond1() & cond2())
134
void conditionSlot() {}
137
void PD_DEFINE_ITSELF(int) {}
140
DEFINE_CMDLINE_SIGNAL;