[gjs: 7/13] build: Annotate all unused arguments



commit ba402686184acbd8fcf823706ae7e25e9b793e2d
Author: Philip Chimento <philip chimento gmail com>
Date:   Sun Mar 24 21:23:50 2019 -0700

    build: Annotate all unused arguments
    
    In order to compile cleanly with -Wunused-parameter, we annotate all
    unused function parameters. We do have a lot of these, as we make heavy
    use of callbacks and don't always need all the parameters of these
    callbacks.
    
    If the parameter name does not carry any meaning (for example,
    JSContext* cx, or void* user_data) then we just delete the name and
    leave the type to indicate that it is intentionally unused. If the name
    is important, then we annotate the parameter with G_GNUC_UNUSED.
    
    In the case where a parameter is used in one branch of an #ifdef only,
    we mark it in the other branch with a (void) cast.

 gi/boxed.cpp                       |   4 +-
 gi/closure.cpp                     |  15 +---
 gi/function.cpp                    |  13 +---
 gi/fundamental.cpp                 |   2 +-
 gi/gobject.cpp                     |  13 ++--
 gi/interface.cpp                   |   2 +-
 gi/ns.cpp                          |   5 +-
 gi/object.cpp                      |  27 +++----
 gi/param.cpp                       |   5 +-
 gi/repo.cpp                        |   5 +-
 gi/union.cpp                       |   2 +-
 gi/wrapperutils.h                  |  16 ++---
 gjs/byteArray.cpp                  |   8 ++-
 gjs/console.cpp                    |   9 +--
 gjs/context.cpp                    |   8 +--
 gjs/coverage.cpp                   |   5 +-
 gjs/engine.cpp                     |  24 ++-----
 gjs/importer.cpp                   |   4 +-
 gjs/jsapi-class.h                  |   6 +-
 gjs/jsapi-util-args.h              |  26 +++----
 gjs/jsapi-util-error.cpp           |   5 +-
 gjs/jsapi-util-root.h              |   6 +-
 gjs/jsapi-util.cpp                 |   2 +
 gjs/jsapi-util.h                   |   4 +-
 gjs/module.cpp                     |   7 +-
 gjs/profiler.cpp                   |   6 ++
 libgjs-private/gjs-gdbus-wrapper.c |  43 ++++-------
 modules/cairo-context.cpp          |  12 +---
 modules/cairo-path.cpp             |   5 +-
 modules/cairo-pattern.cpp          |   5 +-
 modules/cairo-region.cpp           |  12 +---
 modules/cairo-surface.cpp          |  12 +---
 modules/console.cpp                |   6 +-
 test/gjs-test-coverage.cpp         | 144 ++++++++++++-------------------------
 test/gjs-test-rooting.cpp          |  82 +++++++--------------
 test/gjs-test-utils.cpp            |  10 +--
 test/gjs-tests.cpp                 |  48 +++++--------
 37 files changed, 197 insertions(+), 411 deletions(-)
