CppTools: Allow to black list command line flags from project

...for debugging and workarounds if necessary.

Change-Id: If76cddb59fbd8e96f42d141bd5e5d03cd88ab30f
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Nikolai Kosjar
2019-02-12 09:46:25 +01:00
parent d74ce63ac9
commit 9e57c5db5d

View File

@@ -41,6 +41,7 @@
#include <QDir> #include <QDir>
#include <QRegularExpression> #include <QRegularExpression>
#include <QtGlobal>
namespace CppTools { namespace CppTools {
@@ -701,6 +702,10 @@ void CompilerOptionsBuilder::reset()
// QMakeProject: -pipe -Whello -g -std=gnu++11 -Wall -W -D_REENTRANT -fPIC // QMakeProject: -pipe -Whello -g -std=gnu++11 -Wall -W -D_REENTRANT -fPIC
void CompilerOptionsBuilder::evaluateCompilerFlags() void CompilerOptionsBuilder::evaluateCompilerFlags()
{ {
static QStringList userBlackList = QString::fromLocal8Bit(
qgetenv("QTC_CLANG_CMD_OPTIONS_BLACKLIST"))
.split(';', QString::SkipEmptyParts);
bool containsDriverMode = false; bool containsDriverMode = false;
bool skipNext = false; bool skipNext = false;
for (const QString &option : m_projectPart.compilerFlags) { for (const QString &option : m_projectPart.compilerFlags) {
@@ -709,6 +714,9 @@ void CompilerOptionsBuilder::evaluateCompilerFlags()
continue; continue;
} }
if (userBlackList.contains(option))
continue;
// Ignore warning flags as these interfere with our user-configured diagnostics. // Ignore warning flags as these interfere with our user-configured diagnostics.
// Note that once "-w" is provided, no warnings will be emitted, even if "-Wall" follows. // Note that once "-w" is provided, no warnings will be emitted, even if "-Wall" follows.
if (m_useBuildSystemWarnings == UseBuildSystemWarnings::No if (m_useBuildSystemWarnings == UseBuildSystemWarnings::No