michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- michael@0: * vim: sw=4 ts=4 et : michael@0: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_msvc_raise_wrappers_h michael@0: #define mozilla_msvc_raise_wrappers_h michael@0: michael@0: #ifdef _XSTDDEF_ michael@0: # error "Unable to wrap _RAISE(); CRT _RAISE() already defined" michael@0: #endif michael@0: #ifdef _XUTILITY_ michael@0: # error "Unabled to wrap _X[exception]"(); CRT versions already declared" michael@0: #endif michael@0: michael@0: #include "mozilla/mozalloc_abort.h" michael@0: michael@0: namespace std { michael@0: michael@0: // NB: user code is not supposed to touch the std:: namespace. We're michael@0: // doing this after careful review because we want to define our own michael@0: // exception throwing semantics. Don't try this at home! michael@0: michael@0: MOZALLOC_EXPORT __declspec(noreturn) void moz_Xinvalid_argument(const char*); michael@0: MOZALLOC_EXPORT __declspec(noreturn) void moz_Xlength_error(const char*); michael@0: MOZALLOC_EXPORT __declspec(noreturn) void moz_Xout_of_range(const char*); michael@0: MOZALLOC_EXPORT __declspec(noreturn) void moz_Xoverflow_error(const char*); michael@0: MOZALLOC_EXPORT __declspec(noreturn) void moz_Xruntime_error(const char*); michael@0: michael@0: } // namespace std michael@0: michael@0: #ifndef MOZALLOC_DONT_WRAP_RAISE_FUNCTIONS michael@0: michael@0: # define _Xinvalid_argument moz_Xinvalid_argument michael@0: # define _Xlength_error moz_Xlength_error michael@0: # define _Xout_of_range moz_Xout_of_range michael@0: # define _Xoverflow_error moz_Xoverflow_error michael@0: # define _Xruntime_error moz_Xruntime_error michael@0: michael@0: # include michael@0: # include michael@0: michael@0: # undef _RAISE michael@0: # define _RAISE(x) mozalloc_abort((x).what()) michael@0: michael@0: #endif // ifndef MOZALLOC_DONT_WRAP_RAISE_FUNCTIONS michael@0: michael@0: #endif // ifndef mozilla_msvc_raise_wrappers_h