#ifndef mozilla_throw_gcc_h
#define mozilla_throw_gcc_h
#include "mozilla/Attributes.h"
#include <stdio.h>
#include <string.h>
#include "mozilla/mozalloc_abort.h"
#if defined(__clang__)
# if __has_feature(cxx_attributes) && defined(_LIBCPP_VERSION) && \
_LIBCPP_VERSION >= 4000
# define MOZ_THROW_NORETURN [[noreturn]]
# endif
#endif
#ifndef MOZ_THROW_NORETURN
# define MOZ_THROW_NORETURN MOZ_NORETURN
#endif
#ifdef __MINGW32__
# define MOZ_THROW_INLINE MOZ_ALWAYS_INLINE_EVEN_DEBUG
# define MOZ_THROW_EXPORT
#else
# define MOZ_THROW_INLINE MOZ_ALWAYS_INLINE
# define MOZ_THROW_EXPORT MOZ_EXPORT
#endif
namespace std {
MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_bad_exception(
void) {
mozalloc_abort("fatal: STL threw bad_exception");
}
MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_bad_alloc(
void) {
mozalloc_abort("fatal: STL threw bad_alloc");
}
MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_bad_cast(
void) {
mozalloc_abort("fatal: STL threw bad_cast");
}
MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_bad_typeid(
void) {
mozalloc_abort("fatal: STL threw bad_typeid");
}
MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
__throw_bad_function_call(void) {
mozalloc_abort("fatal: STL threw bad_function_call");
}
MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_logic_error(
const char* msg) {
mozalloc_abort(msg);
}
MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_domain_error(
const char* msg) {
mozalloc_abort(msg);
}
MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
__throw_invalid_argument(const char* msg) {
mozalloc_abort(msg);
}
MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_length_error(
const char* msg) {
mozalloc_abort(msg);
}
MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_out_of_range(
const char* msg) {
mozalloc_abort(msg);
}
MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_runtime_error(
const char* msg) {
mozalloc_abort(msg);
}
MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_range_error(
const char* msg) {
mozalloc_abort(msg);
}
MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
__throw_overflow_error(const char* msg) {
mozalloc_abort(msg);
}
MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
__throw_underflow_error(const char* msg) {
mozalloc_abort(msg);
}
MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_ios_failure(
const char* msg) {
mozalloc_abort(msg);
}
MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_system_error(
int err) {
char error[128];
snprintf(error, sizeof(error) - 1, "fatal: STL threw system_error: %s (%d)",
strerror(err), err);
mozalloc_abort(error);
}
MOZ_THROW_NORETURN MOZ_EXPORT MOZ_ALWAYS_INLINE void __throw_regex_error(
int err) {
char error[128];
snprintf(error, sizeof(error) - 1, "fatal: STL threw regex_error: %s (%d)",
strerror(err), err);
mozalloc_abort(error);
}
}
#undef MOZ_THROW_NORETURN
#undef MOZ_THROW_INLINE
#endif