[gnome-builder/gnome-builder-43] plugins/clang: filter out some unsupported keywords



commit bc06634b6f5f8e6388814889a615bd562c6011ce
Author: Christian Hergert <chergert redhat com>
Date:   Thu Sep 29 22:35:20 2022 -0700

    plugins/clang: filter out some unsupported keywords
    
    Clang bails on things like '-Wstrict-null-sentinel' which is getting passed
    in Inkscape's build flags. Easy enough to just filter things we know wont
    make Clang happy.

 src/plugins/clang/ide-clang.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/clang/ide-clang.c b/src/plugins/clang/ide-clang.c
index dfd99cde1..2880f931d 100644
--- a/src/plugins/clang/ide-clang.c
+++ b/src/plugins/clang/ide-clang.c
@@ -64,6 +64,8 @@ typedef struct
 
 G_DEFINE_FINAL_TYPE (IdeClang, ide_clang, G_TYPE_OBJECT)
 
+static GHashTable *unsupported_by_clang;
+
 static void
 unsaved_files_free (UnsavedFiles *uf)
 {
@@ -231,10 +233,13 @@ ide_clang_cook_flags (const gchar         *path,
     {
       for (guint i = 0; flags[i]; i++)
         {
-          g_ptr_array_add (cooked, g_strdup (flags[i]));
-
           is_cplusplus |= is_cplusplus_param (flags[i]);
 
+          if (g_hash_table_contains (unsupported_by_clang, flags[i]))
+            continue;
+
+          g_ptr_array_add (cooked, g_strdup (flags[i]));
+
           if (g_strcmp0 (include, flags[i]) == 0)
             g_clear_pointer (&include, g_free);
         }
@@ -530,6 +535,9 @@ ide_clang_class_init (IdeClangClass *klass)
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
   object_class->finalize = ide_clang_finalize;
+
+  unsupported_by_clang = g_hash_table_new (g_str_hash, g_str_equal);
+  g_hash_table_add (unsupported_by_clang, (char *)"-Wstrict-null-sentinel");
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]