Bug 1461556 - Call memset on a void*, not a T*, in js_delete_poison to avoid memset-on-nontrivial warnings with gcc that don't matter for an object whose lifetime is about to end. r=jandem
authorJeff Walden <jwalden@mit.edu>
Wed, 16 May 2018 10:44:54 -0700
changeset 466767 d8411d78d58a6bfb1dc333403734f6ec8c9ba2e2
parent 466766 19d2aace5b3ca316f548906b4283ebad44d3c8dd
child 466768 e016aa76775e0d914bd1caf32fdaaf7fc78de25e
push id179
push userfmarier@mozilla.com
push dateFri, 25 May 2018 23:33:48 +0000
reviewersjandem
bugs1461556
milestone62.0a1
Bug 1461556 - Call memset on a void*, not a T*, in js_delete_poison to avoid memset-on-nontrivial warnings with gcc that don't matter for an object whose lifetime is about to end. r=jandem
js/public/Utility.h
--- a/js/public/Utility.h
+++ b/js/public/Utility.h
@@ -544,17 +544,17 @@ js_delete(const T* p)
 }
 
 template<class T>
 static MOZ_ALWAYS_INLINE void
 js_delete_poison(const T* p)
 {
     if (p) {
         p->~T();
-        memset(const_cast<T*>(p), 0x3B, sizeof(T));
+        memset(static_cast<void*>(const_cast<T*>(p)), 0x3B, sizeof(T));
         js_free(const_cast<T*>(p));
     }
 }
 
 template <class T>
 static MOZ_ALWAYS_INLINE T*
 js_pod_malloc()
 {