[gjs: 3/6] maint: Fix IWYU includes




commit d925bf6d7d746899f97c99a42c818e6794c7f90b
Author: Philip Chimento <philip chimento gmail com>
Date:   Sat Oct 9 13:01:20 2021 -0700

    maint: Fix IWYU includes
    
    The inline headers previously would not compile standalone, so they were
    not being analyzed. Also check all IWYU pragmas to see if they are still
    necessary; some of them were not.
    
    The pragmas in gi/utils-inl.h are a result of CPPLINT requiring <utility>
    for std::swap() even though it is also defined in <algorithm>, and IWYU
    not picking up any of these three headers.

 gi/js-value-inl.h                 | 9 ++++++++-
 gi/utils-inl.h                    | 3 ++-
 gjs/atoms.cpp                     | 1 -
 gjs/deprecation.cpp               | 1 -
 gjs/gjs_pch.hh                    | 1 +
 gjs/jsapi-util-root.h             | 7 +++----
 modules/cairo-radial-gradient.cpp | 1 -
 7 files changed, 14 insertions(+), 9 deletions(-)
---
diff --git a/gi/js-value-inl.h b/gi/js-value-inl.h
index cbe1807a..1aa12bda 100644
--- a/gi/js-value-inl.h
+++ b/gi/js-value-inl.h
@@ -7,11 +7,18 @@
 #include <config.h>
 
 #include <stdint.h>
+
+#include <cmath>  // for isnan
 #include <limits>
-#include <type_traits>
 
 #include <girepository.h>
+#include <glib-object.h>
+#include <glib.h>
+
 #include <js/Conversions.h>
+#include <js/RootingAPI.h>
+#include <js/TypeDecls.h>
+#include <js/Utility.h>  // for UniqueChars
 
 #include "gi/gtype.h"
 #include "gi/value.h"
diff --git a/gi/utils-inl.h b/gi/utils-inl.h
index 4806c673..96a17da3 100644
--- a/gi/utils-inl.h
+++ b/gi/utils-inl.h
@@ -8,8 +8,9 @@
 
 #include <stdint.h>
 
+#include <algorithm>    // IWYU pragma: keep (for find)
 #include <type_traits>  // IWYU pragma: keep
-#include <utility>
+#include <utility>      // IWYU pragma: keep (for swap)
 #include <vector>
 
 template <typename T>
diff --git a/gjs/atoms.cpp b/gjs/atoms.cpp
index ce8c125c..3a40b927 100644
--- a/gjs/atoms.cpp
+++ b/gjs/atoms.cpp
@@ -15,7 +15,6 @@
 #include <jsapi.h>  // for JS_AtomizeAndPinString
 
 #include "gjs/atoms.h"
-#include "gjs/jsapi-util.h"  // IWYU pragma: keep
 
 bool GjsAtom::init(JSContext* cx, const char* str) {
     JSString* s = JS_AtomizeAndPinString(cx, str);
diff --git a/gjs/deprecation.cpp b/gjs/deprecation.cpp
index 3fdd64d4..0a64caa2 100644
--- a/gjs/deprecation.cpp
+++ b/gjs/deprecation.cpp
@@ -23,7 +23,6 @@
 #include <jsfriendapi.h>  // for FormatStackDump
 
 #include "gjs/deprecation.h"
-#include "gjs/jsapi-util.h"  // IWYU pragma: keep
 #include "gjs/macros.h"
 
 const char* messages[] = {
diff --git a/gjs/gjs_pch.hh b/gjs/gjs_pch.hh
index cee7471c..f7c72c4c 100644
--- a/gjs/gjs_pch.hh
+++ b/gjs/gjs_pch.hh
@@ -7,6 +7,7 @@
 
 #include <algorithm>
 #include <atomic>
+#include <cmath>
 #include <cstddef>
 #include <deque>
 #include <forward_list>
diff --git a/gjs/jsapi-util-root.h b/gjs/jsapi-util-root.h
index 6758c722..53223375 100644
--- a/gjs/jsapi-util-root.h
+++ b/gjs/jsapi-util-root.h
@@ -8,20 +8,19 @@
 
 #include <config.h>
 
-#include <stdint.h>  // for uintptr_t
-
 #include <cstddef>  // for nullptr_t
 #include <memory>
 #include <new>
 #include <type_traits>  // for enable_if_t, is_pointer
 
-#include <glib-object.h>
 #include <glib.h>
 
+#include <js/GCAPI.h>
+#include <js/HeapAPI.h>
+#include <js/RootingAPI.h>
 #include <js/TracingAPI.h>
 #include <js/TypeDecls.h>
 
-#include "gjs/macros.h"
 #include "util/log.h"
 
 /* jsapi-util-root.h - Utilities for dealing with the lifetime and ownership of
diff --git a/modules/cairo-radial-gradient.cpp b/modules/cairo-radial-gradient.cpp
index a4936148..3f558a3d 100644
--- a/modules/cairo-radial-gradient.cpp
+++ b/modules/cairo-radial-gradient.cpp
@@ -14,7 +14,6 @@
 #include <jspubtd.h>  // for JSProtoKey
 
 #include "gjs/jsapi-util-args.h"
-#include "gjs/jsapi-util.h"  // IWYU pragma: keep
 #include "modules/cairo-private.h"
 
 namespace JS {


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