From 37a6e6b58a8f718965404e0a31357812b6ebc024 Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Tue, 23 Jul 2019 19:41:05 +0300 Subject: [PATCH] BareMetal: Fix detection of C++ language option for IAR ... which is used at dumping of predefined macros and a header paths. Reason is that for the different architectures the IAR use different C++ language options: * for ARM: --c++ * for AVR or 8051: --ec++ Change-Id: I00ceadaf87348ee2250b9455ca04eed4bcb703a7 Reviewed-by: hjk --- src/plugins/baremetal/iarewtoolchain.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/plugins/baremetal/iarewtoolchain.cpp b/src/plugins/baremetal/iarewtoolchain.cpp index 396196b151c..ba9e5204b31 100644 --- a/src/plugins/baremetal/iarewtoolchain.cpp +++ b/src/plugins/baremetal/iarewtoolchain.cpp @@ -66,6 +66,16 @@ static bool compilerExists(const FilePath &compilerPath) return fi.exists() && fi.isExecutable() && fi.isFile(); } +static QString cppLanguageOption(const FilePath &compiler) +{ + const QString baseName = compiler.toFileInfo().baseName(); + if (baseName == "iccarm") + return "--c++"; + if (baseName == "icc8051" || baseName == "iccavr") + return "--ec++"; + return {}; +} + static Macros dumpPredefinedMacros(const FilePath &compiler, const Core::Id languageId, const QStringList &env) { @@ -88,7 +98,7 @@ static Macros dumpPredefinedMacros(const FilePath &compiler, const Core::Id lang QStringList arguments; arguments.push_back(fakeIn.fileName()); if (languageId == ProjectExplorer::Constants::CXX_LANGUAGE_ID) - arguments.push_back("--c++"); + arguments.push_back(cppLanguageOption(compiler)); arguments.push_back("--predef_macros"); arguments.push_back(outpath); @@ -134,7 +144,7 @@ static HeaderPaths dumpHeaderPaths(const FilePath &compiler, const Core::Id lang QStringList arguments; arguments.push_back(fakeIn.fileName()); if (languageId == ProjectExplorer::Constants::CXX_LANGUAGE_ID) - arguments.push_back("--c++"); + arguments.push_back(cppLanguageOption(compiler)); arguments.push_back("--preinclude"); arguments.push_back(".");