[gjs: 6/16] js: Mark places where error checking is not necessary



commit f8672ea2670373171addebd459784a839e08e3ec
Author: Philip Chimento <philip chimento gmail com>
Date:   Sun Oct 28 15:58:57 2018 -0400

    js: Mark places where error checking is not necessary
    
    There are a few places where the annotations that we will add in a
    subsequent commit will cause false positives. Mark these places with
    mozilla::Unused to avoid a compiler warning. Whenever this is done, there
    should be a comment explaining why it is justified.

 gi/arg.cpp   | 6 ++++--
 gi/value.cpp | 5 ++++-
 2 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/gi/arg.cpp b/gi/arg.cpp
index cb282ff5..83d9b944 100644
--- a/gi/arg.cpp
+++ b/gi/arg.cpp
@@ -23,8 +23,9 @@
 
 #include <config.h>
 
-#include <cstdlib>
+#include <mozilla/Unused.h>
 #include <cmath>
+#include <cstdlib>
 
 #include "arg.h"
 #include "gtype.h"
@@ -1788,7 +1789,8 @@ gjs_value_to_g_argument(JSContext      *context,
                                 gjs_fundamental_ref(context, arg->v_pointer);
                         } else {
                             /* Call again with throw=true to set the exception */
-                            gjs_typecheck_object(context, obj, gtype, true);
+                            mozilla::Unused << gjs_typecheck_object(
+                                context, obj, gtype, true);
                             arg->v_pointer = NULL;
                             wrong = true;
                         }
diff --git a/gi/value.cpp b/gi/value.cpp
index 867ab7df..4db748e3 100644
--- a/gi/value.cpp
+++ b/gi/value.cpp
@@ -23,6 +23,8 @@
 
 #include <config.h>
 
+#include <mozilla/Unused.h>
+
 #include <util/log.h>
 
 #include "foreign.h"
@@ -269,7 +271,8 @@ closure_marshal(GClosure        *closure,
             g_base_info_unref((GIBaseInfo *)type_info_for[i]);
 
     JS::RootedValue rval(context);
-    gjs_closure_invoke(closure, nullptr, argv, &rval, false);
+    mozilla::Unused << gjs_closure_invoke(closure, nullptr, argv, &rval, false);
+    // Any exception now pending, is handled when returning control to JS
 
     if (return_value != NULL) {
         if (rval.isUndefined()) {


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