From 9e57c5db5d034b383ba6d5879e7f5d01fff0bb40 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Tue, 12 Feb 2019 09:46:25 +0100 Subject: [PATCH] CppTools: Allow to black list command line flags from project ...for debugging and workarounds if necessary. Change-Id: If76cddb59fbd8e96f42d141bd5e5d03cd88ab30f Reviewed-by: Ivan Donchevskii --- src/plugins/cpptools/compileroptionsbuilder.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/plugins/cpptools/compileroptionsbuilder.cpp b/src/plugins/cpptools/compileroptionsbuilder.cpp index 3f44a977c94..e5685dc5e05 100644 --- a/src/plugins/cpptools/compileroptionsbuilder.cpp +++ b/src/plugins/cpptools/compileroptionsbuilder.cpp @@ -41,6 +41,7 @@ #include #include +#include namespace CppTools { @@ -701,6 +702,10 @@ void CompilerOptionsBuilder::reset() // QMakeProject: -pipe -Whello -g -std=gnu++11 -Wall -W -D_REENTRANT -fPIC void CompilerOptionsBuilder::evaluateCompilerFlags() { + static QStringList userBlackList = QString::fromLocal8Bit( + qgetenv("QTC_CLANG_CMD_OPTIONS_BLACKLIST")) + .split(';', QString::SkipEmptyParts); + bool containsDriverMode = false; bool skipNext = false; for (const QString &option : m_projectPart.compilerFlags) { @@ -709,6 +714,9 @@ void CompilerOptionsBuilder::evaluateCompilerFlags() continue; } + if (userBlackList.contains(option)) + continue; + // 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. if (m_useBuildSystemWarnings == UseBuildSystemWarnings::No