diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-01 11:57:53 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-10-01 14:27:14 +0200 |
commit | 310031188c679377152eb65b8dc3f92d3799a339 (patch) | |
tree | 173262db053a0273ac636dd789a2785c43f1a84c /tests | |
parent | 291e1a9e67499f6fa8285a1d4ed1ea6e8297dd5f (diff) |
Fix moc stumbling over gcc __attribute__ extensions
Reported by David Faure.
In KDE a DEPRECATED macro gets defined in a header file created by cmake.
The define is not guarded with #if Q_CC_GNU or similar because at cmake
time the compiler is determined. Therefore moc suddenly sees this gcc
specific token and stumbles over it.
This patch simply defines an empty __attribute__ macro that will expand
to nothing and thus become invisible to moc's "C++ parser" after the
pre-processing.
Change-Id: I4448b9ac3f72b6334e32b27484401fb0fca23a0c
Reviewed-by: David Faure <faure@kde.org>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/tools/moc/function-with-attributes.h | 57 | ||||
-rw-r--r-- | tests/auto/tools/moc/moc.pro | 3 |
2 files changed, 59 insertions, 1 deletions
diff --git a/tests/auto/tools/moc/function-with-attributes.h b/tests/auto/tools/moc/function-with-attributes.h new file mode 100644 index 0000000000..1231969078 --- /dev/null +++ b/tests/auto/tools/moc/function-with-attributes.h @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** 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$ +** +****************************************************************************/ +#include <qobject.h> + +// test support for gcc attributes with functions + +#if defined(Q_CC_GNU) || defined(Q_MOC_RUN) +#define DEPRECATED __attribute__ ((__deprecated__)) +#else +#define DEPRECATED +#endif + +class FunctionWithAttributes : public QObject +{ + Q_OBJECT +public slots: + DEPRECATED void test() {} + +}; diff --git a/tests/auto/tools/moc/moc.pro b/tests/auto/tools/moc/moc.pro index fd6af68e35..d91ae378da 100644 --- a/tests/auto/tools/moc/moc.pro +++ b/tests/auto/tools/moc/moc.pro @@ -22,7 +22,8 @@ HEADERS += using-namespaces.h no-keywords.h task87883.h c-comments.h backslash-n cxx11-final-classes.h \ cxx11-explicit-override-control.h \ forward-declared-param.h \ - parse-defines.h + parse-defines.h \ + function-with-attributes.h if(*-g++*|*-icc*|*-clang*|*-llvm):!irix-*:!win32-*: HEADERS += os9-newlines.h win-newlines.h |