From 4cd527f496afda258a9fa2341181956b0946c119 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Mon, 8 Oct 2018 14:10:20 +0200 Subject: [PATCH] ProjectExplorer/MSVC: Ignore warning options when looking for predefined macros ...since they should not have any effect on the macros. This potentially also reduces the cache. Change-Id: If50cfa50ce0fb29dff291bf2c329532fc6284644 Reviewed-by: David Schulz Reviewed-by: Ivan Donchevskii --- src/plugins/projectexplorer/abstractmsvctoolchain.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/plugins/projectexplorer/abstractmsvctoolchain.cpp b/src/plugins/projectexplorer/abstractmsvctoolchain.cpp index 3983734c753..49f59dac2db 100644 --- a/src/plugins/projectexplorer/abstractmsvctoolchain.cpp +++ b/src/plugins/projectexplorer/abstractmsvctoolchain.cpp @@ -146,10 +146,15 @@ LanguageVersion static languageVersionForMsvc(const Core::Id &language, const Ma } } -bool static hasFlagEffectOnMacros(const QString &arg) +bool static hasFlagEffectOnMacros(const QString &flag) { - if (arg.startsWith("-I")) - return false; + if (flag.startsWith("-") || flag.startsWith("/")) { + const QString f = flag.mid(1); + if (f.startsWith("I")) + return false; // Skip include paths + if (f.startsWith("w", Qt::CaseInsensitive)) + return false; // Skip warning options + } return true; }