summaryrefslogtreecommitdiffstats
path: root/tests/auto/tools
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2013-03-01 15:06:33 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-02 12:58:18 +0100
commit7e5d1c1c2fc764d4cacc3e367542e1f42e6b772e (patch)
treeb2d555f840e30f299c7741574e6e93c4e236fcaa /tests/auto/tools
parentb0e58a9008a01cd819d942ddc79534e8dd8ef8bd (diff)
moc: Support the '$' character as an identifier
Both gcc and clang allow the use of '$' in their identifiers as an extension. moc should not throw a parse error if there is one in the file. Instead, consider '$' as valid in identifiers. Task-number: QTBUG-22720 Change-Id: I8be3a52429c0db5b7e8308b8f4fe475d3d3994bf Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'tests/auto/tools')
-rw-r--r--tests/auto/tools/moc/dollars.h70
-rw-r--r--tests/auto/tools/moc/moc.pro1
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp1
3 files changed, 72 insertions, 0 deletions
diff --git a/tests/auto/tools/moc/dollars.h b/tests/auto/tools/moc/dollars.h
new file mode 100644
index 0000000000..8fab45559c
--- /dev/null
+++ b/tests/auto/tools/moc/dollars.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Olivier Goffart <ogoffart@woboq.com>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/* both GCC and clang allow $ in identifiers
+ * So moc should not throw a parse error if it parses a file that contains such identifiers
+ */
+
+#include <QObject>
+
+#define macro$1 function1
+#define $macro2 function2
+
+namespace $NS {
+ class $CLS : public QObject
+ {
+ Q_PROPERTY(int rich$ MEMBER m_$rich$)
+ Q_PROPERTY(int money$$$ READ $$$money$$$ WRITE $$$setMoney$$$)
+ Q_OBJECT
+
+ int m_$rich$;
+ int m_money;
+ int $$$money$$$() { return m_money; }
+ int $$$setMoney$$$(int m) { return m_money = m; }
+
+ Q_SIGNALS:
+ void macro$1 ();
+ void $macro2 ();
+
+ void function$3 ($CLS * cl$s);
+ };
+}
+
diff --git a/tests/auto/tools/moc/moc.pro b/tests/auto/tools/moc/moc.pro
index 8d08d9a8c0..1600c458b5 100644
--- a/tests/auto/tools/moc/moc.pro
+++ b/tests/auto/tools/moc/moc.pro
@@ -26,6 +26,7 @@ HEADERS += using-namespaces.h no-keywords.h task87883.h c-comments.h backslash-n
if(*-g++*|*-icc*|*-clang*|*-llvm):!irix-*:!win32-*: HEADERS += os9-newlines.h win-newlines.h
+if(*-g++*|*-clang*): HEADERS += dollars.h
SOURCES += tst_moc.cpp
QT -= gui
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index 195361e007..382ee36d37 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Olivier Goffart <ogoffart@woboq.com>
** Contact: http://www.qt-project.org/legal
**
** This file is part of the test suite of the Qt Toolkit.