memory/mozalloc/msvc_throw_wrapper.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/memory/mozalloc/msvc_throw_wrapper.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,30 @@
     1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     1.5 + * vim: sw=4 ts=4 et :
     1.6 + */
     1.7 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.8 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.9 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    1.10 +
    1.11 +#include <exception>
    1.12 +
    1.13 +#if defined(XP_WIN)
    1.14 +#  define MOZALLOC_EXPORT __declspec(dllexport)
    1.15 +#endif
    1.16 +
    1.17 +#include "mozilla/mozalloc_abort.h"
    1.18 +
    1.19 +namespace std {
    1.20 +
    1.21 +// NB: user code is not supposed to touch the std:: namespace.  We're
    1.22 +// doing this after careful review because we want to define our own
    1.23 +// exception throwing semantics.  Don't try this at home!
    1.24 +
    1.25 +__declspec(dllexport) void mozilla_Throw(const exception& e);
    1.26 +
    1.27 +void
    1.28 +mozilla_Throw(const exception& e)
    1.29 +{
    1.30 +    mozalloc_abort(e.what());
    1.31 +}
    1.32 +
    1.33 +}  // namespace std

mercurial