From dea9486c28e6a96480a33ff6771e4eafeaacad80 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Wed, 19 Aug 2015 15:55:34 +0900 Subject: [PATCH] Bug 1120793 - Remove obsolete _Throw wrapping. r=froydnj --- configure.in | 67 ++++++------------------- memory/mozalloc/moz.build | 9 +--- memory/mozalloc/msvc_throw_wrapper.cpp | 26 ---------- memory/mozalloc/msvc_throw_wrapper.h | 18 ------- memory/mozalloc/staticruntime/moz.build | 8 +-- memory/mozalloc/throw_msvc.h | 2 - 6 files changed, 17 insertions(+), 113 deletions(-) delete mode 100644 memory/mozalloc/msvc_throw_wrapper.cpp delete mode 100644 memory/mozalloc/msvc_throw_wrapper.h diff --git a/configure.in b/configure.in index 6d33504ae788..29b4f42836a4 100644 --- a/configure.in +++ b/configure.in @@ -663,66 +663,30 @@ See https://developer.mozilla.org/en/Windows_Build_Prerequisites.]) 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 ], - [std::_Throw(std::exception()); return 0;], - ac_cv_have_std__Throw="yes", - ac_cv_have_std__Throw="no") + AC_TRY_COMPILE([#include + #undef _RAISE + #define _RAISE(x) externallyDefinedFunction((x).what()) + #include + ], + [std::vector 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 ], - [std::vector 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 - #undef _RAISE - #define _RAISE(x) externallyDefinedFunction((x).what()) - #include - ], - [std::vector 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 @@ -839,7 +803,6 @@ 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 ======================================================== diff --git a/memory/mozalloc/moz.build b/memory/mozalloc/moz.build index 443a7f0efe9c..6bfe4bd139ca 100644 --- a/memory/mozalloc/moz.build +++ b/memory/mozalloc/moz.build @@ -11,25 +11,18 @@ EXPORTS.mozilla += [ '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 += [ diff --git a/memory/mozalloc/msvc_throw_wrapper.cpp b/memory/mozalloc/msvc_throw_wrapper.cpp deleted file mode 100644 index e93fd8a50ce6..000000000000 --- 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 - -#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 diff --git a/memory/mozalloc/msvc_throw_wrapper.h b/memory/mozalloc/msvc_throw_wrapper.h deleted file mode 100644 index 3bdfba40381a..000000000000 --- 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 - -#endif // ifndef mozilla_msvc_throw_wrapper_h diff --git a/memory/mozalloc/staticruntime/moz.build b/memory/mozalloc/staticruntime/moz.build index 56de6a066c0b..f29a9f8f5fea 100644 --- a/memory/mozalloc/staticruntime/moz.build +++ b/memory/mozalloc/staticruntime/moz.build @@ -6,17 +6,11 @@ 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 += [ diff --git a/memory/mozalloc/throw_msvc.h b/memory/mozalloc/throw_msvc.h index 3169e75f3fa6..e6ebf46dc4c0 100644 --- a/memory/mozalloc/throw_msvc.h +++ b/memory/mozalloc/throw_msvc.h @@ -10,8 +10,6 @@ #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