xref: /freebsd/contrib/llvm-project/libcxx/include/__cxx03/exception (revision 700637cbb5e582861067a11aaca4d053546871d2)
1*700637cbSDimitry Andric// -*- C++ -*-
2*700637cbSDimitry Andric//===----------------------------------------------------------------------===//
3*700637cbSDimitry Andric//
4*700637cbSDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5*700637cbSDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
6*700637cbSDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7*700637cbSDimitry Andric//
8*700637cbSDimitry Andric//===----------------------------------------------------------------------===//
9*700637cbSDimitry Andric
10*700637cbSDimitry Andric#ifndef _LIBCPP___CXX03_EXCEPTION
11*700637cbSDimitry Andric#define _LIBCPP___CXX03_EXCEPTION
12*700637cbSDimitry Andric
13*700637cbSDimitry Andric/*
14*700637cbSDimitry Andric    exception synopsis
15*700637cbSDimitry Andric
16*700637cbSDimitry Andricnamespace std
17*700637cbSDimitry Andric{
18*700637cbSDimitry Andric
19*700637cbSDimitry Andricclass exception
20*700637cbSDimitry Andric{
21*700637cbSDimitry Andricpublic:
22*700637cbSDimitry Andric    exception() noexcept;
23*700637cbSDimitry Andric    exception(const exception&) noexcept;
24*700637cbSDimitry Andric    exception& operator=(const exception&) noexcept;
25*700637cbSDimitry Andric    virtual ~exception() noexcept;
26*700637cbSDimitry Andric    virtual const char* what() const noexcept;
27*700637cbSDimitry Andric};
28*700637cbSDimitry Andric
29*700637cbSDimitry Andricclass bad_exception
30*700637cbSDimitry Andric    : public exception
31*700637cbSDimitry Andric{
32*700637cbSDimitry Andricpublic:
33*700637cbSDimitry Andric    bad_exception() noexcept;
34*700637cbSDimitry Andric    bad_exception(const bad_exception&) noexcept;
35*700637cbSDimitry Andric    bad_exception& operator=(const bad_exception&) noexcept;
36*700637cbSDimitry Andric    virtual ~bad_exception() noexcept;
37*700637cbSDimitry Andric    virtual const char* what() const noexcept;
38*700637cbSDimitry Andric};
39*700637cbSDimitry Andric
40*700637cbSDimitry Andrictypedef void (*unexpected_handler)();
41*700637cbSDimitry Andricunexpected_handler set_unexpected(unexpected_handler  f ) noexcept;
42*700637cbSDimitry Andricunexpected_handler get_unexpected() noexcept;
43*700637cbSDimitry Andric[[noreturn]] void unexpected();
44*700637cbSDimitry Andric
45*700637cbSDimitry Andrictypedef void (*terminate_handler)();
46*700637cbSDimitry Andricterminate_handler set_terminate(terminate_handler  f ) noexcept;
47*700637cbSDimitry Andricterminate_handler get_terminate() noexcept;
48*700637cbSDimitry Andric[[noreturn]] void terminate() noexcept;
49*700637cbSDimitry Andric
50*700637cbSDimitry Andricbool uncaught_exception()  noexcept;
51*700637cbSDimitry Andricint  uncaught_exceptions() noexcept;  // C++17
52*700637cbSDimitry Andric
53*700637cbSDimitry Andrictypedef unspecified exception_ptr;
54*700637cbSDimitry Andric
55*700637cbSDimitry Andricexception_ptr current_exception() noexcept;
56*700637cbSDimitry Andricvoid rethrow_exception [[noreturn]] (exception_ptr p);
57*700637cbSDimitry Andrictemplate<class E> exception_ptr make_exception_ptr(E e) noexcept;
58*700637cbSDimitry Andric
59*700637cbSDimitry Andricclass nested_exception
60*700637cbSDimitry Andric{
61*700637cbSDimitry Andricpublic:
62*700637cbSDimitry Andric    nested_exception() noexcept;
63*700637cbSDimitry Andric    nested_exception(const nested_exception&) noexcept = default;
64*700637cbSDimitry Andric    nested_exception& operator=(const nested_exception&) noexcept = default;
65*700637cbSDimitry Andric    virtual ~nested_exception() = default;
66*700637cbSDimitry Andric
67*700637cbSDimitry Andric    // access functions
68*700637cbSDimitry Andric    [[noreturn]] void rethrow_nested() const;
69*700637cbSDimitry Andric    exception_ptr nested_ptr() const noexcept;
70*700637cbSDimitry Andric};
71*700637cbSDimitry Andric
72*700637cbSDimitry Andrictemplate <class T> [[noreturn]] void throw_with_nested(T&& t);
73*700637cbSDimitry Andrictemplate <class E> void rethrow_if_nested(const E& e);
74*700637cbSDimitry Andric
75*700637cbSDimitry Andric}  // std
76*700637cbSDimitry Andric
77*700637cbSDimitry Andric*/
78*700637cbSDimitry Andric
79*700637cbSDimitry Andric#include <__cxx03/__config>
80*700637cbSDimitry Andric#include <__cxx03/__exception/exception.h>
81*700637cbSDimitry Andric#include <__cxx03/__exception/exception_ptr.h>
82*700637cbSDimitry Andric#include <__cxx03/__exception/nested_exception.h>
83*700637cbSDimitry Andric#include <__cxx03/__exception/operations.h>
84*700637cbSDimitry Andric#include <__cxx03/__exception/terminate.h>
85*700637cbSDimitry Andric#include <__cxx03/version>
86*700637cbSDimitry Andric
87*700637cbSDimitry Andric#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
88*700637cbSDimitry Andric#  pragma GCC system_header
89*700637cbSDimitry Andric#endif
90*700637cbSDimitry Andric
91*700637cbSDimitry Andric#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES)
92*700637cbSDimitry Andric#  include <__cxx03/cstdlib>
93*700637cbSDimitry Andric#  include <__cxx03/type_traits>
94*700637cbSDimitry Andric#endif
95*700637cbSDimitry Andric
96*700637cbSDimitry Andric#endif // _LIBCPP___CXX03_EXCEPTION
97