msvc_raise_wrappers.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  2. * vim: sw=4 ts=4 et :
  3. */
  4. /* This Source Code Form is subject to the terms of the Mozilla Public
  5. * License, v. 2.0. If a copy of the MPL was not distributed with this
  6. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  7. #ifndef mozilla_msvc_raise_wrappers_h
  8. #define mozilla_msvc_raise_wrappers_h
  9. #ifdef _XSTDDEF_
  10. # error "Unable to wrap _RAISE(); CRT _RAISE() already defined"
  11. #endif
  12. #ifdef _XUTILITY_
  13. # error "Unable to wrap _X[exception](); CRT versions already declared"
  14. #endif
  15. #ifdef _FUNCTIONAL_
  16. # error "Unable to wrap _Xbad_function_call(); CRT version already declared"
  17. #endif
  18. #include "mozilla/mozalloc_abort.h"
  19. // xutility will declare the following functions in the std namespace.
  20. // We #define them to be named differently so we can ensure the exception
  21. // throwing semantics of these functions work exactly the way we want, by
  22. // defining our own versions in msvc_raise_wrappers.cpp.
  23. # define _Xinvalid_argument moz_Xinvalid_argument
  24. # define _Xlength_error moz_Xlength_error
  25. # define _Xout_of_range moz_Xout_of_range
  26. # define _Xoverflow_error moz_Xoverflow_error
  27. # define _Xruntime_error moz_Xruntime_error
  28. // used by <functional>
  29. # define _Xbad_function_call moz_Xbad_function_call
  30. # include <xstddef>
  31. # include <xutility>
  32. # undef _RAISE
  33. # define _RAISE(x) mozalloc_abort((x).what())
  34. #endif // ifndef mozilla_msvc_raise_wrappers_h