From 9f3efa796acb97ea4887468f1e8136e2e0711118 Mon Sep 17 00:00:00 2001
From: Peter Levine <plevine457@gmail.com>
Date: Fri, 13 May 2016 20:04:00 -0400
Subject: [PATCH] Remove -isystem from qmake due to QTBUG-53375

Change-Id: If0595fc2f209a48585e7e9b9a61f11c0d4e0664f
---
 mkspecs/common/clang.conf             |  1 -
 mkspecs/common/gcc-base.conf          |  1 -
 mkspecs/linux-icc/qmake.conf          |  1 -
 qmake/generators/unix/unixmake2.cpp   | 14 +++-----------
 qmake/generators/win32/mingw_make.cpp |  8 +-------
 5 files changed, 4 insertions(+), 21 deletions(-)

diff --git a/mkspecs/common/clang.conf b/mkspecs/common/clang.conf
index ee9c1b8..fbe370e 100644
--- a/mkspecs/common/clang.conf
+++ b/mkspecs/common/clang.conf
@@ -16,7 +16,6 @@ QMAKE_LINK_SHLIB        = $$QMAKE_CXX
 CONFIG                 += clang_pch_style
 QMAKE_PCH_OUTPUT_EXT    = .pch
 
-QMAKE_CFLAGS_ISYSTEM             = -isystem
 QMAKE_CFLAGS_PRECOMPILE          = -x c-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT}
 QMAKE_CFLAGS_USE_PRECOMPILE      = -Xclang -include-pch -Xclang ${QMAKE_PCH_OUTPUT}
 QMAKE_CFLAGS_LTCG                = -flto
diff --git a/mkspecs/common/gcc-base.conf b/mkspecs/common/gcc-base.conf
index 6e043f5..df8d314 100644
--- a/mkspecs/common/gcc-base.conf
+++ b/mkspecs/common/gcc-base.conf
@@ -44,7 +44,6 @@ QMAKE_CFLAGS_DEBUG         += -g
 QMAKE_CFLAGS_SHLIB         += -fPIC
 QMAKE_CFLAGS_STATIC_LIB    += -fPIC
 QMAKE_CFLAGS_APP           += -fPIC
-QMAKE_CFLAGS_ISYSTEM        = -isystem
 QMAKE_CFLAGS_YACC          += -Wno-unused -Wno-parentheses
 QMAKE_CFLAGS_HIDESYMS      += -fvisibility=hidden
 QMAKE_CFLAGS_EXCEPTIONS_OFF += -fno-exceptions
diff --git a/mkspecs/linux-icc/qmake.conf b/mkspecs/linux-icc/qmake.conf
index 495fd15..935833b 100644
--- a/mkspecs/linux-icc/qmake.conf
+++ b/mkspecs/linux-icc/qmake.conf
@@ -21,7 +21,6 @@ QMAKE_CFLAGS_DEBUG      = -O0 -g
 QMAKE_CFLAGS_SHLIB      = -fPIC
 QMAKE_CFLAGS_STATIC_LIB = $$QMAKE_CFLAGS_SHLIB
 QMAKE_CFLAGS_YACC       =
-QMAKE_CFLAGS_ISYSTEM    = -isystem
 QMAKE_CFLAGS_THREAD     = -D_REENTRANT
 QMAKE_CFLAGS_SPLIT_SECTIONS = -ffunction-sections
 QMAKE_CFLAGS_LTCG       = -ipo -fno-fat-lto-objects
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index 9312f19..009a674 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -176,16 +176,10 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
     t << "CXXFLAGS      = " << var("QMAKE_CXXFLAGS") << " $(DEFINES)\n";
     t << "INCPATH       =";
     {
-        QString isystem = var("QMAKE_CFLAGS_ISYSTEM");
         const ProStringList &incs = project->values("INCLUDEPATH");
         for(int i = 0; i < incs.size(); ++i) {
             const ProString &inc = incs.at(i);
-            if (inc.isEmpty())
-                continue;
-
-            if (!isystem.isEmpty() && isSystemInclude(inc.toQString()))
-                t << ' ' << isystem << ' ';
-            else
+            if (!inc.isEmpty())
                 t << " -I";
             t << escapeFilePath(inc);
         }
@@ -1328,10 +1322,8 @@ void UnixMakefileGenerator::init2()
     }
 
     if (include_deps && project->isActiveConfig("gcc_MD_depends")) {
-        // use -MMD if we know about -isystem too
-        ProString MD_flag(project->values("QMAKE_CFLAGS_ISYSTEM").isEmpty() ? "-MD" : "-MMD");
-        project->values("QMAKE_CFLAGS") += MD_flag;
-        project->values("QMAKE_CXXFLAGS") += MD_flag;
+        project->values("QMAKE_CFLAGS") += "-MD";
+        project->values("QMAKE_CXXFLAGS") += "-MD";
     }
 }
 
diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp
index 382b10c..c9eebd8 100644
--- a/qmake/generators/win32/mingw_make.cpp
+++ b/qmake/generators/win32/mingw_make.cpp
@@ -249,17 +249,11 @@ void MingwMakefileGenerator::writeIncPart(QTextStream &t)
 {
     t << "INCPATH       = ";
 
-    QString isystem = var("QMAKE_CFLAGS_ISYSTEM");
     const ProStringList &incs = project->values("INCLUDEPATH");
     for (ProStringList::ConstIterator incit = incs.begin(); incit != incs.end(); ++incit) {
         QString inc = (*incit).toQString();
         inc.replace(QRegExp("\\\\$"), "");
-
-        if (!isystem.isEmpty() && isSystemInclude(inc))
-            t << isystem << ' ';
-        else
-            t << "-I";
-        t << escapeFilePath(inc) << ' ';
+        t << "-I" << escapeFilePath(inc) << ' ';
     }
     t << endl;
 }
-- 
2.7.4

