operations.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. #ifndef _LIBCPP___EXCEPTION_OPERATIONS_H
  9. #define _LIBCPP___EXCEPTION_OPERATIONS_H
  10. #include <__availability>
  11. #include <__config>
  12. #include <cstddef>
  13. #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  14. # pragma GCC system_header
  15. #endif
  16. namespace std { // purposefully not using versioning namespace
  17. #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS) || \
  18. defined(_LIBCPP_BUILDING_LIBRARY)
  19. using unexpected_handler = void (*)();
  20. _LIBCPP_EXPORTED_FROM_ABI unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT;
  21. _LIBCPP_EXPORTED_FROM_ABI unexpected_handler get_unexpected() _NOEXCEPT;
  22. _LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void unexpected();
  23. #endif
  24. using terminate_handler = void (*)();
  25. _LIBCPP_EXPORTED_FROM_ABI terminate_handler set_terminate(terminate_handler) _NOEXCEPT;
  26. _LIBCPP_EXPORTED_FROM_ABI terminate_handler get_terminate() _NOEXCEPT;
  27. _LIBCPP_EXPORTED_FROM_ABI bool uncaught_exception() _NOEXCEPT;
  28. _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS int uncaught_exceptions() _NOEXCEPT;
  29. class _LIBCPP_EXPORTED_FROM_ABI exception_ptr;
  30. _LIBCPP_EXPORTED_FROM_ABI exception_ptr current_exception() _NOEXCEPT;
  31. _LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void rethrow_exception(exception_ptr);
  32. } // namespace std
  33. #endif // _LIBCPP___EXCEPTION_OPERATIONS_H