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 /src/tools | |
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 'src/tools')
-rw-r--r-- | src/tools/moc/main.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp index e87c742632..ccdae64738 100644 --- a/src/tools/moc/main.cpp +++ b/src/tools/moc/main.cpp @@ -170,6 +170,14 @@ int runMoc(int _argc, char **_argv) Moc moc; pp.macros["Q_MOC_RUN"]; pp.macros["__cplusplus"]; + + // Don't stumble over GCC extensions + Macro dummyVariadicFunctionMacro; + dummyVariadicFunctionMacro.isFunction = true; + dummyVariadicFunctionMacro.isVariadic = true; + dummyVariadicFunctionMacro.arguments += Symbol(0, PP_IDENTIFIER, "__VA_ARGS__"); + pp.macros["__attribute__"] = dummyVariadicFunctionMacro; + QByteArray filename; QByteArray output; FILE *in = 0; |