[gjs: 9/12] CI: Make necessary changes to includes for IWYU 0.15




commit 7fc69d9b171f18fbc6201027d9f34f1f48d8cb22
Author: Philip Chimento <philip chimento gmail com>
Date:   Tue Nov 24 12:17:43 2020 -0800

    CI: Make necessary changes to includes for IWYU 0.15
    
    IWYU 0.15 improves the accuracy of detecting missing includes, and also
    removes a few false positives but also adds new false positives. Since we
    are now running 0.15 in CI, we must adapt the postprocessing script, and
    make the necessary changes to the source files.

 gi/boxed.h                |  2 +-
 gi/object.h               |  2 +-
 gi/union.cpp              |  1 +
 gjs/atoms.cpp             |  3 +--
 gjs/context-private.h     | 10 +++-------
 gjs/context.cpp           |  1 -
 gjs/deprecation.cpp       |  3 +--
 gjs/jsapi-util-string.cpp |  3 +--
 gjs/profiler.cpp          |  4 +---
 gjs/stack.cpp             |  3 +--
 modules/cairo.cpp         |  3 +--
 modules/print.cpp         |  3 +--
 test/gjs-test-rooting.cpp |  1 +
 tools/process_iwyu.py     | 14 ++++++++++++--
 14 files changed, 26 insertions(+), 27 deletions(-)
---
diff --git a/gi/boxed.h b/gi/boxed.h
index 6bb1f180..dfcbe637 100644
--- a/gi/boxed.h
+++ b/gi/boxed.h
@@ -16,10 +16,10 @@
 #include <glib.h>
 
 #include <js/GCHashTable.h>  // for GCHashMap
+#include <js/HashTable.h>    // for DefaultHasher
 #include <js/Id.h>
 #include <js/RootingAPI.h>
 #include <js/TypeDecls.h>
-#include <mozilla/HashTable.h>  // for DefaultHasher
 
 #include "gi/wrapperutils.h"
 #include "gjs/jsapi-util.h"
diff --git a/gi/object.h b/gi/object.h
index 485af245..fc56f671 100644
--- a/gi/object.h
+++ b/gi/object.h
@@ -18,13 +18,13 @@
 #include <glib.h>
 
 #include <js/GCHashTable.h>  // for GCHashMap
+#include <js/HashTable.h>    // for DefaultHasher
 #include <js/Id.h>
 #include <js/PropertySpec.h>
 #include <js/RootingAPI.h>
 #include <js/TypeDecls.h>
 #include <jsfriendapi.h>            // for JSID_IS_ATOM, JSID_TO_ATOM
 #include <mozilla/HashFunctions.h>  // for HashGeneric, HashNumber
-#include <mozilla/HashTable.h>      // for DefaultHasher
 #include <mozilla/Likely.h>         // for MOZ_LIKELY
 
 #include "gi/wrapperutils.h"
diff --git a/gi/union.cpp b/gi/union.cpp
index 1387ceb0..a91225d4 100644
--- a/gi/union.cpp
+++ b/gi/union.cpp
@@ -5,6 +5,7 @@
 #include <config.h>
 
 #include <girepository.h>
+#include <glib.h>  // for g_atomic_rc_box_acquire, ...
 
 #include <js/CallArgs.h>
 #include <js/Class.h>
diff --git a/gjs/atoms.cpp b/gjs/atoms.cpp
index 3f9dd858..9ff286f1 100644
--- a/gjs/atoms.cpp
+++ b/gjs/atoms.cpp
@@ -7,6 +7,7 @@
 
 #include <config.h>
 
+#include <js/GCPolicyAPI.h>
 #include <js/Id.h>
 #include <js/RootingAPI.h>
 #include <js/Symbol.h>
@@ -18,8 +19,6 @@
 
 // Avoid static_assert in MSVC builds
 namespace JS {
-template <typename T> struct GCPolicy;
-
 template <>
 struct GCPolicy<void*> : public IgnoreGCPolicy<void*> {};
 }
diff --git a/gjs/context-private.h b/gjs/context-private.h
index e5af87e5..8add9c2b 100644
--- a/gjs/context-private.h
+++ b/gjs/context-private.h
@@ -17,15 +17,16 @@
 #include <glib.h>
 
 #include <js/GCHashTable.h>
+#include <js/GCPolicyAPI.h>
 #include <js/GCVector.h>
