Bug 1120793 - Remove obsolete _Throw wrapping. r=froydnj
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 19 Aug 2015 15:55:34 +0900
changeset 258806 50bdc607693ddc255fa6b4b46a748d1995f6fc6f
parent 258805 a9ae8b90c678e8ed81bbc7b71c8c7489066f3a22
child 258807 4ff0f3bf54523456fa6d3d44091c1865ebd3690b
push id14787
push userryanvm@gmail.com
push dateSun, 23 Aug 2015 21:21:14 +0000
treeherderfx-team@4ccdd06e51d7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1120793
milestone43.0a1
Bug 1120793 - Remove obsolete _Throw wrapping. r=froydnj
configure.in
memory/mozalloc/moz.build
memory/mozalloc/msvc_throw_wrapper.cpp
memory/mozalloc/msvc_throw_wrapper.h
memory/mozalloc/staticruntime/moz.build
memory/mozalloc/throw_msvc.h
--- a/configure.in
+++ b/configure.in
@@ -658,76 +658,40 @@ See https://developer.mozilla.org/en/Win
             ;;
         x86_64-*)
             MIDL_FLAGS="${MIDL_FLAGS} -env x64"
             ;;
         esac
 
         unset _MSVC_VER_FILTER
 
-        AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
+        AC_CACHE_CHECK(for overridable _RAISE,
+                       ac_cv_have__RAISE,
             [
                 AC_LANG_SAVE
                 AC_LANG_CPLUSPLUS
                 _SAVE_CXXFLAGS="$CXXFLAGS"
                 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
-                AC_TRY_COMPILE([#include <exception>],
-                            [std::_Throw(std::exception()); return 0;],
-                            ac_cv_have_std__Throw="yes",
-                            ac_cv_have_std__Throw="no")
+                AC_TRY_COMPILE([#include <xstddef>
+                                #undef _RAISE
+                                #define _RAISE(x) externallyDefinedFunction((x).what())
+                                #include <vector>
+                               ],
+                               [std::vector<int> v; return v.at(1);],
+                               ac_cv_have__RAISE="no",
+                               ac_cv_have__RAISE="yes")
                 CXXFLAGS="$_SAVE_CXXFLAGS"
                 AC_LANG_RESTORE
             ])
-
-        if test "$ac_cv_have_std__Throw" = "yes"; then
-            AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
-                           ac_cv_have_dllimport_exception_bug,
-                [
-                    AC_LANG_SAVE
-                    AC_LANG_CPLUSPLUS
-                    _SAVE_CXXFLAGS="$CXXFLAGS"
-                    CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
-                    AC_TRY_LINK([#include <vector>],
-                                [std::vector<int> v; return v.at(1);],
-                                ac_cv_have_dllimport_exception_bug="no",
-                                ac_cv_have_dllimport_exception_bug="yes")
-                    CXXFLAGS="$_SAVE_CXXFLAGS"
-                    AC_LANG_RESTORE
-                ])
-            if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
-                WRAP_STL_INCLUDES=1
-                MOZ_MSVC_STL_WRAP_Throw=1
-                AC_DEFINE(MOZ_MSVC_STL_WRAP_Throw)
-            fi
+        if test "$ac_cv_have__RAISE" = "yes"; then
+            WRAP_STL_INCLUDES=1
+            MOZ_MSVC_STL_WRAP_RAISE=1
+            AC_DEFINE(MOZ_MSVC_STL_WRAP_RAISE)
         else
-            AC_CACHE_CHECK(for overridable _RAISE,
-                           ac_cv_have__RAISE,
-                [
-                    AC_LANG_SAVE
-                    AC_LANG_CPLUSPLUS
-                    _SAVE_CXXFLAGS="$CXXFLAGS"
-                    CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
-                    AC_TRY_COMPILE([#include <xstddef>
-                                    #undef _RAISE
-                                    #define _RAISE(x) externallyDefinedFunction((x).what())
-                                    #include <vector>
-                                   ],
-                                   [std::vector<int> v; return v.at(1);],
-                                   ac_cv_have__RAISE="no",
-                                   ac_cv_have__RAISE="yes")
-                    CXXFLAGS="$_SAVE_CXXFLAGS"
-                    AC_LANG_RESTORE
-                ])
-            if test "$ac_cv_have__RAISE" = "yes"; then
-                WRAP_STL_INCLUDES=1
-                MOZ_MSVC_STL_WRAP_RAISE=1
-                AC_DEFINE(MOZ_MSVC_STL_WRAP_RAISE)
-            else
-                AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK.  Please file a bug describing this error and your build configuration.])
-            fi
+            AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK.  Please file a bug describing this error and your build configuration.])
         fi
 
         if test "$WRAP_STL_INCLUDES" = "1"; then
             STL_FLAGS='-I$(DIST)/stl_wrappers'
         fi
         CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
         CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
 
