Bug 1423512 - Remove infallible allocator exception for xpcom glue code. r=erahm
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 06 Dec 2017 09:56:02 +0900
changeset 395378 0c9996186048d2ad338c153861fb1c8aa80ce181
parent 395377 1e489f546448d4762df44d484d12910c91d12453
child 395379 642f885eb10955d2743231337a2ce3e077220ba7
push id33040
push userbtara@mozilla.com
push dateThu, 07 Dec 2017 10:50:47 +0000
treeherdermozilla-central@3c2576d4ea82 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerserahm
bugs1423512, 868814
milestone59.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 1423512 - Remove infallible allocator exception for xpcom glue code. r=erahm Back when mozalloc was a separate library, the xpcom glue code could not use the infallible allocator API. But since bug 868814, that's not the case anymore, so we can safely include mozalloc.h when XPCOM_GLUE is set.
config/gcc-stl-wrapper.template.h
config/msvc-stl-wrapper.template.h
xpcom/base/nscore.h
--- a/config/gcc-stl-wrapper.template.h
+++ b/config/gcc-stl-wrapper.template.h
@@ -40,20 +40,18 @@
 #  define MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
 #endif
 
 #pragma GCC visibility push(default)
 #include_next <${HEADER}>
 #pragma GCC visibility pop
 
 #ifdef MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
-// See if we're in code that can use mozalloc.  NB: this duplicates
-// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
-// can't build with that being included before base/basictypes.h.
-#  if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
+// See if we're in code that can use mozalloc.
+#  if !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
 #    include "mozilla/mozalloc.h"
 #  else
 #    error "STL code can only be used with infallible ::operator new()"
 #  endif
 #endif
 
 // gcc calls a __throw_*() function from bits/functexcept.h when it
 // wants to "throw an exception".  functexcept exists nominally to
--- a/config/msvc-stl-wrapper.template.h
+++ b/config/msvc-stl-wrapper.template.h
@@ -57,19 +57,17 @@
 #include_next <${HEADER}>
 #else
 #include <${HEADER_PATH}>
 #endif
 
 #pragma warning( pop )
 
 #ifdef MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
-// See if we're in code that can use mozalloc.  NB: this duplicates
-// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
-// can't build with that being included before base/basictypes.h.
-#  if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
+// See if we're in code that can use mozalloc.
+#  if !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
 #    include "mozilla/mozalloc.h"
 #  else
 #    error "STL code can only be used with infallible ::operator new()"
 #  endif
 #endif
 
 #endif  // if mozilla_${HEADER}_h
--- a/xpcom/base/nscore.h
+++ b/xpcom/base/nscore.h
@@ -11,17 +11,17 @@
  * Make sure that we have the proper platform specific
  * c++ definitions needed by nscore.h
  */
 #ifndef _XPCOM_CONFIG_H_
 #include "xpcom-config.h"
 #endif
 
 /* Definitions of functions and operators that allocate memory. */
-#if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
+#if !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
 #  include "mozilla/mozalloc.h"
 #endif
 
 /**
  * Incorporate the integer data types which XPCOM uses.
  */
 #include <stddef.h>
 #include <stdint.h>