[kdevelop/5.0] languages/plugins/custom-definesandincludes: Do not add compiler specific include paths twice

Sven Brauch mail at svenbrauch.de
Wed Jul 13 22:00:36 UTC 2016


Git commit c9072bb4f3e3a6033cce30e35323f14976554d8b by Sven Brauch.
Committed on 13/07/2016 at 21:59.
Pushed by brauch into branch '5.0'.

Do not add compiler specific include paths twice

This fixes the "stdlib.h: file not found" issue.
CCMAIL:kdevelop-devel at kde.org

M  +12   -2    languages/plugins/custom-definesandincludes/definesandincludesmanager.cpp

http://commits.kde.org/kdevelop/c9072bb4f3e3a6033cce30e35323f14976554d8b

diff --git a/languages/plugins/custom-definesandincludes/definesandincludesmanager.cpp b/languages/plugins/custom-definesandincludes/definesandincludesmanager.cpp
index ebceb4d..df1be68 100644
--- a/languages/plugins/custom-definesandincludes/definesandincludesmanager.cpp
+++ b/languages/plugins/custom-definesandincludes/definesandincludesmanager.cpp
@@ -174,9 +174,19 @@ Path::List DefinesAndIncludesManager::includes( ProjectBaseItem* item, Type type
     }
 
     for (auto provider : m_providers) {
-        if (provider->type() & type) {
-            includes += provider->includes(item);
+        if ( !(provider->type() & type) ) {
+            continue;
+        }
+        auto newItems = provider->includes(item);
+        if ( provider->type() & DefinesAndIncludesManager::CompilerSpecific ) {
+            // If an item occurs in the "compiler specific" list, but was previously supplied
+            // in the user include path list already, remove it from there.
+            // Re-ordering the system include paths causes confusion in some cases.
+            Q_FOREACH (const auto& x, newItems ) {
+                includes.removeAll(x);
+            }
         }
+        includes += newItems;
     }
 
     includes += m_noProjectIPM->includesAndDefines(item->path().path()).first;


More information about the KDevelop-devel mailing list