From a8456c16e89cf7d15d75002cc92698e840692b6e Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Mon, 31 Oct 2016 15:25:59 +0100 Subject: Clang: Avoid parsing unknown __builtin_va_arg_pack Task-number: QTCREATORBUG-17185 Change-Id: I72552bcd417c9760413b772593642e3c79f1ab17 Reviewed-by: Christian Kandeler --- src/plugins/cpptools/compileroptionsbuilder.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/plugins/cpptools/compileroptionsbuilder.cpp') diff --git a/src/plugins/cpptools/compileroptionsbuilder.cpp b/src/plugins/cpptools/compileroptionsbuilder.cpp index a2b2ed3ba6..e07d4fcc56 100644 --- a/src/plugins/cpptools/compileroptionsbuilder.cpp +++ b/src/plugins/cpptools/compileroptionsbuilder.cpp @@ -423,6 +423,16 @@ bool CompilerOptionsBuilder::excludeDefineDirective(const QByteArray &defineDire return true; } + // If _FORTIFY_SOURCE is defined (typically in release mode), it will + // enable the inclusion of extra headers to help catching buffer overflows + // (e.g. wchar.h includes wchar2.h). These extra headers use + // __builtin_va_arg_pack, which clang does not support (yet), so avoid + // including those. + if (m_projectPart.toolchainType == ProjectExplorer::Constants::GCC_TOOLCHAIN_TYPEID + && defineDirective.startsWith("#define _FORTIFY_SOURCE")) { + return true; + } + return false; } -- cgit v1.2.1