Bug 881358 - Kill build warnings in XPConnect; r=bholley
authorMs2ger <ms2ger@gmail.com>
Wed, 12 Jun 2013 09:00:09 +0200
changeset 135111 b8d033f67ca35fadeac4250e2715686c79bdf139
parent 135110 e00f2ef984c6aa9fd7d51953b8fd47f109a7a7d4
child 135112 0414d6d0f60d80d584ac7811d3e2ffccb447f0ec
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersbholley
bugs881358
milestone24.0a1
Bug 881358 - Kill build warnings in XPConnect; r=bholley
js/xpconnect/loader/Makefile.in
js/xpconnect/loader/mozJSComponentLoader.cpp
js/xpconnect/shell/Makefile.in
js/xpconnect/src/Makefile.in
js/xpconnect/src/XPCComponents.cpp
js/xpconnect/src/XPCWrappedJSClass.cpp
js/xpconnect/src/XPCWrappedNative.cpp
js/xpconnect/src/XPCWrappedNativeScope.cpp
js/xpconnect/wrappers/Makefile.in
--- a/js/xpconnect/loader/Makefile.in
+++ b/js/xpconnect/loader/Makefile.in
@@ -4,16 +4,17 @@
 
 DEPTH 		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
+FAIL_ON_WARNINGS := 1
 LIBRARY_NAME	= jsloader_s
 MSVC_ENABLE_PGO := 1
 FORCE_STATIC_LIB = 1
 LIBXUL_LIBRARY = 1
 LOCAL_INCLUDES += \
   -I$(srcdir)/../src \
   -I$(srcdir)/../wrappers \
   -I$(topsrcdir)/content/base/src \
--- a/js/xpconnect/loader/mozJSComponentLoader.cpp
+++ b/js/xpconnect/loader/mozJSComponentLoader.cpp
@@ -1,11 +1,11 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim: set ts=8 sts=4 et sw=4 tw=99: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/Attributes.h"
 
 #ifdef MOZ_LOGGING
 #define FORCE_PR_LOG
 #endif
@@ -663,17 +663,17 @@ mozJSComponentLoader::FindTargetObject(J
     aTargetObject.set(targetObject);
     return NS_OK;
 }
 
 void
 mozJSComponentLoader::NoteSubScript(HandleScript aScript, HandleObject aThisObject)
 {
   if (!mInitialized && NS_FAILED(ReallyInit())) {
-      MOZ_NOT_REACHED();
+      MOZ_CRASH();
   }
 
   mThisObjects.Put(aScript, aThisObject);
 }
 
 // Some stack based classes for cleaning up on early return
 #ifdef HAVE_PR_MEMMAP
 class FileAutoCloser
@@ -1470,17 +1470,17 @@ mozJSComponentLoader::ModuleEntry::GetFa
                                               const mozilla::Module::CIDEntry& entry)
 {
     const ModuleEntry& self = static_cast<const ModuleEntry&>(module);
     NS_ASSERTION(self.getfactoryobj, "Handing out an uninitialized module?");
 
     nsCOMPtr<nsIFactory> f;
     nsresult rv = self.getfactoryobj->Get(*entry.cid, getter_AddRefs(f));
     if (NS_FAILED(rv))
-        return NULL;
+        return nullptr;
 
     return f.forget();
 }
 
 //----------------------------------------------------------------------
 
 JSCLContextHelper::JSCLContextHelper(JSContext* aCx)
     : mContext(aCx)
--- a/js/xpconnect/shell/Makefile.in
+++ b/js/xpconnect/shell/Makefile.in
@@ -5,16 +5,17 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
+FAIL_ON_WARNINGS := 1
 SDK_BINARY	= $(PROGRAM)
 
 LOCAL_INCLUDES += \
   -I$(topsrcdir)/toolkit/xre \
   $(NULL)
 
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 CMMSRCS += xpcshellMacUtils.mm
--- a/js/xpconnect/src/Makefile.in
+++ b/js/xpconnect/src/Makefile.in
@@ -9,16 +9,18 @@ srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 LIBRARY_NAME    = xpconnect_s
 MSVC_ENABLE_PGO := 1
 FORCE_STATIC_LIB = 1
 LIBXUL_LIBRARY = 1
+FAIL_ON_WARNINGS := 1
+
 include $(topsrcdir)/config/config.mk
 
 LOCAL_INCLUDES = \
 		-I$(srcdir)/../wrappers \
 		-I$(srcdir)/../loader \
 		-I$(topsrcdir)/caps/include \
 		-I$(topsrcdir)/content/base/src \
 		-I$(topsrcdir)/content/base/public \
