Commit df581265 authored by Nikolai Kosjar's avatar Nikolai Kosjar

Clang*: Workaround parsing mingw's <type_traits> with clang 3.9

...for -std=gnu++0x.

Define the unknown identifier/type "__float128" so at least the headers can be
parsed successfully. Of course this does not help for parsing client code
referencing that identifier, but this should be the less common case.

Task-number: QTCREATORBUG-17126
Change-Id: Id321311713029d8aa77e068b02361d86debfada6
Reviewed-by: Christian Kandeler's avatarChristian Kandeler <christian.kandeler@qt.io>
parent 57ac8d96
...@@ -96,6 +96,7 @@ public: ...@@ -96,6 +96,7 @@ public:
optionsBuilder.enableExceptions(); optionsBuilder.enableExceptions();
optionsBuilder.addDefineToAvoidIncludingGccOrMinGwIntrinsics(); optionsBuilder.addDefineToAvoidIncludingGccOrMinGwIntrinsics();
optionsBuilder.addDefineFloat128ForMingw();
optionsBuilder.addToolchainAndProjectDefines(); optionsBuilder.addToolchainAndProjectDefines();
optionsBuilder.undefineCppLanguageFeatureMacrosForMsvc2015(); optionsBuilder.undefineCppLanguageFeatureMacrosForMsvc2015();
......
...@@ -130,6 +130,7 @@ Utils::SmallStringVector RefactoringCompilerOptionsBuilder::build(CppTools::Proj ...@@ -130,6 +130,7 @@ Utils::SmallStringVector RefactoringCompilerOptionsBuilder::build(CppTools::Proj
optionsBuilder.addOptionsForLanguage(/*checkForBorlandExtensions*/ true); optionsBuilder.addOptionsForLanguage(/*checkForBorlandExtensions*/ true);
optionsBuilder.enableExceptions(); optionsBuilder.enableExceptions();
optionsBuilder.addDefineFloat128ForMingw();
optionsBuilder.addDefineToAvoidIncludingGccOrMinGwIntrinsics(); optionsBuilder.addDefineToAvoidIncludingGccOrMinGwIntrinsics();
optionsBuilder.addToolchainAndProjectDefines(); optionsBuilder.addToolchainAndProjectDefines();
optionsBuilder.undefineCppLanguageFeatureMacrosForMsvc2015(); optionsBuilder.undefineCppLanguageFeatureMacrosForMsvc2015();
......
...@@ -175,6 +175,7 @@ public: ...@@ -175,6 +175,7 @@ public:
optionsBuilder.addOptionsForLanguage(false); optionsBuilder.addOptionsForLanguage(false);
optionsBuilder.enableExceptions(); optionsBuilder.enableExceptions();
optionsBuilder.addDefineFloat128ForMingw();
optionsBuilder.addDefineToAvoidIncludingGccOrMinGwIntrinsics(); optionsBuilder.addDefineToAvoidIncludingGccOrMinGwIntrinsics();
const Core::Id type = projectPart.toolchainType; const Core::Id type = projectPart.toolchainType;
if (type != ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID) if (type != ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID)
......
...@@ -368,6 +368,14 @@ void CompilerOptionsBuilder::undefineCppLanguageFeatureMacrosForMsvc2015() ...@@ -368,6 +368,14 @@ void CompilerOptionsBuilder::undefineCppLanguageFeatureMacrosForMsvc2015()
} }
} }
void CompilerOptionsBuilder::addDefineFloat128ForMingw()
{
// TODO: Remove once this is fixed in clang >= 3.9.
// https://llvm.org/bugs/show_bug.cgi?id=30685
if (m_projectPart.toolchainType == ProjectExplorer::Constants::MINGW_TOOLCHAIN_TYPEID)
addDefine("#define __float128 void");
}
QString CompilerOptionsBuilder::includeOption() const QString CompilerOptionsBuilder::includeOption() const
{ {
return QLatin1String("-I"); return QLatin1String("-I");
......
...@@ -58,6 +58,8 @@ public: ...@@ -58,6 +58,8 @@ public:
void addMsvcCompatibilityVersion(); void addMsvcCompatibilityVersion();
void undefineCppLanguageFeatureMacrosForMsvc2015(); void undefineCppLanguageFeatureMacrosForMsvc2015();
void addDefineFloat128ForMingw();
protected: protected:
virtual bool excludeDefineDirective(const QByteArray &defineDirective) const; virtual bool excludeDefineDirective(const QByteArray &defineDirective) const;
virtual bool excludeHeaderPath(const QString &headerPath) const; virtual bool excludeHeaderPath(const QString &headerPath) const;
......
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