+#include <js/HashTable.h>  // for DefaultHasher
 #include <js/Promise.h>
 #include <js/RootingAPI.h>
 #include <js/TypeDecls.h>
+#include <js/UniquePtr.h>
 #include <js/ValueArray.h>
 #include <jsapi.h>        // for JS_GetContextPrivate
 #include <jsfriendapi.h>  // for ScriptEnvironmentPreparer
-#include <mozilla/HashTable.h>  // for DefaultHasher
-#include <mozilla/UniquePtr.h>
 
 #include "gjs/context.h"
 #include "gjs/jsapi-util.h"
@@ -56,11 +57,6 @@ using GTypeNotUint64 =
 // The GC sweep method should ignore FundamentalTable and GTypeTable's key types
 namespace JS {
 // Forward declarations
-template <typename T>
-class WeakCache;
-template <typename T>
-struct GCPolicy;
-
 template <>
 struct GCPolicy<void*> : public IgnoreGCPolicy<void*> {};
 // We need GCPolicy<GType> for GTypeTable. SpiderMonkey already defines
diff --git a/gjs/context.cpp b/gjs/context.cpp
index 6131e641..f302409c 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -45,7 +45,6 @@
 #include <js/TracingAPI.h>
 #include <js/TypeDecls.h>
 #include <js/UniquePtr.h>
-#include <js/Utility.h>  // for DeletePolicy
 #include <js/Value.h>
 #include <js/ValueArray.h>
 #include <jsapi.h>        // for JS_IsExceptionPending, ...
diff --git a/gjs/deprecation.cpp b/gjs/deprecation.cpp
index 1d32b045..f48f87d9 100644
--- a/gjs/deprecation.cpp
+++ b/gjs/deprecation.cpp
@@ -15,6 +15,7 @@
 
 #include <js/CharacterEncoding.h>
 #include <js/Conversions.h>
+#include <js/GCPolicyAPI.h>
 #include <js/RootingAPI.h>
 #include <js/TypeDecls.h>
 #include <js/Utility.h>  // for UniqueChars
@@ -27,8 +28,6 @@
 
 // Avoid static_assert in MSVC builds
 namespace JS {
-template <typename T> struct GCPolicy;
-
 template <>
 struct GCPolicy<void*> : public IgnoreGCPolicy<void*> {};
 }
diff --git a/gjs/jsapi-util-string.cpp b/gjs/jsapi-util-string.cpp
index 7af50639..28182cec 100644
--- a/gjs/jsapi-util-string.cpp
+++ b/gjs/jsapi-util-string.cpp
@@ -19,6 +19,7 @@
 #include <js/Class.h>
 #include <js/ComparisonOperators.h>
 #include <js/GCAPI.h>  // for AutoCheckCannotGC
+#include <js/GCPolicyAPI.h>
 #include <js/Id.h>     // for JSID_IS_STRING...
 #include <js/RootingAPI.h>
 #include <js/Symbol.h>
@@ -33,8 +34,6 @@
 
 // Avoid static_assert in MSVC builds
 namespace JS {
-template <typename T> struct GCPolicy;
-
 template <>
 struct GCPolicy<void*> : public IgnoreGCPolicy<void*> {};
 }
diff --git a/gjs/profiler.cpp b/gjs/profiler.cpp
index 20d5463d..2d342498 100644
--- a/gjs/profiler.cpp
+++ b/gjs/profiler.cpp
@@ -13,14 +13,12 @@
 #ifdef ENABLE_PROFILER
 #    include <alloca.h>
 #    include <errno.h>
-#    include <stddef.h>  // for size_t
 #    include <stdint.h>
 #    include <stdio.h>      // for sscanf
 #    include <string.h>     // for memcpy, strlen
-#    include <sys/time.h>   // for CLOCK_MONOTONIC
 #    include <sys/types.h>  // for timer_t
 #    include <syscall.h>    // for __NR_gettid
-#    include <time.h>       // for itimerspec, timer_delete, ...
+#    include <time.h>       // for size_t, CLOCK_MONOTONIC, itimerspec, ...
 #    ifdef HAVE_UNISTD_H
 #        include <unistd.h>  // for getpid, syscall
 #    endif
diff --git a/gjs/stack.cpp b/gjs/stack.cpp
index 762890f9..cdf56915 100644
--- a/gjs/stack.cpp
+++ b/gjs/stack.cpp
@@ -9,6 +9,7 @@
 #include <glib-object.h>
 #include <glib.h>
 
+#include <js/GCPolicyAPI.h>
 #include <js/TypeDecls.h>
 #include <jsfriendapi.h>  // for DumpBacktrace
 
@@ -17,8 +18,6 @@
 
 // Avoid static_assert in MSVC builds
 namespace JS {
-template <typename T> struct GCPolicy;
-
 template <>
 struct GCPolicy<void*> : public IgnoreGCPolicy<void*> {};
 }
diff --git a/modules/cairo.cpp b/modules/cairo.cpp
index 136dbfa7..172de91c 100644
--- a/modules/cairo.cpp
+++ b/modules/cairo.cpp
@@ -7,6 +7,7 @@
 #include <cairo-features.h>  // for CAIRO_HAS_PDF_SURFACE, CAIRO_HAS_PS_SURFA...
 #include <cairo.h>
 
+#include <js/GCPolicyAPI.h>
 #include <js/RootingAPI.h>
 #include <js/TypeDecls.h>
 #include <jsapi.h>  // for JS_NewPlainObject
@@ -16,8 +17,6 @@
 
 // Avoid static_assert in MSVC builds
 namespace JS {
-template <typename T> struct GCPolicy;
-
 template <>
 struct GCPolicy<void*> : public IgnoreGCPolicy<void*> {};
 }
diff --git a/modules/print.cpp b/modules/print.cpp
index 92ced83f..e73a35af 100644
--- a/modules/print.cpp
+++ b/modules/print.cpp
@@ -10,6 +10,7 @@
 #include <js/CallArgs.h>
 #include <js/CharacterEncoding.h>  // for JS_EncodeStringToUTF8
 #include <js/Conversions.h>
+#include <js/GCPolicyAPI.h>
 #include <js/PropertySpec.h>  // for JS_FN, JSFunctionSpec, JS_FS_END
 #include <js/RootingAPI.h>
 #include <js/TypeDecls.h>
@@ -21,8 +22,6 @@
 
 // Avoid static_assert in MSVC builds
 namespace JS {
-template <typename T> struct GCPolicy;
-
 template <>
 struct GCPolicy<void*> : public IgnoreGCPolicy<void*> {};
 }
diff --git a/test/gjs-test-rooting.cpp b/test/gjs-test-rooting.cpp
index cfdd6af3..72a66f4d 100644
--- a/test/gjs-test-rooting.cpp
+++ b/test/gjs-test-rooting.cpp
@@ -3,6 +3,7 @@
 
 #include <config.h>
 
+#include <glib-object.h>  // for g_object_weak_unref, g_object_weak_ref
 #include <glib.h>
 
 #include <js/Class.h>
diff --git a/tools/process_iwyu.py b/tools/process_iwyu.py
index 2479e342..df8d1559 100755
--- a/tools/process_iwyu.py
+++ b/tools/process_iwyu.py
@@ -73,11 +73,21 @@ FALSE_POSITIVES = (
     ('gjs/importer.cpp', '#include <algorithm>', 'for max'),
     ('modules/cairo-context.cpp', '#include <algorithm>', 'for max'),
 
+    # False positive when using Mozilla vectors' append() and
+    # infallibleAppend()
+    ('gi/function.cpp', '#include <utility>', 'for forward'),
+    ('gi/ns.cpp', '#include <utility>', 'for forward'),
+    ('gi/value.cpp', '#include <utility>', 'for forward'),
+    ('gjs/importer.cpp', '#include <utility>', 'for forward'),
+    ('gjs/module.cpp', '#include <utility>', 'for forward'),
+
     # False positive when using EnumType operators
-    ('gi/arg-cache.cpp', '#include <type_traits>', 'for enable_if_t'),
+    ('gi/arg-cache.h', '#include <type_traits>', 'for enable_if_t'),
+    ('modules/cairo-context.cpp', '#include <type_traits>', 'for enable_if_t'),
+    ('modules/cairo-region.cpp', '#include <type_traits>', 'for enable_if_t'),
+    ('modules/cairo-surface.cpp', '#include <type_traits>', 'for enable_if_t'),
 
     # False positive when using GjsAutoPointer
-    ('gi/boxed.cpp', '#include <type_traits>', 'for remove_reference<>::type'),
     ('gi/object.cpp', '#include <type_traits>',
      'for remove_reference<>::type'),
     ('gi/private.cpp', '#include <type_traits>',


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