Bug 1248416 - add symbols for bad_function_call exception for C++ runtimes. r=nfroyd
authorLee Salzman <lsalzman@mozilla.com>
Wed, 24 Feb 2016 20:00:10 -0500
changeset 321827 6041201c9e88622fca6ac54403e40deacf6c72dd
parent 321826 10cb85773212cf74ff648e0eaed73434b20ddeb2
child 321828 405edcc5dbfaffd76929d92ab50339ed947bd8f9
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnfroyd
bugs1248416
milestone47.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 1248416 - add symbols for bad_function_call exception for C++ runtimes. r=nfroyd
config/stl-headers
config/system-headers
memory/mozalloc/msvc_raise_wrappers.cpp
memory/mozalloc/msvc_raise_wrappers.h
memory/mozalloc/throw_gcc.h
--- a/config/stl-headers
+++ b/config/stl-headers
@@ -15,19 +15,21 @@
 new
 
 # FIXME: these headers haven't been reviewed yet, but we use them
 # unsafely in Gecko, so we might as well prevent them from
 # throwing exceptions
 algorithm
 atomic
 deque
+functional
 ios
 iosfwd
 iostream
+istream
 iterator
 limits
 list
 map
 memory
 ostream
 set
 stack
--- a/config/system-headers
+++ b/config/system-headers
@@ -482,16 +482,17 @@ ftadvanc.h
 ftbitmap.h
 ftxf86.h
 fribidi/fribidi.h
 FSp_fopen.h
 fstream
 fstream.h
 ft2build.h
 fts.h
+functional
 gconf/gconf-client.h
 Gdiplus.h
 gdk/gdk.h
 gdk/gdkkeysyms.h
 gdk/gdkprivate.h
 gdk/gdkx.h
 gdk/gdkdirectfb.h
 gdk-pixbuf/gdk-pixbuf.h
@@ -560,16 +561,17 @@ io.h
 IOKit/IOKitLib.h
 IOKit/IOMessage.h
 IOKit/pwr_mgt/IOPMLib.h
 iomanip
 ios
 iosfwd
 iostream
 iostream.h
+istream
 iterator
 JavaControl.h
 JavaEmbedding/JavaControl.h
 JavaVM/jni.h
 JManager.h
 JNIEnvTests.h
 jni.h
 #if MOZ_NATIVE_JPEG==1
--- a/memory/mozalloc/msvc_raise_wrappers.cpp
+++ b/memory/mozalloc/msvc_raise_wrappers.cpp
@@ -49,9 +49,15 @@ moz_Xoverflow_error(const char* what)
 }
 
 MFBT_API __declspec(noreturn) void
 moz_Xruntime_error(const char* what)
 {
     abort_from_exception("runtime_error", what);
 }
 
+MFBT_API __declspec(noreturn) void
+moz_Xbad_function_call()
+{
+    abort_from_exception("bad_function_call", "bad function call");
+}
+
 } // namespace std
--- a/memory/mozalloc/msvc_raise_wrappers.h
+++ b/memory/mozalloc/msvc_raise_wrappers.h
@@ -7,30 +7,35 @@
 
 #ifndef mozilla_msvc_raise_wrappers_h
 #define mozilla_msvc_raise_wrappers_h
 
 #ifdef _XSTDDEF_
 #  error "Unable to wrap _RAISE(); CRT _RAISE() already defined"
 #endif
 #ifdef _XUTILITY_
-#  error "Unabled to wrap _X[exception]"(); CRT versions already declared"
+#  error "Unable to wrap _X[exception](); CRT versions already declared"
+#endif
+#ifdef _FUNCTIONAL_
+#  error "Unable to wrap _Xbad_function_call(); CRT version already declared"
 #endif
 
 #include "mozilla/mozalloc_abort.h"
 
 // xutility will declare the following functions in the std namespace.
 // We #define them to be named differently so we can ensure the exception
 // throwing semantics of these functions work exactly the way we want, by
 // defining our own versions in msvc_raise_wrappers.cpp.
 #  define _Xinvalid_argument  moz_Xinvalid_argument
 #  define _Xlength_error      moz_Xlength_error
 #  define _Xout_of_range      moz_Xout_of_range
 #  define _Xoverflow_error    moz_Xoverflow_error
 #  define _Xruntime_error     moz_Xruntime_error
+// used by <functional>
+#  define _Xbad_function_call moz_Xbad_function_call
 
 #  include <xstddef>
 #  include <xutility>
 
 #  undef _RAISE
 #  define _RAISE(x) mozalloc_abort((x).what())
 
 #endif  // ifndef mozilla_msvc_raise_wrappers_h
--- a/memory/mozalloc/throw_gcc.h
+++ b/memory/mozalloc/throw_gcc.h
@@ -44,16 +44,23 @@ MOZ_NORETURN MOZ_ALWAYS_INLINE void
 }
 
 MOZ_NORETURN MOZ_ALWAYS_INLINE void
 __throw_bad_typeid(void)
 {
     mozalloc_abort("fatal: STL threw bad_typeid");
 }
 
+// used by <functional>
+MOZ_NORETURN MOZ_ALWAYS_INLINE void
+__throw_bad_function_call(void)
+{
+    mozalloc_abort("fatal: STL threw bad_function_call");
+}
+
 MOZ_NORETURN MOZ_ALWAYS_INLINE void
 __throw_logic_error(const char* msg)
 {
     mozalloc_abort(msg);
 }
 
 MOZ_NORETURN MOZ_ALWAYS_INLINE void
 __throw_domain_error(const char* msg)