From 1839ae9bd16928329680b772038a8cad230cfe07 Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Tue, 23 Jul 2019 21:58:42 +0300 Subject: 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: Ic2b4d50e9e2a978a5cbc69ed5353d5953e83c85d Reviewed-by: Christian Kandeler --- share/qbs/modules/cpp/iar.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'share/qbs') diff --git a/share/qbs/modules/cpp/iar.js b/share/qbs/modules/cpp/iar.js index 3098c88f6..33093c0a3 100644 --- a/share/qbs/modules/cpp/iar.js +++ b/share/qbs/modules/cpp/iar.js @@ -56,6 +56,17 @@ function guessEndianness(macros) return "big" } +function cppLanguageOption(compilerFilePath) +{ + var baseName = FileInfo.baseName(compilerFilePath); + if (baseName === "iccarm") + return "--c++"; + if (baseName === "icc8051" || baseName === "iccavr") + return "--ec++"; + throw "Unable to deduce C++ language option for unsupported compiler: '" + + FileInfo.toNativeSeparators(compilerFilePath) + "'"; +} + function dumpMacros(compilerFilePath, tag) { var tempDir = new TemporaryDir(); var inFilePath = FileInfo.fromNativeSeparators(tempDir.path() + "/empty-source.c"); @@ -64,7 +75,7 @@ function dumpMacros(compilerFilePath, tag) { var args = [ inFilePath, "--predef_macros", outFilePath ]; if (tag && tag === "cpp") - args.push("--c++"); + args.push(cppLanguageOption(compilerFilePath)); var p = new Process(); p.exec(compilerFilePath, args, true); @@ -84,7 +95,7 @@ function dumpDefaultPaths(compilerFilePath, tag) { var args = [ inFilePath, "--preinclude", "." ]; if (tag === "cpp") - args.push("--c++"); + args.push(cppLanguageOption(compilerFilePath)); var p = new Process(); // This process should return an error, don't throw -- cgit v1.2.3