aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2017-06-16 15:19:14 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2017-06-16 15:19:14 +0200
commit397172f1a8c3c5dce4809d46675dee5ae58cc841 (patch)
treec14359f36b8d5738320b4a6a9f5dfdc191e8943c
parent2856d90378f1bef4cb9f26d0938b78bb6aefb17c (diff)
parent4d4ba7670ac60dc5906fe01f2d950c22aace1c18 (diff)
Merge 1.8 into master
-rw-r--r--share/qbs/modules/cpp/gcc.js17
-rw-r--r--src/lib/corelib/language/itemreadervisitorstate.cpp13
-rw-r--r--tests/auto/blackbox/testdata/response-files/response-files.qbs35
3 files changed, 60 insertions, 5 deletions
diff --git a/share/qbs/modules/cpp/gcc.js b/share/qbs/modules/cpp/gcc.js
index b92dd0447..34e955abb 100644
--- a/share/qbs/modules/cpp/gcc.js
+++ b/share/qbs/modules/cpp/gcc.js
@@ -1065,12 +1065,25 @@ function prepareLinker(project, product, inputs, outputs, input, output) {
args = wrapperArgs.concat(args);
}
+ var responseFileArgumentIndex = wrapperArgsLength;
+
+ // qcc doesn't properly handle response files, so we have to do it manually
+ var useQnxResponseFileHack = product.qbs.toolchain.contains("qcc")
+ && useCompilerDriverLinker(product, inputs);
+ if (useQnxResponseFileHack) {
+ // qcc needs to see at least one object/library file to think it has something to do,
+ // so start the response file at the second object file (so, 3 after the last -o option)
+ var idx = args.lastIndexOf("-o");
+ if (idx !== -1 && idx + 3 < args.length)
+ responseFileArgumentIndex += idx + 3;
+ }
+
cmd = new Command(linkerPath, args);
cmd.description = 'linking ' + primaryOutput.fileName + nativeConfigString(product);
cmd.highlight = 'linker';
cmd.relevantEnvironmentVariables = linkerEnvVars(product, inputs);
- cmd.responseFileArgumentIndex = wrapperArgsLength;
- cmd.responseFileUsagePrefix = '@';
+ cmd.responseFileArgumentIndex = responseFileArgumentIndex;
+ cmd.responseFileUsagePrefix = useQnxResponseFileHack ? "-Wl,@" : "@";
commands.push(cmd);
var debugInfo = outputs.debuginfo_app || outputs.debuginfo_dll
diff --git a/src/lib/corelib/language/itemreadervisitorstate.cpp b/src/lib/corelib/language/itemreadervisitorstate.cpp
index 96b694d5b..12f9330c5 100644
--- a/src/lib/corelib/language/itemreadervisitorstate.cpp
+++ b/src/lib/corelib/language/itemreadervisitorstate.cpp
@@ -158,9 +158,16 @@ Item *ItemReaderVisitorState::readFile(const QString &filePath, const QStringLis
file->setSearchPaths(searchPaths);
ItemReaderASTVisitor astVisitor(*this, file, itemPool, m_logger);
- cacheValue.setProcessingFlag(true);
- cacheValue.ast()->accept(&astVisitor);
- cacheValue.setProcessingFlag(false);
+ {
+ class ProcessingFlagManager {
+ public:
+ ProcessingFlagManager(ASTCacheValue &v) : m_cacheValue(v) { v.setProcessingFlag(true); }
+ ~ProcessingFlagManager() { m_cacheValue.setProcessingFlag(false); }
+ private:
+ ASTCacheValue &m_cacheValue;
+ } processingFlagManager(cacheValue);
+ cacheValue.ast()->accept(&astVisitor);
+ }
astVisitor.checkItemTypes();
return astVisitor.rootItem();
}
diff --git a/tests/auto/blackbox/testdata/response-files/response-files.qbs b/tests/auto/blackbox/testdata/response-files/response-files.qbs
index 7913287e1..2979fcdfd 100644
--- a/tests/auto/blackbox/testdata/response-files/response-files.qbs
+++ b/tests/auto/blackbox/testdata/response-files/response-files.qbs
@@ -34,4 +34,39 @@ Project {
}
}
}
+ Product {
+ name: "lotsofobjects"
+ type: ["dynamiclibrary"]
+ Depends { name: "cpp" }
+ Rule {
+ multiplex: true
+ outputFileTags: ["cpp"]
+ outputArtifacts: {
+ var artifacts = [];
+ for (var i = 0; i < 1000; ++i)
+ artifacts.push({filePath: "source-" + i + ".cpp", fileTags: ["cpp"]});
+ return artifacts;
+ }
+ prepare: {
+ var cmd = new JavaScriptCommand();
+ cmd.description = "generating " + outputs["cpp"].length + " dummy source files";
+ cmd.outputFilePaths = outputs["cpp"].map(function (a) {
+ return a.filePath;
+ });
+ cmd.sourceCode = function () {
+ var index = 0;
+ outputFilePaths.map(function (fp) {
+ var tf = new TextFile(fp, TextFile.WriteOnly);
+ try {
+ tf.writeLine("extern int foo" + index + "() { return 0; }");
+ ++index;
+ } finally {
+ tf.close();
+ }
+ });
+ };
+ return [cmd];
+ }
+ }
+ }
}