aboutsummaryrefslogtreecommitdiffstats
path: root/share/qbs/modules/cpp/gcc.js
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2017-03-10 10:21:58 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2017-04-12 11:32:21 +0000
commit5b0fb36b2c160b4993780eb90213c351cdf91dcf (patch)
tree9282422d814e3967a735cc474d10ebd02e5fbc56 /share/qbs/modules/cpp/gcc.js
parente763a4f6c3f3a5786fe180241d64cf9318a3d11d (diff)
GCC: remove escaped linker flags compatibility mode
The old warning was incredibly noisy and almost always unnecessary. Users should have had enough time to migrate their projects by now, so specifying pre-escaped linker flags will now properly result in a linker error, but a helpful warning remains by default, which is only emitted if the linker flags look suspicious to begin with. Change-Id: I1ad1e9647fd490619eeb65eeb88f5bbbf58aa18f Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Diffstat (limited to 'share/qbs/modules/cpp/gcc.js')
-rw-r--r--share/qbs/modules/cpp/gcc.js32
1 files changed, 16 insertions, 16 deletions
diff --git a/share/qbs/modules/cpp/gcc.js b/share/qbs/modules/cpp/gcc.js
index e6377dcec..7c6108870 100644
--- a/share/qbs/modules/cpp/gcc.js
+++ b/share/qbs/modules/cpp/gcc.js
@@ -173,14 +173,11 @@ function collectLibraryDependencies(product) {
return result;
}
-function escapeLinkerFlags(product, inputs, linkerFlags, allowEscape) {
- if (allowEscape === undefined)
- allowEscape = true;
-
+function escapeLinkerFlags(product, inputs, linkerFlags) {
if (!linkerFlags || linkerFlags.length === 0)
return [];
- if (useCompilerDriverLinker(product, inputs) && allowEscape) {
+ if (useCompilerDriverLinker(product, inputs)) {
var sep = ",";
var useXlinker = linkerFlags.some(function (f) { return f.contains(sep); });
if (useXlinker) {
@@ -188,11 +185,23 @@ function escapeLinkerFlags(product, inputs, linkerFlags, allowEscape) {
// Use -Xlinker to handle these
var xlinkerFlags = [];
linkerFlags.map(function (linkerFlag) {
+ if (product.cpp.enableSuspiciousLinkerFlagWarnings
+ && linkerFlag.startsWith("-Wl,")) {
+ console.warn("Encountered escaped linker flag '" + linkerFlag + "'. This may " +
+ "cause the target to fail to link. Please do not escape these " +
+ "flags manually; qbs does that for you.");
+ }
xlinkerFlags.push("-Xlinker", linkerFlag);
});
return xlinkerFlags;
}
+ if (product.cpp.enableSuspiciousLinkerFlagWarnings && linkerFlags.contains("-Xlinker")) {
+ console.warn("Encountered -Xlinker linker flag escape sequence. This may cause the " +
+ "target to fail to link. Please do not escape these flags manually; " +
+ "qbs does that for you.");
+ }
+
// If no linker arguments contain the separator character we can just use -Wl,
// which is more compact and easier to read in logs
return [["-Wl"].concat(linkerFlags).join(sep)];
@@ -335,19 +344,10 @@ function linkerFlags(project, product, inputs, output) {
if (isDarwin && product.cpp.warningLevel === "none")
args.push('-w');
- var allowEscape = !ModUtils.checkCompatibilityMode(project, "1.6",
- "Enabling linker flags compatibility mode. cpp.linkerFlags and " +
- "cpp.platformLinkerFlags escaping is handled automatically beginning in Qbs 1.6. " +
- "When upgrading to Qbs 1.6, you should only pass raw linker flags to these " +
- "properties; do not escape them using -Wl or -Xlinker. This allows Qbs to " +
- "automatically supply the correct linker flags regardless of whether the " +
- "linker chosen is the compiler driver or system linker (see the documentation for " +
- "cpp.linkerMode for more information).");
-
args = args.concat(configFlags(product, useCompilerDriverLinker(product, inputs)));
args = args.concat(escapeLinkerFlags(
- product, inputs, product.cpp.platformLinkerFlags, allowEscape));
- args = args.concat(escapeLinkerFlags(product, inputs, product.cpp.linkerFlags, allowEscape));
+ product, inputs, product.cpp.platformLinkerFlags));
+ args = args.concat(escapeLinkerFlags(product, inputs, product.cpp.linkerFlags));
args.push("-o", output.filePath);