--- a/js/xpconnect/src/XPCComponents.cpp
+++ b/js/xpconnect/src/XPCComponents.cpp
@@ -4791,17 +4791,17 @@ nsXPCComponents::GetProperty(nsIXPConnec
         doResult = true;
     } else if (id == rt->GetStringID(XPCJSRuntime::IDX_RETURN_CODE)) {
         res = xpcc->GetPendingResult();
         doResult = true;
     }
 
     nsresult rv = NS_OK;
     if (doResult) {
-        *vp = JS_NumberValue((double) res);
+        *vp = JS_NumberValue((double)(uint32_t) res);
         rv = NS_SUCCESS_I_DID_SOMETHING;
     }
 
     return rv;
 }
 
 /* bool setProperty (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in jsid id, in JSValPtr vp); */
 NS_IMETHODIMP
--- a/js/xpconnect/src/XPCWrappedJSClass.cpp
+++ b/js/xpconnect/src/XPCWrappedJSClass.cpp
@@ -834,21 +834,20 @@ nsXPCWrappedJSClass::GetArraySizeFromPar
     uint8_t argnum;
     nsresult rv;
 
     rv = mInfo->GetSizeIsArgNumberForParam(methodIndex, &param, 0, &argnum);
     if (NS_FAILED(rv))
         return false;
 
     const nsXPTParamInfo& arg_param = method->params[argnum];
-    const nsXPTType& arg_type = arg_param.GetType();
 
     // This should be enforced by the xpidl compiler, but it's not.
     // See bug 695235.
-    NS_ABORT_IF_FALSE(arg_type.TagPart() == nsXPTType::T_U32,
+    NS_ABORT_IF_FALSE(arg_param.GetType().TagPart() == nsXPTType::T_U32,
                       "size_is references parameter of invalid type.");
 
     if (arg_param.IsIndirect())
         *result = *(uint32_t*)nativeParams[argnum].val.p;
     else
         *result = nativeParams[argnum].val.u32;
 
     return true;
--- a/js/xpconnect/src/XPCWrappedNative.cpp
+++ b/js/xpconnect/src/XPCWrappedNative.cpp
@@ -2185,18 +2185,17 @@ public:
 
 };
 
 // static
 JSBool
 XPCWrappedNative::CallMethod(XPCCallContext& ccx,
                              CallMode mode /*= CALL_METHOD */)
 {
-    XPCContext* xpcc = ccx.GetXPCContext();
-    NS_ASSERTION(xpcc->CallerTypeIsJavaScript(),
+    NS_ASSERTION(ccx.GetXPCContext()->CallerTypeIsJavaScript(),
                  "Native caller for XPCWrappedNative::CallMethod?");
 
     nsresult rv = ccx.CanCallNow();
     if (NS_FAILED(rv)) {
         return Throw(rv, ccx);
     }
 
     DEBUG_TrackWrapperCall(ccx.GetWrapper(), mode);
--- a/js/xpconnect/src/XPCWrappedNativeScope.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeScope.cpp
@@ -423,18 +423,17 @@ WrappedNativeSuspecter(JSDHashTable *tab
     }
 
     return JS_DHASH_NEXT;
 }
 
 static void
 SuspectDOMExpandos(JSObject *obj, nsCycleCollectionNoteRootCallback &cb)
 {
-    const dom::DOMClass* clasp = dom::GetDOMClass(obj);
-    MOZ_ASSERT(clasp && clasp->mDOMObjectIsISupports);
+    MOZ_ASSERT(dom::GetDOMClass(obj) && dom::GetDOMClass(obj)->mDOMObjectIsISupports);
     nsISupports* native = dom::UnwrapDOMObject<nsISupports>(obj);
     cb.NoteXPCOMRoot(native);
 }
 
 // static
 void
 XPCWrappedNativeScope::SuspectAllWrappers(XPCJSRuntime* rt,
                                           nsCycleCollectionNoteRootCallback& cb)
--- a/js/xpconnect/wrappers/Makefile.in
+++ b/js/xpconnect/wrappers/Makefile.in
@@ -8,13 +8,17 @@ srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 LIBRARY_NAME	= xpcwrappers_s
 MSVC_ENABLE_PGO := 1
 FORCE_STATIC_LIB = 1
 LIBXUL_LIBRARY = 1
+ifndef _MSC_VER # warning C4661 for FilteringWrapper
+FAIL_ON_WARNINGS := 1
+endif # !_MSC_VER
+
 LOCAL_INCLUDES = \
                 -I$(srcdir)/../src \
                 -I$(srcdir)/../../../dom/base \
 
 include $(topsrcdir)/config/rules.mk