Commit ae24a88e authored by Erik Verbruggen's avatar Erik Verbruggen Committed by Erik Verbruggen
Browse files

Clang: never include a define for __cplusplus.



The flags used by the project explorer to interrogate the toolchain for
compiler-defined #defines always indicate a C++ file. So, this will
always include a #define for __cplusplus. When editing C code with
the clang code model, this results in extern "C" linkage specifications,
which result in warnings or errors.

The proper fix is described in QTCREATORBUG-11709, but is too big to be
done within the 3.1 timeframe.

Task-number: QTCREATORBUG-11501
Change-Id: Id9e261fa8d429fead4a2cd5fd7398aa6e1e8c13d
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
parent 6206dc8b
......@@ -113,6 +113,11 @@ static QStringList buildDefines(const QByteArray &defines, bool toolchainDefines
if (def.isEmpty())
continue;
// This is a quick fix for QTCREATORBUG-11501.
// TODO: do a proper fix, see QTCREATORBUG-11709.
if (def.startsWith("#define __cplusplus"))
continue;
// TODO: verify if we can pass compiler-defined macros when also passing -undef.
if (toolchainDefines) {
//### FIXME: the next 3 check shouldn't be needed: we probably don't want to get the compiler-defined defines in.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment