Bug 1189967 - Avoid conflicting declarations for our raise wrappers on Windows. r=nfroyd

This commit is contained in:
Mike Hommey 2015-08-21 18:43:10 +09:00
parent 2c95cd99ca
commit e67b4f4cf1
2 changed files with 9 additions and 26 deletions

View File

@ -9,9 +9,6 @@
#include "mozalloc_abort.h"
#define MOZALLOC_DONT_WRAP_RAISE_FUNCTIONS
#include "mozilla/throw_msvc.h"
__declspec(noreturn) static void abort_from_exception(const char* const which,
const char* const what);
static void
@ -27,31 +24,31 @@ namespace std {
// doing this after careful review because we want to define our own
// exception throwing semantics. Don't try this at home!
void
MFBT_API __declspec(noreturn) void
moz_Xinvalid_argument(const char* what)
{
abort_from_exception("invalid_argument", what);
}
void
MFBT_API __declspec(noreturn) void
moz_Xlength_error(const char* what)
{
abort_from_exception("length_error", what);
}
void
MFBT_API __declspec(noreturn) void
moz_Xout_of_range(const char* what)
{
abort_from_exception("out_of_range", what);
}
void
MFBT_API __declspec(noreturn) void
moz_Xoverflow_error(const char* what)
{
abort_from_exception("overflow_error", what);
}
void
MFBT_API __declspec(noreturn) void
moz_Xruntime_error(const char* what)
{
abort_from_exception("runtime_error", what);

View File

@ -17,22 +17,10 @@
#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!
MFBT_API __declspec(noreturn) void moz_Xinvalid_argument(const char*);
MFBT_API __declspec(noreturn) void moz_Xlength_error(const char*);
MFBT_API __declspec(noreturn) void moz_Xout_of_range(const char*);
MFBT_API __declspec(noreturn) void moz_Xoverflow_error(const char*);
MFBT_API __declspec(noreturn) void moz_Xruntime_error(const char*);
} // namespace std
#ifndef MOZALLOC_DONT_WRAP_RAISE_FUNCTIONS
// 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
@ -45,6 +33,4 @@ MFBT_API __declspec(noreturn) void moz_Xruntime_error(const char*);
# undef _RAISE
# define _RAISE(x) mozalloc_abort((x).what())
#endif // ifndef MOZALLOC_DONT_WRAP_RAISE_FUNCTIONS
#endif // ifndef mozilla_msvc_raise_wrappers_h