@@ -834,17 +798,16 @@ AC_SUBST(GNU_AS)
 AC_SUBST(GNU_LD)
 AC_SUBST(GNU_CC)
 AC_SUBST(GNU_CXX)
 AC_SUBST(INTEL_CC)
 AC_SUBST(INTEL_CXX)
 
 AC_SUBST(STL_FLAGS)
 AC_SUBST(WRAP_STL_INCLUDES)
-AC_SUBST(MOZ_MSVC_STL_WRAP_Throw)
 AC_SUBST(MOZ_MSVC_STL_WRAP_RAISE)
 
 dnl ========================================================
 dnl Checks for programs.
 dnl ========================================================
 AC_PROG_INSTALL
 AC_PROG_LN_S
 
--- a/memory/mozalloc/moz.build
+++ b/memory/mozalloc/moz.build
@@ -6,35 +6,28 @@
 NO_VISIBILITY_FLAGS = True
 
 EXPORTS.mozilla += [
     'mozalloc.h',
     'mozalloc_abort.h',
     'mozalloc_oom.h',
 ]
 
-if CONFIG['MOZ_MSVC_STL_WRAP_RAISE'] or CONFIG['MOZ_MSVC_STL_WRAP_Throw']:
-    build_msvc_wrappers = 1
-else:
-    build_msvc_wrappers = 0
-
 if CONFIG['WRAP_STL_INCLUDES']:
     if CONFIG['GNU_CXX']:
         EXPORTS.mozilla += ['throw_gcc.h']
     elif CONFIG['_MSC_VER']:
         DEFINES['_HAS_EXCEPTIONS'] = 0
-        if build_msvc_wrappers:
+        if CONFIG['MOZ_MSVC_STL_WRAP_RAISE']:
             EXPORTS.mozilla += [
                 'msvc_raise_wrappers.h',
-                'msvc_throw_wrapper.h',
                 'throw_msvc.h',
             ]
             SOURCES += [
                 'msvc_raise_wrappers.cpp',
-                'msvc_throw_wrapper.cpp',
             ]
 
 UNIFIED_SOURCES += [
     'mozalloc.cpp',
     'mozalloc_abort.cpp',
     'mozalloc_oom.cpp',
 ]
 
deleted file mode 100644
--- a/memory/mozalloc/msvc_throw_wrapper.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- * vim: sw=4 ts=4 et :
- */
-/* 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 <exception>
-
-#include "mozilla/mozalloc_abort.h"
-
-namespace std {
-
-// NB: user code is not supposed to touch the std:: namespace.  We're
-// doing this after careful review because we want to define our own
-// exception throwing semantics.  Don't try this at home!
-
-__declspec(dllexport) void mozilla_Throw(const exception& e);
-
-void
-mozilla_Throw(const exception& e)
-{
-    mozalloc_abort(e.what());
-}
-
-} // namespace std
deleted file mode 100644
--- a/memory/mozalloc/msvc_throw_wrapper.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- * vim: sw=4 ts=4 et :
- */
-/* 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/. */
-
-#ifndef mozilla_msvc_throw_wrapper_h
-#define mozilla_msvc_throw_wrapper_h
-
-// Define our own _Throw because the Win2k CRT doesn't export it.
-#  ifdef _EXCEPTION_
-#    error "Unable to wrap _Throw(); CRT _Throw() already declared"
-#  endif
-#  define _Throw  mozilla_Throw
-#  include <exception>
-
-#endif  // ifndef mozilla_msvc_throw_wrapper_h
--- a/memory/mozalloc/staticruntime/moz.build
+++ b/memory/mozalloc/staticruntime/moz.build
@@ -1,27 +1,21 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
 NO_VISIBILITY_FLAGS = True
 
-if CONFIG['MOZ_MSVC_STL_WRAP_RAISE'] or CONFIG['MOZ_MSVC_STL_WRAP_Throw']:
-    build_msvc_wrappers = 1
-else:
-    build_msvc_wrappers = 0
-
 if CONFIG['WRAP_STL_INCLUDES']:
     DEFINES['_HAS_EXCEPTIONS'] = 0
-    if build_msvc_wrappers:
+    if CONFIG['MOZ_MSVC_STL_WRAP_RAISE']:
         SOURCES += [
             '../msvc_raise_wrappers.cpp',
-            '../msvc_throw_wrapper.cpp',
         ]
 
 UNIFIED_SOURCES += [
     '../mozalloc.cpp',
     '../mozalloc_abort.cpp',
     '../mozalloc_oom.cpp',
 ]
 
--- a/memory/mozalloc/throw_msvc.h
+++ b/memory/mozalloc/throw_msvc.h
@@ -5,15 +5,13 @@
  * 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/. */
 
 #ifndef mozilla_throw_msvc_h
 #define mozilla_throw_msvc_h
 
 #if defined(MOZ_MSVC_STL_WRAP_RAISE)
 #  include "msvc_raise_wrappers.h"
-#elif defined(MOZ_MSVC_STL_WRAP_Throw)
-#  include "msvc_throw_wrapper.h"
 #else
 #  error "Unknown STL wrapper tactic"
 #endif
 
 #endif  // mozilla_throw_msvc_h