path: root/src/tools/moc
diff options
authorSimon Hausmann <>2012-10-01 11:57:53 +0200
committerThe Qt Project <>2012-10-01 14:27:14 +0200
commit310031188c679377152eb65b8dc3f92d3799a339 (patch)
tree173262db053a0273ac636dd789a2785c43f1a84c /src/tools/moc
parent291e1a9e67499f6fa8285a1d4ed1ea6e8297dd5f (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 <> Reviewed-by: Olivier Goffart <>
Diffstat (limited to 'src/tools/moc')
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;
+ // 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;