Fix moc stumbling over gcc __attribute__ extensions
authorSimon Hausmann <simon.hausmann@digia.com>
Mon, 1 Oct 2012 09:57:53 +0000 (11:57 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Mon, 1 Oct 2012 12:27:14 +0000 (14:27 +0200)
commit310031188c679377152eb65b8dc3f92d3799a339
tree173262db053a0273ac636dd789a2785c43f1a84c
parent291e1a9e67499f6fa8285a1d4ed1ea6e8297dd5f
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>
src/tools/moc/main.cpp
tests/auto/tools/moc/function-with-attributes.h [new file with mode: 0644]
tests/auto/tools/moc/moc.pro