[gjs/wip/ptomato/warnings: 2/10] warnings: Remove unused variables and functions



commit 7edc7673a97e192d7317ea4fda44f8a1f6f4ca2d
Author: Philip Chimento <philip chimento gmail com>
Date:   Thu Sep 29 08:42:25 2016 -0700

    warnings: Remove unused variables and functions
    
    In order to compile everything to the exacting standards of
    AX_COMPILER_FLAGS, this fixes all instances of -Wunused by removing the
    unused code.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=773297

 gi/arg.cpp         |    2 --
 gi/boxed.cpp       |    1 -
 gi/object.cpp      |    3 ---
 gi/repo.cpp        |    1 -
 gjs/byteArray.cpp  |    1 -
 gjs/coverage.cpp   |   41 ++---------------------------------------
 gjs/jsapi-util.cpp |   28 ----------------------------
 7 files changed, 2 insertions(+), 75 deletions(-)
---
diff --git a/gi/arg.cpp b/gi/arg.cpp
index 90f64b6..ff2b6c6 100644
--- a/gi/arg.cpp
+++ b/gi/arg.cpp
@@ -1770,11 +1770,9 @@ gjs_value_to_g_argument(JSContext      *context,
         gpointer data;
         gsize length;
         GIArrayType array_type = g_type_info_get_array_type(type_info);
-        GITypeTag element_type;
         GITypeInfo *param_info;
 
         param_info = g_type_info_get_param_type(type_info, 0);
-        element_type = g_type_info_get_tag(param_info);
 
         /* First, let's handle the case where we're passed an instance
          * of our own byteArray class.
diff --git a/gi/boxed.cpp b/gi/boxed.cpp
index a686e00..ccd6f9f 100644
--- a/gi/boxed.cpp
+++ b/gi/boxed.cpp
@@ -539,7 +539,6 @@ get_field_info (JSContext *context,
 {
     GIFieldInfo *field_info;
     char *name;
-    JS::Value value;
 
     if (!priv->field_map)
         priv->field_map = get_field_map(priv->info);
diff --git a/gi/object.cpp b/gi/object.cpp
index 004a164..07dfe0a 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -1903,7 +1903,6 @@ gjs_define_object_class(JSContext      *context,
     JSObject *prototype;
     JSObject *constructor;
     JSObject *parent_proto;
-    JSObject *global;
 
     JS::Value value;
     ObjectInstance *priv;
@@ -2028,8 +2027,6 @@ JSObject*
 gjs_object_from_g_object(JSContext    *context,
                          GObject      *gobj)
 {
-    JSObject *global;
-
     if (gobj == NULL)
         return NULL;
 
diff --git a/gi/repo.cpp b/gi/repo.cpp
index 96c40a0..82d68bf 100644
--- a/gi/repo.cpp
+++ b/gi/repo.cpp
@@ -760,7 +760,6 @@ gjs_lookup_generic_constructor(JSContext  *context,
                                GIBaseInfo *info)
 {
     JSObject *in_object;
-    JSObject *constructor;
     const char *constructor_name;
     JS::Value value;
 
diff --git a/gjs/byteArray.cpp b/gjs/byteArray.cpp
index 26d824a..b522ed5 100644
--- a/gjs/byteArray.cpp
+++ b/gjs/byteArray.cpp
@@ -515,7 +515,6 @@ static JSObject *
 byte_array_get_prototype(JSContext *context)
 {
     JS::Value retval;
-    JSObject *prototype;
 
     retval = gjs_get_global_slot (context, GJS_GLOBAL_SLOT_BYTE_ARRAY_PROTOTYPE);
 
diff --git a/gjs/coverage.cpp b/gjs/coverage.cpp
index 8f43942..06237c7 100644
--- a/gjs/coverage.cpp
+++ b/gjs/coverage.cpp
@@ -975,8 +975,6 @@ gjs_get_path_checksum(const char *path)
     return checksum;
 }
 
-static unsigned int COVERAGE_STATISTICS_CACHE_MAGIC = 0xC0432463;
-
 /* The binary data for the cache has the following structure:
  *
  * {
@@ -1043,22 +1041,6 @@ gjs_serialize_statistics(GjsCoverage *coverage)
                             strlen(statistics_as_json_string));
 }
 
-static JSObject *
-gjs_get_generic_object_constructor(JSContext        *context,
-                                   JSRuntime        *runtime,
-                                   JS::HandleObject  global_object)
-{
-    JSAutoRequest ar(context);
-    JSAutoCompartment ac(context, global_object);
-
-    JS::Value object_constructor_value;
-    if (!JS_GetProperty(context, global_object, "Object", &object_constructor_value) ||
-        !object_constructor_value.isObject())
-        g_assert_not_reached();
-
-    return &object_constructor_value.toObject();
-}
-
 static JSString *
 gjs_deserialize_cache_to_object_for_compartment(JSContext        *context,
                                                 JS::HandleObject global_object,
@@ -1123,8 +1105,7 @@ gjs_fetch_statistics_from_js(GjsCoverage *coverage,
     JS::RootedObject rooted_coverage_statistics(JS_GetRuntime(js_context),
                                                 priv->coverage_statistics);
 
-    char                      **file_iter = coverage_files;
-    GjsCoverageFileStatistics *statistics_iter = (GjsCoverageFileStatistics *) file_statistics_array->data;
+    char **file_iter = coverage_files;
     while (*file_iter) {
         GjsCoverageFileStatistics statistics;
         if (fetch_coverage_file_statistics_from_js(js_context,
@@ -1391,22 +1372,6 @@ get_filename_from_filename_as_js_string(JSContext    *context,
     return filename;
 }
 
-static GFile *
-get_file_from_filename_as_js_string(JSContext    *context,
-                                    JS::CallArgs &args) {
-    char *filename = get_filename_from_filename_as_js_string(context, args);
-
-    if (!filename) {
-        gjs_throw(context, "Failed to parse arguments for filename");
-        return NULL;
-    }
-
-    GFile *file = g_file_new_for_commandline_arg(filename);
-
-    g_free(filename);
-    return file;
-}
-
 static JSBool
 coverage_get_file_modification_time(JSContext *context,
                                     unsigned  argc,
@@ -1446,8 +1411,7 @@ coverage_get_file_checksum(JSContext *context,
                            JS::Value *vp)
 {
     JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
-    JSRuntime    *runtime = JS_GetRuntime(context);
-    GTimeVal mtime;
+    JSRuntime *runtime = JS_GetRuntime(context);
     char *filename = get_filename_from_filename_as_js_string(context, args);
 
     if (!filename)
@@ -1480,7 +1444,6 @@ coverage_get_file_contents(JSContext *context,
     GFile *file = NULL;
     char *script = NULL;
     gsize script_len;
-    JSString *script_jsstr;
     GError *error = NULL;
 
     if (!gjs_parse_call_args(context, "getFileContents", args, "s",
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index 35ffbdc..f26abe3 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -648,34 +648,6 @@ gjs_call_function_value(JSContext             *context,
     return result;
 }
 
-static bool
-log_prop(JSContext  *context,
-         JSObject   *obj,
-         JS::Value   id,
-         JS::Value  *value_p,
-         const char *what)
-{
-    if (id.isString()) {
-        char *name;
-
-        gjs_string_to_utf8(context, id, &name);
-        gjs_debug(GJS_DEBUG_PROPS,
-                  "prop %s: %s",
-                  name, what);
-        g_free(name);
-    } else if (id.isInt32()) {
-        gjs_debug(GJS_DEBUG_PROPS,
-                  "prop %d: %s",
-                  id.toInt32(), what);
-    } else {
-        gjs_debug(GJS_DEBUG_PROPS,
-                  "prop not-sure-what: %s",
-                  what);
-    }
-
-    return true;
-}
-
 /* get a debug string for type tag in JS::Value */
 const char*
 gjs_get_type_name(JS::Value value)


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