From 310031188c679377152eb65b8dc3f92d3799a339 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 1 Oct 2012 11:57:53 +0200 Subject: 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 --- src/tools/moc/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/tools/moc') 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; -- cgit v1.2.3