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 418611 d8411d78d58a
parent 418610 19d2aace5b3c
child 418612 e016aa76775e
push id103351
push userjwalden@mit.edu
push date2018-05-17 07:17 +0000
treeherdermozilla-inbound@e016aa76775e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1461556
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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()
 {