GccToolChain: Pass platform flags to more querying functions

Fixes: QTCREATORBUG-23458
Change-Id: I33e542b6733b6a0162e8c9802e151e76727ed4fe
Reviewed-by: Kevin Puetz <PuetzKevinA@JohnDeere.com>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2020-01-20 10:47:55 +01:00
parent 5a2a70adda
commit 737667d289

View File

@@ -231,15 +231,19 @@ static GccToolChain::DetectedAbisResult guessGccAbi(const FilePath &path, const
return GccToolChain::DetectedAbisResult(guessGccAbi(machine, macros), machine); return GccToolChain::DetectedAbisResult(guessGccAbi(machine, macros), machine);
} }
static QString gccVersion(const FilePath &path, const QStringList &env) static QString gccVersion(const FilePath &path, const QStringList &env,
const QStringList &extraArgs)
{ {
QStringList arguments("-dumpversion"); QStringList arguments = extraArgs;
arguments << "-dumpversion";
return QString::fromLocal8Bit(runGcc(path, arguments, env)).trimmed(); return QString::fromLocal8Bit(runGcc(path, arguments, env)).trimmed();
} }
static Utils::FilePath gccInstallDir(const FilePath &path, const QStringList &env) static Utils::FilePath gccInstallDir(const FilePath &path, const QStringList &env,
const QStringList &extraArgs = {})
{ {
const QStringList arguments("-print-search-dirs"); QStringList arguments = extraArgs;
arguments << "-print-search-dirs";
QString output = QString::fromLocal8Bit(runGcc(path, arguments, env)).trimmed(); QString output = QString::fromLocal8Bit(runGcc(path, arguments, env)).trimmed();
// Expected output looks like this: // Expected output looks like this:
// install: /usr/lib/gcc/x86_64-linux-gnu/7/ // install: /usr/lib/gcc/x86_64-linux-gnu/7/
@@ -881,14 +885,16 @@ QString GccToolChain::detectVersion() const
{ {
Environment env = Environment::systemEnvironment(); Environment env = Environment::systemEnvironment();
addToEnvironment(env); addToEnvironment(env);
return gccVersion(findLocalCompiler(m_compilerCommand, env), env.toStringList()); return gccVersion(findLocalCompiler(m_compilerCommand, env), env.toStringList(),
filteredFlags(platformCodeGenFlags(), true));
} }
Utils::FilePath GccToolChain::detectInstallDir() const Utils::FilePath GccToolChain::detectInstallDir() const
{ {
Environment env = Environment::systemEnvironment(); Environment env = Environment::systemEnvironment();
addToEnvironment(env); addToEnvironment(env);
return gccInstallDir(findLocalCompiler(m_compilerCommand, env), env.toStringList()); return gccInstallDir(findLocalCompiler(m_compilerCommand, env), env.toStringList(),
filteredFlags(platformCodeGenFlags(), true));
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------