aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/baremetal
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2019-07-23 19:41:05 +0300
committerDenis Shienkov <denis.shienkov@gmail.com>2019-07-24 13:25:24 +0000
commit37a6e6b58a8f718965404e0a31357812b6ebc024 (patch)
treee3b1c9036ddd27452184181d9d1a882c76eb4835 /src/plugins/baremetal
parentc1a83b2a887a67bc3064dac916d4bc241b1cad64 (diff)
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 <hjk@qt.io>
Diffstat (limited to 'src/plugins/baremetal')
-rw-r--r--src/plugins/baremetal/iarewtoolchain.cpp14
1 files 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(".");