---
diff --git a/gi/boxed.cpp b/gi/boxed.cpp
index 531c5e5d..7073924a 100644
--- a/gi/boxed.cpp
+++ b/gi/boxed.cpp
@@ -56,7 +56,7 @@ static bool struct_is_simple(GIStructInfo *info);
 
 // See GIWrapperBase::resolve().
 bool BoxedPrototype::resolve_impl(JSContext* cx, JS::HandleObject obj,
-                                  JS::HandleId id, const char* prop_name,
+                                  JS::HandleId, const char* prop_name,
                                   bool* resolved) {
     // Look for methods and other class properties
     GjsAutoFunctionInfo method_info =
@@ -1034,7 +1034,7 @@ JSObject* BoxedInstance::new_for_c_struct(JSContext* cx, GIStructInfo* info,
  * the passed-in pointer, while the normal method will take a reference, or if
  * the boxed type can be directly allocated, copy the memory.
  */
-bool BoxedInstance::init_from_c_struct(JSContext* cx, void* gboxed, NoCopy) {
+bool BoxedInstance::init_from_c_struct(JSContext*, void* gboxed, NoCopy) {
     // We need to create a JS Boxed which references the original C struct, not
     // a copy of it. Used for G_SIGNAL_TYPE_STATIC_SCOPE.
     share_ptr(gboxed);
diff --git a/gi/closure.cpp b/gi/closure.cpp
index ee67d531..9d48e830 100644
--- a/gi/closure.cpp
+++ b/gi/closure.cpp
@@ -125,10 +125,7 @@ static void global_context_finalized(JS::HandleFunction func, void* data) {
  *
  * Unlike "dispose" invalidation only happens once.
  */
-static void
-closure_invalidated(gpointer data,
-                    GClosure *closure)
-{
+static void closure_invalidated(void*, GClosure* closure) {
     Closure *c;
 
     c = &((GjsClosure*) closure)->priv;
@@ -158,10 +155,7 @@ closure_invalidated(gpointer data,
     c->context = nullptr;
 }
 
-static void
-closure_set_invalid(gpointer  data,
-                    GClosure *closure)
-{
+static void closure_set_invalid(void*, GClosure* closure) {
     Closure *self = &((GjsClosure*) closure)->priv;
 
     gjs_debug_closure("Invalidating signal closure %p which calls function %p",
@@ -174,10 +168,7 @@ closure_set_invalid(gpointer  data,
     GJS_DEC_COUNTER(closure);
 }
 
-static void
-closure_finalize(gpointer  data,
-                 GClosure *closure)
-{
+static void closure_finalize(void*, GClosure* closure) {
     Closure *self = &((GjsClosure*) closure)->priv;
 
     self->~Closure();
diff --git a/gi/function.cpp b/gi/function.cpp
index 5859fcf7..22103b1e 100644
--- a/gi/function.cpp
+++ b/gi/function.cpp
@@ -182,12 +182,8 @@ warn_about_illegal_js_callback(const GjsCallbackTrampoline *trampoline,
  * In other words, everything we need to call the JS function and
  * getting the return value back.
  */
-static void
-gjs_callback_closure(ffi_cif *cif,
-                     void *result,
-                     void **ffi_args,
-                     void *data)
-{
+static void gjs_callback_closure(ffi_cif* cif G_GNUC_UNUSED, void* result,
+                                 void** ffi_args, void* data) {
     JSContext *context;
     GjsCallbackTrampoline *trampoline;
     int i, n_args, n_jsargs, n_outargs, c_args_offset = 0;
@@ -1457,10 +1453,7 @@ uninit_cached_function_data (Function *function)
     g_function_invoker_destroy(&function->invoker);
 }
 
-static void
-function_finalize(JSFreeOp *fop,
-                  JSObject *obj)
-{
+static void function_finalize(JSFreeOp*, JSObject* obj) {
     Function *priv;
 
     priv = (Function *) JS_GetPrivate(obj);
diff --git a/gi/fundamental.cpp b/gi/fundamental.cpp
index dc961728..ddcaa62c 100644
--- a/gi/fundamental.cpp
+++ b/gi/fundamental.cpp
@@ -145,7 +145,7 @@ bool FundamentalPrototype::resolve_interface(JSContext* cx,
 
 // See GIWrapperBase::resolve().
 bool FundamentalPrototype::resolve_impl(JSContext* cx, JS::HandleObject obj,
-                                        JS::HandleId id, const char* prop_name,
+                                        JS::HandleId, const char* prop_name,
                                         bool* resolved) {
     /* We are the prototype, so look for methods and other class properties */
     GjsAutoFunctionInfo method_info =
diff --git a/gi/gobject.cpp b/gi/gobject.cpp
index 4ed784e2..00a4ae61 100644
--- a/gi/gobject.cpp
+++ b/gi/gobject.cpp
@@ -139,7 +139,8 @@ static GObject* gjs_object_constructor(
     return G_OBJECT(g_object_ref(priv->to_instance()->ptr()));
 }
 
-static void gjs_object_set_gproperty(GObject* object, unsigned property_id,
+static void gjs_object_set_gproperty(GObject* object,
+                                     unsigned property_id G_GNUC_UNUSED,
                                      const GValue* value, GParamSpec* pspec) {
     auto* priv = ObjectInstance::for_gobject(object);
     JSContext *cx = current_context();
@@ -151,7 +152,8 @@ static void gjs_object_set_gproperty(GObject* object, unsigned property_id,
         gjs_log_exception(cx);
 }
 
-static void gjs_object_get_gproperty(GObject* object, unsigned property_id,
+static void gjs_object_get_gproperty(GObject* object,
+                                     unsigned property_id G_GNUC_UNUSED,
                                      GValue* value, GParamSpec* pspec) {
     auto* priv = ObjectInstance::for_gobject(object);
     JSContext *cx = current_context();
@@ -165,7 +167,7 @@ static void gjs_object_get_gproperty(GObject* object, unsigned property_id,
         gjs_log_exception(cx);
 }
 
-static void gjs_object_class_init(void* class_pointer, void* user_data) {
+static void gjs_object_class_init(void* class_pointer, void*) {
     GObjectClass* klass = G_OBJECT_CLASS(class_pointer);
     GType gtype = G_OBJECT_CLASS_TYPE(klass);
 
@@ -185,7 +187,8 @@ static void gjs_object_class_init(void* class_pointer, void* user_data) {
     }
 }
 
-static void gjs_object_custom_init(GTypeInstance* instance, void* klass) {
+static void gjs_object_custom_init(GTypeInstance* instance,
+                                   void* g_class G_GNUC_UNUSED) {
     JSContext *cx = current_context();
     GjsContextPrivate* gjs = GjsContextPrivate::from_cx(cx);
 
@@ -210,7 +213,7 @@ static void gjs_object_custom_init(GTypeInstance* instance, void* klass) {
         gjs_log_exception(cx);
 }
 
-static void gjs_interface_init(void* g_iface, void* iface_data) {
+static void gjs_interface_init(void* g_iface, void*) {
     GType gtype = G_TYPE_FROM_INTERFACE(g_iface);
 
     AutoParamArray properties;
diff --git a/gi/interface.cpp b/gi/interface.cpp
index 2f9b9839..a759080f 100644
--- a/gi/interface.cpp
+++ b/gi/interface.cpp
@@ -51,7 +51,7 @@ InterfacePrototype::~InterfacePrototype(void) {
 
 // See GIWrapperBase::resolve().
 bool InterfacePrototype::resolve_impl(JSContext* context, JS::HandleObject obj,
-                                      JS::HandleId id, const char* name,
+                                      JS::HandleId, const char* name,
                                       bool* resolved) {
     /* If we have no GIRepository information then this interface was defined
      * from within GJS. In that case, it has no properties that need to be
diff --git a/gi/ns.cpp b/gi/ns.cpp
index cc1fceb9..5148aaf0 100644
--- a/gi/ns.cpp
+++ b/gi/ns.cpp
@@ -125,10 +125,7 @@ get_name (JSContext *context,
 
 GJS_NATIVE_CONSTRUCTOR_DEFINE_ABSTRACT(ns)
 
-static void
-ns_finalize(JSFreeOp *fop,
-            JSObject *obj)
-{
+static void ns_finalize(JSFreeOp*, JSObject* obj) {
     Ns *priv;
 
     priv = (Ns *)JS_GetPrivate(obj);
diff --git a/gi/object.cpp b/gi/object.cpp
index 5fc80350..6946902f 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -290,12 +290,8 @@ bool ObjectBase::add_property(JSContext* cx, JS::HandleObject obj,
     return priv->to_instance()->add_property_impl(cx, obj, id, value);
 }
 
-bool
-ObjectInstance::add_property_impl(JSContext       *cx,
-                                  JS::HandleObject obj,
-                                  JS::HandleId     id,
-                                  JS::HandleValue  value)
-{
+bool ObjectInstance::add_property_impl(JSContext* cx, JS::HandleObject obj,
+                                       JS::HandleId id, JS::HandleValue) {
     debug_jsprop("Add property hook", id, obj);
 
     if (is_custom_js_class() || m_gobj_disposed)
@@ -860,9 +856,9 @@ bool ObjectPrototype::resolve_impl(JSContext* context, JS::HandleObject obj,
     return true;
 }
 
-bool ObjectPrototype::new_enumerate_impl(JSContext* cx, JS::HandleObject obj,
+bool ObjectPrototype::new_enumerate_impl(JSContext* cx, JS::HandleObject,
                                          JS::AutoIdVector& properties,
-                                         bool only_enumerable) {
+                                         bool only_enumerable G_GNUC_UNUSED) {
     unsigned n_interfaces;
     GType* interfaces = g_type_interfaces(gtype(), &n_interfaces);
 
@@ -1068,8 +1064,8 @@ ObjectInstance::remove_wrapped_gobjects_if(ObjectInstance::Predicate predicate,
  * Callback called when the #GjsContext is disposed. It just calls
  * handle_context_dispose() on every ObjectInstance.
  */
-void ObjectInstance::context_dispose_notify(void* data,
-                                            GObject* where_the_object_was) {
+void ObjectInstance::context_dispose_notify(
+    void*, GObject* where_the_object_was G_GNUC_UNUSED) {
     ObjectInstance::iterate_wrapped_gobjects(
         std::mem_fn(&ObjectInstance::handle_context_dispose));
 }
@@ -1162,11 +1158,8 @@ toggle_handler(GObject               *gobj,
     }
 }
 
-static void
-wrapped_gobj_toggle_notify(gpointer      data,
-                           GObject      *gobj,
-                           gboolean      is_last_ref)
-{
+static void wrapped_gobj_toggle_notify(void*, GObject* gobj,
+                                       gboolean is_last_ref) {
     bool is_main_thread;
     bool toggle_up_queued, toggle_down_queued;
 
@@ -1317,8 +1310,8 @@ bool ObjectPrototype::init(JSContext* cx) {
  * Private callback, called after the JS engine finishes garbage collection, and
  * notifies when weak pointers need to be either moved or swept.
  */
-void ObjectInstance::update_heap_wrapper_weak_pointers(
-    JSContext* cx, JSCompartment* compartment, void* data) {
+void ObjectInstance::update_heap_wrapper_weak_pointers(JSContext*,
+                                                       JSCompartment*, void*) {
     gjs_debug_lifecycle(GJS_DEBUG_GOBJECT, "Weak pointer update callback, "
                         "%zu wrapped GObject(s) to examine",
                         ObjectInstance::num_wrapped_gobjects());
diff --git a/gi/param.cpp b/gi/param.cpp
index 7997f800..c5272916 100644
--- a/gi/param.cpp
+++ b/gi/param.cpp
@@ -106,10 +106,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(param)
     return true;
 }
 
-static void
-param_finalize(JSFreeOp *fop,
-               JSObject *obj)
-{
+static void param_finalize(JSFreeOp*, JSObject* obj) {
     Param *priv;
 
     priv = (Param*) JS_GetPrivate(obj);
diff --git a/gi/repo.cpp b/gi/repo.cpp
index 4d69ce6c..a0c29df0 100644
--- a/gi/repo.cpp
+++ b/gi/repo.cpp
@@ -203,10 +203,7 @@ repo_resolve(JSContext       *context,
 
 GJS_NATIVE_CONSTRUCTOR_DEFINE_ABSTRACT(repo)
 
-static void
-repo_finalize(JSFreeOp *fop,
-              JSObject *obj)
-{
+static void repo_finalize(JSFreeOp*, JSObject* obj) {
     Repo *priv;
 
     priv = (Repo*) JS_GetPrivate(obj);
diff --git a/gi/union.cpp b/gi/union.cpp
index 9ac8490e..7c363f6b 100644
--- a/gi/union.cpp
+++ b/gi/union.cpp
@@ -63,7 +63,7 @@ UnionInstance::~UnionInstance(void) {
 
 // See GIWrapperBase::resolve().
 bool UnionPrototype::resolve_impl(JSContext* context, JS::HandleObject obj,
-                                  JS::HandleId id, const char* prop_name,
+                                  JS::HandleId, const char* prop_name,
                                   bool* resolved) {
     // Look for methods and other class properties
     GjsAutoFunctionInfo method_info =
diff --git a/gi/wrapperutils.h b/gi/wrapperutils.h
index ab2a30f1..5fa4ae2f 100644
--- a/gi/wrapperutils.h
+++ b/gi/wrapperutils.h
@@ -493,7 +493,7 @@ class GIWrapperBase {
      * GIWrapperBase::trace_impl:
      * Override if necessary. See trace().
      */
-    void trace_impl(JSTracer* trc) {}
+    void trace_impl(JSTracer*) {}
 
     // JSNative methods
 
@@ -748,7 +748,7 @@ class GIWrapperPrototype : public Base {
      * necessary.
      */
     GJS_JSAPI_RETURN_CONVENTION
-    bool init(JSContext* cx) { return true; }
+    bool init(JSContext*) { return true; }
 
     // The following three methods are private because they are used only in
     // create_class().
@@ -765,7 +765,7 @@ class GIWrapperPrototype : public Base {
      * inherit in JS.
      */
     GJS_JSAPI_RETURN_CONVENTION
-    bool get_parent_proto(JSContext* cx, JS::MutableHandleObject proto) const {
+    bool get_parent_proto(JSContext*, JS::MutableHandleObject proto) const {
         proto.set(nullptr);
         return true;
     }
@@ -978,10 +978,10 @@ class GIWrapperPrototype : public Base {
     // JSClass operations
 
  protected:
-    void finalize_impl(JSFreeOp* fop, JSObject* obj) { release(); }
+    void finalize_impl(JSFreeOp*, JSObject*) { release(); }
 
     // Override if necessary
-    void trace_impl(JSTracer* trc) {}
+    void trace_impl(JSTracer*) {}
 };
 
 /*
@@ -1055,13 +1055,13 @@ class GIWrapperInstance : public Base {
     // JSClass operations
 
  protected:
-    void finalize_impl(JSFreeOp* fop, JSObject* obj) {
+    void finalize_impl(JSFreeOp*, JSObject*) {
         static_cast<Instance*>(this)->~Instance();
         g_slice_free(Instance, this);
     }
 
     // Override if necessary
-    void trace_impl(JSTracer* trc) {}
+    void trace_impl(JSTracer*) {}
 
     // Helper methods
 
@@ -1076,7 +1076,7 @@ class GIWrapperInstance : public Base {
      * the check.
      */
     GJS_USE
-    bool typecheck_impl(JSContext* cx, GIBaseInfo* expected_info,
+    bool typecheck_impl(JSContext*, GIBaseInfo* expected_info,
                         GType expected_gtype) const {
         if (expected_gtype != G_TYPE_NONE)
             return g_type_is_a(Base::gtype(), expected_gtype);
diff --git a/gjs/byteArray.cpp b/gjs/byteArray.cpp
index 01b39a2e..7d878c7c 100644
--- a/gjs/byteArray.cpp
+++ b/gjs/byteArray.cpp
@@ -32,16 +32,18 @@
 
 /* Callbacks to use with JS_NewExternalArrayBuffer() */
 
-static void gfree_arraybuffer_contents(void* contents, void* unused) {
+static void gfree_arraybuffer_contents(void* contents, void*) {
     g_free(contents);
 }
 
-static void bytes_ref_arraybuffer(void* contents, void* user_data) {
+static void bytes_ref_arraybuffer(void* contents G_GNUC_UNUSED,
+                                  void* user_data) {
     auto* gbytes = static_cast<GBytes*>(user_data);
     g_bytes_ref(gbytes);
 }
 
-static void bytes_unref_arraybuffer(void* contents, void* user_data) {
+static void bytes_unref_arraybuffer(void* contents G_GNUC_UNUSED,
+                                    void* user_data) {
     auto* gbytes = static_cast<GBytes*>(user_data);
     g_bytes_unref(gbytes);
 }
diff --git a/gjs/console.cpp b/gjs/console.cpp
index eb92c06e..eec9bd38 100644
--- a/gjs/console.cpp
+++ b/gjs/console.cpp
@@ -101,12 +101,9 @@ strcatv(char **strv1,
     return retval;
 }
 
-static gboolean
-parse_profile_arg(const char *option_name,
-                  const char *value,
-                  void       *data,
-                  GError    **error_out)
-{
+static gboolean parse_profile_arg(const char* option_name G_GNUC_UNUSED,
+                                  const char* value, void*,
+                                  GError** error_out G_GNUC_UNUSED) {
     enable_profiler = true;
     g_free(profile_output_path);
     if (value)
diff --git a/gjs/context.cpp b/gjs/context.cpp
index 3411771b..0ac7fb68 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -155,9 +155,7 @@ gjs_context_dump_heaps(void)
     fclose(fp);
 }
 
-static gboolean
-dump_heap_idle(gpointer user_data)
-{
+static gboolean dump_heap_idle(void*) {
     dump_heap_idle_id = 0;
 
     gjs_context_dump_heaps();
@@ -165,9 +163,7 @@ dump_heap_idle(gpointer user_data)
     return false;
 }
 
-static void
-dump_heap_signal_handler(int signum)
-{
+static void dump_heap_signal_handler(int signum G_GNUC_UNUSED) {
     if (dump_heap_idle_id == 0)
         dump_heap_idle_id = g_idle_add_full(G_PRIORITY_HIGH_IDLE,
                                             dump_heap_idle, nullptr, nullptr);
diff --git a/gjs/coverage.cpp b/gjs/coverage.cpp
index 2e3055db..13118df7 100644
--- a/gjs/coverage.cpp
+++ b/gjs/coverage.cpp
@@ -317,10 +317,7 @@ gjs_coverage_write_statistics(GjsCoverage *coverage)
     g_message("Wrote coverage statistics to %s", output_file_path.get());
 }
 
-static void
-gjs_coverage_init(GjsCoverage *self)
-{
-}
+static void gjs_coverage_init(GjsCoverage*) {}
 
 static void
 coverage_tracer(JSTracer *trc, void *data)
diff --git a/gjs/engine.cpp b/gjs/engine.cpp
index 576c36cd..3ce16553 100644
--- a/gjs/engine.cpp
+++ b/gjs/engine.cpp
@@ -121,11 +121,8 @@ static JSLocaleCallbacks gjs_locale_callbacks =
     gjs_locale_to_unicode
 };
 
-static void
-gjs_finalize_callback(JSFreeOp         *fop,
-                      JSFinalizeStatus  status,
-                      void             *data)
-{
+static void gjs_finalize_callback(JSFreeOp*, JSFinalizeStatus status,
+                                  void* data) {
     auto* gjs = static_cast<GjsContextPrivate*>(data);
 
   /* Implementation note for mozjs 24:
@@ -174,11 +171,7 @@ gjs_finalize_callback(JSFreeOp         *fop,
         gjs->set_sweeping(false);
 }
 
-static void
-on_garbage_collect(JSContext *cx,
-                   JSGCStatus status,
-                   void      *data)
-{
+static void on_garbage_collect(JSContext*, JSGCStatus status, void*) {
     /* We finalize any pending toggle refs before doing any garbage collection,
      * so that we can collect the JS wrapper objects, and in order to minimize
      * the chances of objects having a pending toggle up queued when they are
@@ -188,13 +181,10 @@ on_garbage_collect(JSContext *cx,
 }
 
 GJS_JSAPI_RETURN_CONVENTION
-static bool
-on_enqueue_promise_job(JSContext       *cx,
-                       JS::HandleObject callback,
-                       JS::HandleObject allocation_site,
-                       JS::HandleObject global,
-                       void            *data)
-{
+static bool on_enqueue_promise_job(
+    JSContext*, JS::HandleObject callback,
+    JS::HandleObject allocation_site G_GNUC_UNUSED,
+    JS::HandleObject global G_GNUC_UNUSED, void* data) {
     auto* gjs = static_cast<GjsContextPrivate*>(data);
     return gjs->enqueue_job(callback);
 }
diff --git a/gjs/importer.cpp b/gjs/importer.cpp
index d1178c2e..313547f7 100644
--- a/gjs/importer.cpp
+++ b/gjs/importer.cpp
@@ -626,7 +626,7 @@ static bool do_import(JSContext* context, JS::HandleObject obj, Importer* priv,
 GJS_JSAPI_RETURN_CONVENTION
 static bool importer_new_enumerate(JSContext* context, JS::HandleObject object,
                                    JS::AutoIdVector& properties,
-                                   bool enumerable_only) {
+                                   bool enumerable_only G_GNUC_UNUSED) {
     Importer *priv;
     guint32 search_path_len;
     guint32 i;
@@ -789,7 +789,7 @@ importer_resolve(JSContext        *context,
 
 GJS_NATIVE_CONSTRUCTOR_DEFINE_ABSTRACT(importer)
 
-static void importer_finalize(JSFreeOp* fop, JSObject* obj) {
+static void importer_finalize(JSFreeOp*, JSObject* obj) {
     Importer *priv;
 
     priv = (Importer*) JS_GetPrivate(obj);
diff --git a/gjs/jsapi-class.h b/gjs/jsapi-class.h
index d6fd812a..4a3fcdba 100644
--- a/gjs/jsapi-class.h
+++ b/gjs/jsapi-class.h
@@ -116,11 +116,7 @@ bool gjs_define_property_dynamic(JSContext       *cx,
     type *priv = priv_from_js(cx, to)
 
 /* Helper for GJS_DEFINE_PROTO_* macros with no parent */
-static inline JSObject *
-gjs_no_parent_get_proto(JSContext *cx)
-{
-    return nullptr;
-}
+static inline JSObject* gjs_no_parent_get_proto(JSContext*) { return nullptr; }
 
 /**
  * GJS_DEFINE_PROTO:
diff --git a/gjs/jsapi-util-args.h b/gjs/jsapi-util-args.h
index f9d6f78f..2fd52684 100644
--- a/gjs/jsapi-util-args.h
+++ b/gjs/jsapi-util-args.h
@@ -45,13 +45,8 @@ GJS_ALWAYS_INLINE GJS_USE static inline bool check_nullable(
 /* This preserves the previous behaviour of gjs_parse_args(), but maybe we want
  * to use JS::ToBoolean instead? */
 GJS_ALWAYS_INLINE
-static inline void
-assign(JSContext      *cx,
-       char            c,
-       bool            nullable,
-       JS::HandleValue value,
-       bool           *ref)
-{
+static inline void assign(JSContext*, char c, bool nullable,
+                          JS::HandleValue value, bool* ref) {
     if (c != 'b')
         throw g_strdup_printf("Wrong type for %c, got bool*", c);
     if (!value.isBoolean())
@@ -64,13 +59,8 @@ assign(JSContext      *cx,
 /* This preserves the previous behaviour of gjs_parse_args(), but maybe we want
  * to box primitive types instead of throwing? */
 GJS_ALWAYS_INLINE
-static inline void
-assign(JSContext              *cx,
-       char                    c,
-       bool                    nullable,
-       JS::HandleValue         value,
-       JS::MutableHandleObject ref)
-{
+static inline void assign(JSContext*, char c, bool nullable,
+                          JS::HandleValue value, JS::MutableHandleObject ref) {
     if (c != 'o')
         throw g_strdup_printf("Wrong type for %c, got JS::MutableHandleObject", c);
     if (nullable && value.isNull()) {
@@ -207,10 +197,10 @@ assign(JSContext      *cx,
 
 /* Force JS::RootedObject * to be converted to JS::MutableHandleObject,
  * see overload in jsapi-util-args.cpp */
-template<typename T,
-         typename std::enable_if<!std::is_same<T, JS::RootedObject *>::value, int>::type = 0>
-static inline void
-free_if_necessary(T param_ref) {}
+template <typename T,
+          typename std::enable_if<!std::is_same<T, JS::RootedObject*>::value,
+                                  int>::type = 0>
+static inline void free_if_necessary(T param_ref G_GNUC_UNUSED) {}
 
 GJS_ALWAYS_INLINE
 static inline void
diff --git a/gjs/jsapi-util-error.cpp b/gjs/jsapi-util-error.cpp
index 871159fd..71c046f0 100644
--- a/gjs/jsapi-util-error.cpp
+++ b/gjs/jsapi-util-error.cpp
@@ -227,10 +227,7 @@ gjs_format_stack_trace(JSContext       *cx,
                                 nullptr);
 }
 
-void
-gjs_warning_reporter(JSContext     *context,
-                     JSErrorReport *report)
-{
+void gjs_warning_reporter(JSContext*, JSErrorReport* report) {
     const char *warning;
     GLogLevelFlags level;
 
diff --git a/gjs/jsapi-util-root.h b/gjs/jsapi-util-root.h
index 506e154e..f2df93e4 100644
--- a/gjs/jsapi-util-root.h
+++ b/gjs/jsapi-util-root.h
@@ -135,10 +135,8 @@ private:
                             what);
     }
 
-    static void
-    on_context_destroy(void    *data,
-                       GObject *ex_context)
-    {
+    static void on_context_destroy(void* data,
+                                   GObject* ex_context G_GNUC_UNUSED) {
         auto self = static_cast<GjsMaybeOwned<T> *>(data);
         self->invalidate();
     }
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index 8bb2c66e..05c64237 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -597,6 +597,8 @@ gjs_gc_if_needed (JSContext *context)
             linux_rss_trigger = (rss_size * 1.25);
         }
     }
+#else  // !__linux__
+    (void)context;
 #endif
 }
 
diff --git a/gjs/jsapi-util.h b/gjs/jsapi-util.h
index 287e7483..5addf59a 100644
--- a/gjs/jsapi-util.h
+++ b/gjs/jsapi-util.h
@@ -238,9 +238,7 @@ GJS_USE
 char *gjs_value_debug_string(JSContext      *context,
                              JS::HandleValue value);
 
-
-void gjs_warning_reporter(JSContext     *cx,
-                          JSErrorReport *report);
+void gjs_warning_reporter(JSContext*, JSErrorReport* report);
 
 GJS_JSAPI_RETURN_CONVENTION
 bool gjs_string_to_utf8(JSContext* cx, const JS::Value string_val,
diff --git a/gjs/module.cpp b/gjs/module.cpp
index ba42dbcd..07000dd6 100644
--- a/gjs/module.cpp
+++ b/gjs/module.cpp
@@ -192,12 +192,7 @@ class GjsModule {
         return priv(module)->resolve_impl(cx, module, id, resolved);
     }
 
-    static void
-    finalize(JSFreeOp *op,
-             JSObject *module)
-    {
-        delete priv(module);
-    }
+    static void finalize(JSFreeOp*, JSObject* module) { delete priv(module); }
 
     static constexpr JSClassOps class_ops = {
         nullptr,  // addProperty
diff --git a/gjs/profiler.cpp b/gjs/profiler.cpp
index d74689c1..6f37eaca 100644
--- a/gjs/profiler.cpp
+++ b/gjs/profiler.cpp
@@ -572,6 +572,7 @@ _gjs_profiler_setup_signals(GjsProfiler *self,
 #else  /* !ENABLE_PROFILER */
 
     g_message("Profiler is disabled. Not setting up signals.");
+    (void)self;
 
 #endif  /* ENABLE_PROFILER */
 }
@@ -607,6 +608,11 @@ gjs_profiler_chain_signal(GjsContext *context,
         }
     }
 
+#else  // !ENABLE_PROFILER
+
+    (void)context;
+    (void)info;
+
 #endif  /* ENABLE_PROFILER */
 
     return false;
diff --git a/libgjs-private/gjs-gdbus-wrapper.c b/libgjs-private/gjs-gdbus-wrapper.c
index 706ef7be..2ad5e6bc 100644
--- a/libgjs-private/gjs-gdbus-wrapper.c
+++ b/libgjs-private/gjs-gdbus-wrapper.c
@@ -41,31 +41,21 @@ G_DEFINE_TYPE_WITH_PRIVATE(GjsDBusImplementation, gjs_dbus_implementation,
 _Pragma("GCC diagnostic pop")
 #endif
 
-static void
-gjs_dbus_implementation_method_call(GDBusConnection       *connection,
-                                    const char            *sender,
-                                    const char            *object_path,
-                                    const char            *interface_name,
-                                    const char            *method_name,
-                                    GVariant              *parameters,
-                                    GDBusMethodInvocation *invocation,
-                                    gpointer               user_data)
-{
+static void gjs_dbus_implementation_method_call(
+    GDBusConnection* connection, const char* sender G_GNUC_UNUSED,
+    const char* object_path, const char* interface_name,
+    const char* method_name, GVariant* parameters,
+    GDBusMethodInvocation* invocation, void* user_data) {
     GjsDBusImplementation *self = GJS_DBUS_IMPLEMENTATION (user_data);
 
     g_signal_emit(self, signals[SIGNAL_HANDLE_METHOD], 0, method_name, parameters, invocation);
     g_object_unref (invocation);
 }
 
-static GVariant *
-gjs_dbus_implementation_property_get(GDBusConnection       *connection,
-                                     const char            *sender,
-                                     const char            *object_path,
-                                     const char            *interface_name,
-                                     const char            *property_name,
-                                     GError               **error,
-                                     gpointer               user_data)
-{
+static GVariant* gjs_dbus_implementation_property_get(
+    GDBusConnection* connection, const char* sender G_GNUC_UNUSED,
+    const char* object_path, const char* interface_name,
+    const char* property_name, GError** error, void* user_data) {
     GjsDBusImplementation *self = GJS_DBUS_IMPLEMENTATION (user_data);
     GVariant *value;
 
@@ -79,16 +69,11 @@ gjs_dbus_implementation_property_get(GDBusConnection       *connection,
     return value;
 }
 
-static gboolean
-gjs_dbus_implementation_property_set(GDBusConnection       *connection,
-                                     const char            *sender,
-                                     const char            *object_path,
-                                     const char            *interface_name,
-                                     const char            *property_name,
-                                     GVariant              *value,
-                                     GError               **error,
-                                     gpointer               user_data)
-{
+static gboolean gjs_dbus_implementation_property_set(
+    GDBusConnection* connection, const char* sender G_GNUC_UNUSED,
+    const char* object_path, const char* interface_name,
+    const char* property_name, GVariant* value, GError** error,
+    void* user_data) {
     GjsDBusImplementation *self = GJS_DBUS_IMPLEMENTATION (user_data);
 
     g_signal_emit(self, signals[SIGNAL_HANDLE_PROPERTY_SET], 0, property_name, value);
diff --git a/modules/cairo-context.cpp b/modules/cairo-context.cpp
index e396c730..caeffeae 100644
--- a/modules/cairo-context.cpp
+++ b/modules/cairo-context.cpp
@@ -294,10 +294,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_context)
     return true;
 }
 
-static void
-gjs_cairo_context_finalize(JSFreeOp *fop,
-                           JSObject *obj)
-{
+static void gjs_cairo_context_finalize(JSFreeOp*, JSObject* obj) {
     GjsCairoContext *priv;
     priv = (GjsCairoContext*) JS_GetPrivate(obj);
     if (priv == NULL)
@@ -1019,11 +1016,8 @@ context_from_g_argument(JSContext             *context,
     return true;
 }
 
-static bool
-context_release_argument(JSContext  *context,
-                         GITransfer  transfer,
-                         GArgument  *arg)
-{
+static bool context_release_argument(JSContext*, GITransfer transfer,
+                                     GIArgument* arg) {
     if (transfer != GI_TRANSFER_NOTHING)
         cairo_destroy(static_cast<cairo_t*>(arg->v_pointer));
     return true;
diff --git a/modules/cairo-path.cpp b/modules/cairo-path.cpp
index 4567cd4c..9b3b85b0 100644
--- a/modules/cairo-path.cpp
+++ b/modules/cairo-path.cpp
@@ -40,10 +40,7 @@ static JSObject *gjs_cairo_path_get_proto(JSContext *);
 GJS_DEFINE_PROTO_ABSTRACT("Path", cairo_path, JSCLASS_BACKGROUND_FINALIZE)
 GJS_DEFINE_PRIV_FROM_JS(GjsCairoPath, gjs_cairo_path_class)
 
-static void
-gjs_cairo_path_finalize(JSFreeOp *fop,
-                        JSObject *obj)
-{
+static void gjs_cairo_path_finalize(JSFreeOp*, JSObject* obj) {
     GjsCairoPath *priv;
     priv = (GjsCairoPath*) JS_GetPrivate(obj);
     if (priv == NULL)
diff --git a/modules/cairo-pattern.cpp b/modules/cairo-pattern.cpp
index 84d1f1e6..78d2d0f0 100644
--- a/modules/cairo-pattern.cpp
+++ b/modules/cairo-pattern.cpp
@@ -41,10 +41,7 @@ GJS_DEFINE_PROTO_ABSTRACT_WITH_GTYPE("Pattern", cairo_pattern,
                                      JSCLASS_BACKGROUND_FINALIZE)
 GJS_DEFINE_PRIV_FROM_JS(GjsCairoPattern, gjs_cairo_pattern_class)
 
-static void
-gjs_cairo_pattern_finalize(JSFreeOp *fop,
-                           JSObject *obj)
-{
+static void gjs_cairo_pattern_finalize(JSFreeOp*, JSObject* obj) {
     GjsCairoPattern *priv;
     priv = (GjsCairoPattern*) JS_GetPrivate(obj);
     if (priv == NULL)
diff --git a/modules/cairo-region.cpp b/modules/cairo-region.cpp
index 0fd6d567..3767ab5d 100644
--- a/modules/cairo-region.cpp
+++ b/modules/cairo-region.cpp
@@ -275,10 +275,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_region)
     return true;
 }
 
-static void
-gjs_cairo_region_finalize(JSFreeOp *fop,
-                          JSObject *obj)
-{
+static void gjs_cairo_region_finalize(JSFreeOp*, JSObject* obj) {
     GjsCairoRegion *priv;
     priv = (GjsCairoRegion*) JS_GetPrivate(obj);
     if (priv == NULL)
@@ -355,11 +352,8 @@ region_from_g_argument(JSContext             *context,
     return true;
 }
 
-static bool
-region_release_argument(JSContext  *context,
-                        GITransfer  transfer,
-                        GArgument  *arg)
-{
+static bool region_release_argument(JSContext*, GITransfer transfer,
+                                    GIArgument* arg) {
     if (transfer != GI_TRANSFER_NOTHING)
         cairo_region_destroy(static_cast<cairo_region_t*>(arg->v_pointer));
     return true;
diff --git a/modules/cairo-surface.cpp b/modules/cairo-surface.cpp
index 0ec087ac..b6130e0f 100644
--- a/modules/cairo-surface.cpp
+++ b/modules/cairo-surface.cpp
@@ -42,10 +42,7 @@ GJS_DEFINE_PROTO_ABSTRACT_WITH_GTYPE("Surface", cairo_surface,
                                      JSCLASS_BACKGROUND_FINALIZE)
 GJS_DEFINE_PRIV_FROM_JS(GjsCairoSurface, gjs_cairo_surface_class)
 
-static void
-gjs_cairo_surface_finalize(JSFreeOp *fop,
-                           JSObject *obj)
-{
+static void gjs_cairo_surface_finalize(JSFreeOp*, JSObject* obj) {
     GjsCairoSurface *priv;
     priv = (GjsCairoSurface*) JS_GetPrivate(obj);
     if (priv == NULL)
@@ -297,11 +294,8 @@ surface_from_g_argument(JSContext             *context,
     return true;
 }
 
-static bool
-surface_release_argument(JSContext  *context,
-                         GITransfer  transfer,
-                         GArgument  *arg)
-{
+static bool surface_release_argument(JSContext*, GITransfer transfer,
+                                     GIArgument* arg) {
     if (transfer != GI_TRANSFER_NOTHING)
         cairo_surface_destroy(static_cast<cairo_surface_t*>(arg->v_pointer));
     return true;
diff --git a/modules/console.cpp b/modules/console.cpp
index 3fdc5514..972309b9 100644
--- a/modules/console.cpp
+++ b/modules/console.cpp
@@ -64,8 +64,8 @@ enum class PrintErrorKind { Error, Warning, StrictWarning, Note };
 
 template <typename T>
 static void print_single_error(T* report, PrintErrorKind kind);
-static void print_error_line(const char* prefix, JSErrorNotes::Note* note) {}
 static void print_error_line(const char* prefix, JSErrorReport* report);
+static void print_error_line(const char*, JSErrorNotes::Note*) {}
 
 static void
 gjs_console_print_error(JSErrorReport *report)
@@ -178,9 +178,7 @@ static void print_error_line(const char* prefix, JSErrorReport* report) {
     }
 }
 
-static void
-gjs_console_warning_reporter(JSContext *cx, JSErrorReport *report)
-{
+static void gjs_console_warning_reporter(JSContext*, JSErrorReport* report) {
     gjs_console_print_error(report);
 }
 
diff --git a/test/gjs-test-coverage.cpp b/test/gjs-test-coverage.cpp
index 2d45b489..7c0ede7a 100644
--- a/test/gjs-test-coverage.cpp
+++ b/test/gjs-test-coverage.cpp
@@ -98,10 +98,7 @@ recursive_delete_dir(GFile *dir)
     g_object_unref(files);
 }
 
-static void
-gjs_coverage_fixture_set_up(gpointer      fixture_data,
-                            gconstpointer user_data)
-{
+static void gjs_coverage_fixture_set_up(void* fixture_data, const void*) {
     GjsCoverageFixture *fixture = (GjsCoverageFixture *) fixture_data;
     const char* js_script = "var f = function () { return 1; }\n";
 
@@ -143,10 +140,7 @@ gjs_coverage_fixture_set_up(gpointer      fixture_data,
     g_free(tmp_js_script_filename);
 }
 
-static void
-gjs_coverage_fixture_tear_down(gpointer      fixture_data,
-                               gconstpointer user_data)
-{
+static void gjs_coverage_fixture_tear_down(void* fixture_data, const void*) {
     GjsCoverageFixture *fixture = (GjsCoverageFixture *) fixture_data;
 
     recursive_delete_dir(fixture->tmp_output_dir);
@@ -276,10 +270,8 @@ assert_coverage_data_matches_values_for_key(const char            *data,
     g_assert_cmpuint(n, ==, 0);
 }
 
-static void
-test_covered_file_is_duplicated_into_output_if_resource(gpointer      fixture_data,
-                                                        gconstpointer user_data)
-{
+static void test_covered_file_is_duplicated_into_output_if_resource(
+    void* fixture_data, const void*) {
     if (skip_if_gc_zeal_mode())
         return;
 
@@ -340,10 +332,8 @@ get_output_path_for_script_on_disk(GFile *script,
     return output_path;
 }
 
-static void
-test_covered_file_is_duplicated_into_output_if_path(gpointer      fixture_data,
-                                                    gconstpointer user_data)
-{
+static void test_covered_file_is_duplicated_into_output_if_path(
+    void* fixture_data, const void*) {
     if (skip_if_gc_zeal_mode())
         return;
 
@@ -362,10 +352,7 @@ test_covered_file_is_duplicated_into_output_if_path(gpointer      fixture_data,
     g_object_unref(expected_temporary_js_script);
 }
 
-static void
-test_previous_contents_preserved(gpointer      fixture_data,
-                                 gconstpointer user_data)
-{
+static void test_previous_contents_preserved(void* fixture_data, const void*) {
     GjsCoverageFixture *fixture = (GjsCoverageFixture *) fixture_data;
     const char *existing_contents = "existing_contents\n";
     replace_file(fixture->lcov_output, existing_contents);
@@ -380,11 +367,7 @@ test_previous_contents_preserved(gpointer      fixture_data,
     g_free(coverage_data_contents);
 }
 
-
-static void
-test_new_contents_written(gpointer      fixture_data,
-                          gconstpointer user_data)
-{
+static void test_new_contents_written(void* fixture_data, const void*) {
     if (skip_if_gc_zeal_mode())
         return;
 
@@ -403,10 +386,8 @@ test_new_contents_written(gpointer      fixture_data,
     g_free(coverage_data_contents);
 }
 
-static void
-test_expected_source_file_name_written_to_coverage_data(gpointer      fixture_data,
-                                                        gconstpointer user_data)
-{
+static void test_expected_source_file_name_written_to_coverage_data(
+    void* fixture_data, const void*) {
     if (skip_if_gc_zeal_mode())
         return;
 
@@ -428,10 +409,8 @@ test_expected_source_file_name_written_to_coverage_data(gpointer      fixture_da
     g_free(coverage_data_contents);
 }
 
-static void
-test_expected_entry_not_written_for_nonexistent_file(gpointer      fixture_data,
-                                                        gconstpointer user_data)
-{
+static void test_expected_entry_not_written_for_nonexistent_file(
+    void* fixture_data, const void*) {
     GjsCoverageFixture *fixture = (GjsCoverageFixture *) fixture_data;
 
     const char *coverage_paths[] = {
@@ -510,10 +489,8 @@ branch_at_line_should_be_taken(const char *line,
     };
 }
 
-static void
-test_single_branch_coverage_written_to_coverage_data(gpointer      fixture_data,
-                                                     gconstpointer user_data)
-{
+static void test_single_branch_coverage_written_to_coverage_data(
+    void* fixture_data, const void*) {
     if (skip_if_gc_zeal_mode())
         return;
 
@@ -553,10 +530,8 @@ test_single_branch_coverage_written_to_coverage_data(gpointer      fixture_data,
     g_free(coverage_data_contents);
 }
 
-static void
-test_multiple_branch_coverage_written_to_coverage_data(gpointer      fixture_data,
-                                                       gconstpointer user_data)
-{
+static void test_multiple_branch_coverage_written_to_coverage_data(
+    void* fixture_data, const void*) {
     if (skip_if_gc_zeal_mode())
         return;
 
@@ -603,10 +578,8 @@ test_multiple_branch_coverage_written_to_coverage_data(gpointer      fixture_dat
     g_free(coverage_data_contents);
 }
 
-static void
-test_branches_for_multiple_case_statements_fallthrough(gpointer      fixture_data,
-                                                       gconstpointer user_data)
-{
+static void test_branches_for_multiple_case_statements_fallthrough(
+    void* fixture_data, const void*) {
     if (skip_if_gc_zeal_mode())
         return;
 
@@ -676,10 +649,8 @@ any_line_matches_not_executed_branch(const char *data)
     g_assert_not_reached();
 }
 
-static void
-test_branch_not_hit_written_to_coverage_data(gpointer      fixture_data,
-                                             gconstpointer user_data)
-{
+static void test_branch_not_hit_written_to_coverage_data(void* fixture_data,
+                                                         const void*) {
     if (skip_if_gc_zeal_mode())
         return;
 
@@ -723,10 +694,8 @@ has_function_name(const char *line,
     g_assert_cmpstr(actual, ==, expected_function_name);
 }
 
-static void
-test_function_names_written_to_coverage_data(gpointer      fixture_data,
-                                             gconstpointer user_data)
-{
+static void test_function_names_written_to_coverage_data(void* fixture_data,
+                                                         const void*) {
     if (skip_if_gc_zeal_mode())
         return;
 
@@ -773,10 +742,8 @@ has_function_line(const char *line,
     g_assert_cmpstr(actual, ==, expected_function_line);
 }
 
-static void
-test_function_lines_written_to_coverage_data(gpointer      fixture_data,
-                                             gconstpointer user_data)
-{
+static void test_function_lines_written_to_coverage_data(void* fixture_data,
+                                                         const void*) {
     if (skip_if_gc_zeal_mode())
         return;
 
@@ -842,10 +809,8 @@ hit_count_is_more_than_for_function(const char *line,
  * first executable line, its possible that the JS engine might
  * enter their frame a little later in the script than where their
  * definition starts. We need to handle that case */
-static void
-test_function_hit_counts_for_big_functions_written_to_coverage_data(gpointer      fixture_data,
-                                                                    gconstpointer user_data)
-{
+static void test_function_hit_counts_for_big_functions_written_to_coverage_data(
+    void* fixture_data, const void*) {
     if (skip_if_gc_zeal_mode())
         return;
 
@@ -891,9 +856,8 @@ test_function_hit_counts_for_big_functions_written_to_coverage_data(gpointer
 /* For functions which start executing at a function declaration
  * we also need to make sure that we roll back to the real function, */
 static void
-test_function_hit_counts_for_little_functions_written_to_coverage_data(gpointer      fixture_data,
-                                                                       gconstpointer user_data)
-{
+test_function_hit_counts_for_little_functions_written_to_coverage_data(
+    void* fixture_data, const void*) {
     if (skip_if_gc_zeal_mode())
         return;
 
@@ -934,10 +898,8 @@ test_function_hit_counts_for_little_functions_written_to_coverage_data(gpointer
     g_free(coverage_data_contents);
 }
 
-static void
-test_function_hit_counts_written_to_coverage_data(gpointer      fixture_data,
-                                                  gconstpointer user_data)
-{
+static void test_function_hit_counts_written_to_coverage_data(
+    void* fixture_data, const void*) {
     if (skip_if_gc_zeal_mode())
         return;
 
@@ -976,10 +938,8 @@ test_function_hit_counts_written_to_coverage_data(gpointer      fixture_data,
     g_free(coverage_data_contents);
 }
 
-static void
-test_total_function_coverage_written_to_coverage_data(gpointer      fixture_data,
-                                                      gconstpointer user_data)
-{
+static void test_total_function_coverage_written_to_coverage_data(
+    void* fixture_data, const void*) {
     if (skip_if_gc_zeal_mode())
         return;
 
@@ -1035,10 +995,8 @@ line_hit_count_is_more_than(const char *line,
     g_assert_cmpuint(value, >, data->expected_to_be_more_than);
 }
 
-static void
-test_single_line_hit_written_to_coverage_data(gpointer      fixture_data,
-                                              gconstpointer user_data)
-{
+static void test_single_line_hit_written_to_coverage_data(void* fixture_data,
+                                                          const void*) {
     if (skip_if_gc_zeal_mode())
         return;
 
@@ -1058,10 +1016,7 @@ test_single_line_hit_written_to_coverage_data(gpointer      fixture_data,
     g_free(coverage_data_contents);
 }
 
-static void
-test_hits_on_multiline_if_cond(gpointer      fixture_data,
-                                gconstpointer user_data)
-{
+static void test_hits_on_multiline_if_cond(void* fixture_data, const void*) {
     if (skip_if_gc_zeal_mode())
         return;
 
@@ -1091,10 +1046,8 @@ test_hits_on_multiline_if_cond(gpointer      fixture_data,
     g_free(coverage_data_contents);
 }
 
-static void
-test_full_line_tally_written_to_coverage_data(gpointer      fixture_data,
-                                              gconstpointer user_data)
-{
+static void test_full_line_tally_written_to_coverage_data(void* fixture_data,
+                                                          const void*) {
     if (skip_if_gc_zeal_mode())
         return;
 
@@ -1114,10 +1067,8 @@ test_full_line_tally_written_to_coverage_data(gpointer      fixture_data,
     g_free(coverage_data_contents);
 }
 
-static void
-test_no_hits_to_coverage_data_for_unexecuted(gpointer      fixture_data,
-                                             gconstpointer user_data)
-{
+static void test_no_hits_to_coverage_data_for_unexecuted(void* fixture_data,
+                                                         const void*) {
     if (skip_if_gc_zeal_mode())
         return;
 
@@ -1132,10 +1083,8 @@ test_no_hits_to_coverage_data_for_unexecuted(gpointer      fixture_data,
     g_free(coverage_data_contents);
 }
 
-static void
-test_end_of_record_section_written_to_coverage_data(gpointer      fixture_data,
-                                                    gconstpointer user_data)
-{
+static void test_end_of_record_section_written_to_coverage_data(
+    void* fixture_data, const void*) {
     if (skip_if_gc_zeal_mode())
         return;
 
@@ -1220,10 +1169,8 @@ gjs_coverage_multiple_source_files_to_single_output_fixture_tear_down(gpointer
     gjs_coverage_fixture_tear_down(fixture_data, user_data);
 }
 
-static void
-test_multiple_source_file_records_written_to_coverage_data(gpointer      fixture_data,
-                                                           gconstpointer user_data)
-{
+static void test_multiple_source_file_records_written_to_coverage_data(
+    void* fixture_data, const void*) {
     if (skip_if_gc_zeal_mode())
         return;
 
@@ -1280,9 +1227,8 @@ assert_coverage_data_for_source_file(ExpectedSourceFileCoverageData *expected,
 }
 
 static void
-test_correct_line_coverage_data_written_for_both_source_file_sections(void       *fixture_data,
-                                                                      const void *user_data)
-{
+test_correct_line_coverage_data_written_for_both_source_file_sections(
+    void* fixture_data, const void*) {
     if (skip_if_gc_zeal_mode())
         return;
 
diff --git a/test/gjs-test-rooting.cpp b/test/gjs-test-rooting.cpp
index b750f757..0ba02bbb 100644
--- a/test/gjs-test-rooting.cpp
+++ b/test/gjs-test-rooting.cpp
@@ -17,10 +17,7 @@ struct _GjsRootingFixture {
     GjsMaybeOwned<JSObject *> *obj;  /* only used in callback test cases */
 };
 
-static void
-test_obj_finalize(JSFreeOp *fop,
-                  JSObject *obj)
-{
+static void test_obj_finalize(JSFreeOp*, JSObject* obj) {
     bool *finalized_p = static_cast<bool *>(JS_GetPrivate(obj));
     g_assert_false(*finalized_p);
     *finalized_p = true;
@@ -49,11 +46,7 @@ test_obj_new(GjsRootingFixture *fx)
     return retval;
 }
 
-static void
-on_gc(JSContext *cx,
-      JSGCStatus status,
-      void      *data)
-{
+static void on_gc(JSContext*, JSGCStatus status, void*) {
     if (status != JSGC_END)
         return;
 
@@ -92,30 +85,24 @@ wait_for_gc(GjsRootingFixture *fx)
     g_mutex_unlock(&gc_lock);
 }
 
-static void
-test_maybe_owned_rooted_flag_set_when_rooted(GjsRootingFixture *fx,
-                                             gconstpointer      unused)
-{
+static void test_maybe_owned_rooted_flag_set_when_rooted(GjsRootingFixture* fx,
+                                                         const void*) {
     auto obj = new GjsMaybeOwned<JS::Value>();
     obj->root(PARENT(fx)->cx, JS::TrueValue());
     g_assert_true(obj->rooted());
     delete obj;
 }
 
-static void
-test_maybe_owned_rooted_flag_not_set_when_not_rooted(GjsRootingFixture *fx,
-                                                     gconstpointer      unused)
-{
+static void test_maybe_owned_rooted_flag_not_set_when_not_rooted(
+    GjsRootingFixture*, const void*) {
     auto obj = new GjsMaybeOwned<JS::Value>();
     *obj = JS::TrueValue();
     g_assert_false(obj->rooted());
     delete obj;
 }
 
-static void
-test_maybe_owned_rooted_keeps_alive_across_gc(GjsRootingFixture *fx,
-                                              gconstpointer      unused)
-{
+static void test_maybe_owned_rooted_keeps_alive_across_gc(GjsRootingFixture* fx,
+                                                          const void*) {
     auto obj = new GjsMaybeOwned<JSObject *>();
     obj->root(PARENT(fx)->cx, test_obj_new(fx));
 
@@ -127,10 +114,8 @@ test_maybe_owned_rooted_keeps_alive_across_gc(GjsRootingFixture *fx,
     g_assert_true(fx->finalized);
 }
 
-static void
-test_maybe_owned_rooted_is_collected_after_reset(GjsRootingFixture *fx,
-                                                 gconstpointer      unused)
-{
+static void test_maybe_owned_rooted_is_collected_after_reset(
+    GjsRootingFixture* fx, const void*) {
     auto obj = new GjsMaybeOwned<JSObject *>();
     obj->root(PARENT(fx)->cx, test_obj_new(fx));
     obj->reset();
@@ -140,10 +125,8 @@ test_maybe_owned_rooted_is_collected_after_reset(GjsRootingFixture *fx,
     delete obj;
 }
 
-static void
-test_maybe_owned_weak_pointer_is_collected_by_gc(GjsRootingFixture *fx,
-                                                 gconstpointer      unused)
-{
+static void test_maybe_owned_weak_pointer_is_collected_by_gc(
+    GjsRootingFixture* fx, const void*) {
     auto obj = new GjsMaybeOwned<JSObject *>();
     *obj = test_obj_new(fx);
 
@@ -152,10 +135,8 @@ test_maybe_owned_weak_pointer_is_collected_by_gc(GjsRootingFixture *fx,
     delete obj;
 }
 
-static void
-test_maybe_owned_heap_rooted_keeps_alive_across_gc(GjsRootingFixture *fx,
-                                                   gconstpointer      unused)
-{
+static void test_maybe_owned_heap_rooted_keeps_alive_across_gc(
+    GjsRootingFixture* fx, const void*) {
     auto obj = new GjsMaybeOwned<JSObject *>();
     obj->root(PARENT(fx)->cx, test_obj_new(fx));
 
@@ -167,10 +148,8 @@ test_maybe_owned_heap_rooted_keeps_alive_across_gc(GjsRootingFixture *fx,
     g_assert_true(fx->finalized);
 }
 
-static void
-test_maybe_owned_switching_mode_keeps_same_value(GjsRootingFixture *fx,
-                                                 gconstpointer      unused)
-{
+static void test_maybe_owned_switching_mode_keeps_same_value(
+    GjsRootingFixture* fx, const void*) {
     JSObject *test_obj = test_obj_new(fx);
     auto obj = new GjsMaybeOwned<JSObject *>();
 
@@ -188,10 +167,8 @@ test_maybe_owned_switching_mode_keeps_same_value(GjsRootingFixture *fx,
     delete obj;
 }
 
-static void
-test_maybe_owned_switch_to_rooted_prevents_collection(GjsRootingFixture *fx,
-                                                      gconstpointer      unused)
-{
+static void test_maybe_owned_switch_to_rooted_prevents_collection(
+    GjsRootingFixture* fx, const void*) {
     auto obj = new GjsMaybeOwned<JSObject *>();
     *obj = test_obj_new(fx);
 
@@ -202,10 +179,8 @@ test_maybe_owned_switch_to_rooted_prevents_collection(GjsRootingFixture *fx,
     delete obj;
 }
 
-static void
-test_maybe_owned_switch_to_unrooted_allows_collection(GjsRootingFixture *fx,
-                                                      gconstpointer      unused)
-{
+static void test_maybe_owned_switch_to_unrooted_allows_collection(
+    GjsRootingFixture* fx, const void*) {
     auto obj = new GjsMaybeOwned<JSObject *>();
     obj->root(PARENT(fx)->cx, test_obj_new(fx));
 
@@ -216,10 +191,7 @@ test_maybe_owned_switch_to_unrooted_allows_collection(GjsRootingFixture *fx,
     delete obj;
 }
 
-static void
-context_destroyed(JS::HandleObject obj,
-                  void            *data)
-{
+static void context_destroyed(JS::HandleObject, void* data) {
     auto fx = static_cast<GjsRootingFixture *>(data);
     g_assert_false(fx->notify_called);
     g_assert_false(fx->finalized);
@@ -227,10 +199,8 @@ context_destroyed(JS::HandleObject obj,
     fx->obj->reset();
 }
 
-static void
-test_maybe_owned_notify_callback_called_on_context_destroy(GjsRootingFixture *fx,
-                                                           gconstpointer      unused)
-{
+static void test_maybe_owned_notify_callback_called_on_context_destroy(
+    GjsRootingFixture* fx, const void*) {
     fx->obj = new GjsMaybeOwned<JSObject *>();
     fx->obj->root(PARENT(fx)->cx, test_obj_new(fx), context_destroyed, fx);
 
@@ -239,10 +209,8 @@ test_maybe_owned_notify_callback_called_on_context_destroy(GjsRootingFixture *fx
     delete fx->obj;
 }
 
-static void
-test_maybe_owned_object_destroyed_after_notify(GjsRootingFixture *fx,
-                                               gconstpointer      unused)
-{
+static void test_maybe_owned_object_destroyed_after_notify(
+    GjsRootingFixture* fx, const void*) {
     fx->obj = new GjsMaybeOwned<JSObject *>();
     fx->obj->root(PARENT(fx)->cx, test_obj_new(fx), context_destroyed, fx);
 
diff --git a/test/gjs-test-utils.cpp b/test/gjs-test-utils.cpp
index 4dd6bbc5..124e9457 100644
--- a/test/gjs-test-utils.cpp
+++ b/test/gjs-test-utils.cpp
@@ -30,10 +30,7 @@
 #include "gjs-test-utils.h"
 #include "test/gjs-test-common.h"
 
-void
-gjs_unit_test_fixture_setup(GjsUnitTestFixture *fx,
-                            gconstpointer       unused)
-{
+void gjs_unit_test_fixture_setup(GjsUnitTestFixture* fx, const void*) {
     fx->gjs_context = gjs_context_new();
     fx->cx = (JSContext *) gjs_context_get_native_context(fx->gjs_context);
 
@@ -56,9 +53,6 @@ gjs_unit_test_destroy_context(GjsUnitTestFixture *fx)
     g_object_unref(fx->gjs_context);
 }
 
-void
-gjs_unit_test_fixture_teardown(GjsUnitTestFixture *fx,
-                               gconstpointer      unused)
-{
+void gjs_unit_test_fixture_teardown(GjsUnitTestFixture* fx, const void*) {
     gjs_unit_test_destroy_context(fx);
 }
diff --git a/test/gjs-tests.cpp b/test/gjs-tests.cpp
index a6533fd9..d438b615 100644
--- a/test/gjs-tests.cpp
+++ b/test/gjs-tests.cpp
@@ -128,10 +128,8 @@ gjstest_test_func_gjs_gobject_js_defined_type(void)
     g_object_unref(context);
 }
 
-static void
-gjstest_test_func_gjs_jsapi_util_string_js_string_utf8(GjsUnitTestFixture *fx,
-                                                       gconstpointer       unused)
-{
+static void gjstest_test_func_gjs_jsapi_util_string_js_string_utf8(
+    GjsUnitTestFixture* fx, const void*) {
     JS::RootedValue js_string(fx->cx);
     g_assert_true(gjs_string_from_utf8(fx->cx, VALID_UTF8_STRING, &js_string));
     g_assert(js_string.isString());
@@ -141,10 +139,8 @@ gjstest_test_func_gjs_jsapi_util_string_js_string_utf8(GjsUnitTestFixture *fx,
     g_assert_cmpstr(VALID_UTF8_STRING, ==, utf8_result.get());
 }
 
-static void
-gjstest_test_func_gjs_jsapi_util_error_throw(GjsUnitTestFixture *fx,
-                                             gconstpointer       unused)
-{
+static void gjstest_test_func_gjs_jsapi_util_error_throw(GjsUnitTestFixture* fx,
+                                                         const void*) {
     JS::RootedValue exc(fx->cx), value(fx->cx);
 
     /* Test that we can throw */
@@ -189,10 +185,8 @@ gjstest_test_func_gjs_jsapi_util_error_throw(GjsUnitTestFixture *fx,
     g_assert(&exc.toObject() == &previous.toObject());
 }
 
-static void
-test_jsapi_util_string_utf8_nchars_to_js(GjsUnitTestFixture *fx,
-                                         const void         *unused)
-{
+static void test_jsapi_util_string_utf8_nchars_to_js(GjsUnitTestFixture* fx,
+                                                     const void*) {
     JS::RootedValue v_out(fx->cx);
     bool ok = gjs_string_from_utf8_n(fx->cx, VALID_UTF8_STRING,
                                      strlen(VALID_UTF8_STRING), &v_out);
@@ -200,10 +194,8 @@ test_jsapi_util_string_utf8_nchars_to_js(GjsUnitTestFixture *fx,
     g_assert_true(v_out.isString());
 }
 
-static void
-test_jsapi_util_string_char16_data(GjsUnitTestFixture *fx,
-                                   gconstpointer       unused)
-{
+static void test_jsapi_util_string_char16_data(GjsUnitTestFixture* fx,
+                                               const void*) {
     char16_t *chars;
     size_t len;
 
@@ -223,10 +215,8 @@ test_jsapi_util_string_char16_data(GjsUnitTestFixture *fx,
     g_free(chars);
 }
 
-static void
-test_jsapi_util_string_to_ucs4(GjsUnitTestFixture *fx,
-                               gconstpointer       unused)
-{
+static void test_jsapi_util_string_to_ucs4(GjsUnitTestFixture* fx,
+                                           const void*) {
     gunichar *chars;
     size_t len;
 
@@ -247,10 +237,8 @@ test_jsapi_util_string_to_ucs4(GjsUnitTestFixture *fx,
     g_free(chars);
 }
 
-static void
-test_jsapi_util_debug_string_valid_utf8(GjsUnitTestFixture *fx,
-                                        gconstpointer       unused)
-{
+static void test_jsapi_util_debug_string_valid_utf8(GjsUnitTestFixture* fx,
+                                                    const void*) {
     JS::RootedValue v_string(fx->cx);
     g_assert_true(gjs_string_from_utf8(fx->cx, VALID_UTF8_STRING, &v_string));
 
@@ -262,10 +250,8 @@ test_jsapi_util_debug_string_valid_utf8(GjsUnitTestFixture *fx,
     g_free(debug_output);
 }
 
-static void
-test_jsapi_util_debug_string_invalid_utf8(GjsUnitTestFixture *fx,
-                                          gconstpointer       unused)
-{
+static void test_jsapi_util_debug_string_invalid_utf8(GjsUnitTestFixture* fx,
+                                                      const void*) {
     g_test_skip("SpiderMonkey doesn't validate UTF-8 after encoding it");
 
     JS::RootedValue v_string(fx->cx);
@@ -280,10 +266,8 @@ test_jsapi_util_debug_string_invalid_utf8(GjsUnitTestFixture *fx,
     g_free(debug_output);
 }
 
-static void
-test_jsapi_util_debug_string_object_with_complicated_to_string(GjsUnitTestFixture *fx,
-                                                               gconstpointer       unused)
-{
+static void test_jsapi_util_debug_string_object_with_complicated_to_string(
+    GjsUnitTestFixture* fx, const void*) {
     const char16_t desserts[] = {
         0xd83c, 0xdf6a,  /* cookie */
         0xd83c, 0xdf69,  /* doughnut */


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