xref: /minix3/external/bsd/libc++/dist/libcxx/include/stdexcept (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
14684ddb6SLionel Sambuc// -*- C++ -*-
24684ddb6SLionel Sambuc//===--------------------------- stdexcept --------------------------------===//
34684ddb6SLionel Sambuc//
44684ddb6SLionel Sambuc//                     The LLVM Compiler Infrastructure
54684ddb6SLionel Sambuc//
64684ddb6SLionel Sambuc// This file is dual licensed under the MIT and the University of Illinois Open
74684ddb6SLionel Sambuc// Source Licenses. See LICENSE.TXT for details.
84684ddb6SLionel Sambuc//
94684ddb6SLionel Sambuc//===----------------------------------------------------------------------===//
104684ddb6SLionel Sambuc
114684ddb6SLionel Sambuc#ifndef _LIBCPP_STDEXCEPT
124684ddb6SLionel Sambuc#define _LIBCPP_STDEXCEPT
134684ddb6SLionel Sambuc
144684ddb6SLionel Sambuc/*
154684ddb6SLionel Sambuc    stdexcept synopsis
164684ddb6SLionel Sambuc
174684ddb6SLionel Sambucnamespace std
184684ddb6SLionel Sambuc{
194684ddb6SLionel Sambuc
204684ddb6SLionel Sambucclass logic_error;
214684ddb6SLionel Sambuc    class domain_error;
224684ddb6SLionel Sambuc    class invalid_argument;
234684ddb6SLionel Sambuc    class length_error;
244684ddb6SLionel Sambuc    class out_of_range;
254684ddb6SLionel Sambucclass runtime_error;
264684ddb6SLionel Sambuc    class range_error;
274684ddb6SLionel Sambuc    class overflow_error;
284684ddb6SLionel Sambuc    class underflow_error;
294684ddb6SLionel Sambuc
304684ddb6SLionel Sambucfor each class xxx_error:
314684ddb6SLionel Sambuc
324684ddb6SLionel Sambucclass xxx_error : public exception // at least indirectly
334684ddb6SLionel Sambuc{
344684ddb6SLionel Sambucpublic:
354684ddb6SLionel Sambuc    explicit xxx_error(const string& what_arg);
364684ddb6SLionel Sambuc    explicit xxx_error(const char*   what_arg);
374684ddb6SLionel Sambuc
384684ddb6SLionel Sambuc    virtual const char* what() const noexcept // returns what_arg
394684ddb6SLionel Sambuc};
404684ddb6SLionel Sambuc
414684ddb6SLionel Sambuc}  // std
424684ddb6SLionel Sambuc
434684ddb6SLionel Sambuc*/
444684ddb6SLionel Sambuc
454684ddb6SLionel Sambuc#include <__config>
464684ddb6SLionel Sambuc#include <exception>
474684ddb6SLionel Sambuc#include <iosfwd>  // for string forward decl
484684ddb6SLionel Sambuc
494684ddb6SLionel Sambuc#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
504684ddb6SLionel Sambuc#pragma GCC system_header
514684ddb6SLionel Sambuc#endif
524684ddb6SLionel Sambuc
53*0a6a1f1dSLionel Sambuc#ifndef _LIBCPP___REFSTRING
54*0a6a1f1dSLionel Sambuc_LIBCPP_BEGIN_NAMESPACE_STD
55*0a6a1f1dSLionel Sambucclass _LIBCPP_HIDDEN __libcpp_refstring {
56*0a6a1f1dSLionel Sambuc    const char *__imp_ _LIBCPP_UNUSED;
57*0a6a1f1dSLionel Sambuc};
58*0a6a1f1dSLionel Sambuc_LIBCPP_END_NAMESPACE_STD
59*0a6a1f1dSLionel Sambuc#endif
60*0a6a1f1dSLionel Sambuc
614684ddb6SLionel Sambucnamespace std  // purposefully not using versioning namespace
624684ddb6SLionel Sambuc{
634684ddb6SLionel Sambuc
644684ddb6SLionel Sambucclass _LIBCPP_EXCEPTION_ABI logic_error
654684ddb6SLionel Sambuc    : public exception
664684ddb6SLionel Sambuc{
674684ddb6SLionel Sambucprivate:
68*0a6a1f1dSLionel Sambuc    _VSTD::__libcpp_refstring __imp_;
694684ddb6SLionel Sambucpublic:
704684ddb6SLionel Sambuc    explicit logic_error(const string&);
714684ddb6SLionel Sambuc    explicit logic_error(const char*);
724684ddb6SLionel Sambuc
734684ddb6SLionel Sambuc    logic_error(const logic_error&) _NOEXCEPT;
744684ddb6SLionel Sambuc    logic_error& operator=(const logic_error&) _NOEXCEPT;
754684ddb6SLionel Sambuc
764684ddb6SLionel Sambuc    virtual ~logic_error() _NOEXCEPT;
774684ddb6SLionel Sambuc
784684ddb6SLionel Sambuc    virtual const char* what() const _NOEXCEPT;
794684ddb6SLionel Sambuc};
804684ddb6SLionel Sambuc
814684ddb6SLionel Sambucclass _LIBCPP_EXCEPTION_ABI runtime_error
824684ddb6SLionel Sambuc    : public exception
834684ddb6SLionel Sambuc{
844684ddb6SLionel Sambucprivate:
85*0a6a1f1dSLionel Sambuc    _VSTD::__libcpp_refstring __imp_;
864684ddb6SLionel Sambucpublic:
874684ddb6SLionel Sambuc    explicit runtime_error(const string&);
884684ddb6SLionel Sambuc    explicit runtime_error(const char*);
894684ddb6SLionel Sambuc
904684ddb6SLionel Sambuc    runtime_error(const runtime_error&) _NOEXCEPT;
914684ddb6SLionel Sambuc    runtime_error& operator=(const runtime_error&) _NOEXCEPT;
924684ddb6SLionel Sambuc
934684ddb6SLionel Sambuc    virtual ~runtime_error() _NOEXCEPT;
944684ddb6SLionel Sambuc
954684ddb6SLionel Sambuc    virtual const char* what() const _NOEXCEPT;
964684ddb6SLionel Sambuc};
974684ddb6SLionel Sambuc
984684ddb6SLionel Sambucclass _LIBCPP_EXCEPTION_ABI domain_error
994684ddb6SLionel Sambuc    : public logic_error
1004684ddb6SLionel Sambuc{
1014684ddb6SLionel Sambucpublic:
1024684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY explicit domain_error(const string& __s) : logic_error(__s) {}
1034684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY explicit domain_error(const char* __s)   : logic_error(__s) {}
1044684ddb6SLionel Sambuc
1054684ddb6SLionel Sambuc    virtual ~domain_error() _NOEXCEPT;
1064684ddb6SLionel Sambuc};
1074684ddb6SLionel Sambuc
1084684ddb6SLionel Sambucclass _LIBCPP_EXCEPTION_ABI invalid_argument
1094684ddb6SLionel Sambuc    : public logic_error
1104684ddb6SLionel Sambuc{
1114684ddb6SLionel Sambucpublic:
1124684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const string& __s) : logic_error(__s) {}
1134684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const char* __s)   : logic_error(__s) {}
1144684ddb6SLionel Sambuc
1154684ddb6SLionel Sambuc    virtual ~invalid_argument() _NOEXCEPT;
1164684ddb6SLionel Sambuc};
1174684ddb6SLionel Sambuc
1184684ddb6SLionel Sambucclass _LIBCPP_EXCEPTION_ABI length_error
1194684ddb6SLionel Sambuc    : public logic_error
1204684ddb6SLionel Sambuc{
1214684ddb6SLionel Sambucpublic:
1224684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY explicit length_error(const string& __s) : logic_error(__s) {}
1234684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY explicit length_error(const char* __s)   : logic_error(__s) {}
1244684ddb6SLionel Sambuc
1254684ddb6SLionel Sambuc    virtual ~length_error() _NOEXCEPT;
1264684ddb6SLionel Sambuc};
1274684ddb6SLionel Sambuc
1284684ddb6SLionel Sambucclass _LIBCPP_EXCEPTION_ABI out_of_range
1294684ddb6SLionel Sambuc    : public logic_error
1304684ddb6SLionel Sambuc{
1314684ddb6SLionel Sambucpublic:
1324684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY explicit out_of_range(const string& __s) : logic_error(__s) {}
1334684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY explicit out_of_range(const char* __s)   : logic_error(__s) {}
1344684ddb6SLionel Sambuc
1354684ddb6SLionel Sambuc    virtual ~out_of_range() _NOEXCEPT;
1364684ddb6SLionel Sambuc};
1374684ddb6SLionel Sambuc
1384684ddb6SLionel Sambucclass _LIBCPP_EXCEPTION_ABI range_error
1394684ddb6SLionel Sambuc    : public runtime_error
1404684ddb6SLionel Sambuc{
1414684ddb6SLionel Sambucpublic:
1424684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY explicit range_error(const string& __s) : runtime_error(__s) {}
1434684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY explicit range_error(const char* __s)   : runtime_error(__s) {}
1444684ddb6SLionel Sambuc
1454684ddb6SLionel Sambuc    virtual ~range_error() _NOEXCEPT;
1464684ddb6SLionel Sambuc};
1474684ddb6SLionel Sambuc
1484684ddb6SLionel Sambucclass _LIBCPP_EXCEPTION_ABI overflow_error
1494684ddb6SLionel Sambuc    : public runtime_error
1504684ddb6SLionel Sambuc{
1514684ddb6SLionel Sambucpublic:
1524684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY explicit overflow_error(const string& __s) : runtime_error(__s) {}
1534684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY explicit overflow_error(const char* __s)   : runtime_error(__s) {}
1544684ddb6SLionel Sambuc
1554684ddb6SLionel Sambuc    virtual ~overflow_error() _NOEXCEPT;
1564684ddb6SLionel Sambuc};
1574684ddb6SLionel Sambuc
1584684ddb6SLionel Sambucclass _LIBCPP_EXCEPTION_ABI underflow_error
1594684ddb6SLionel Sambuc    : public runtime_error
1604684ddb6SLionel Sambuc{
1614684ddb6SLionel Sambucpublic:
1624684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY explicit underflow_error(const string& __s) : runtime_error(__s) {}
1634684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY explicit underflow_error(const char* __s)   : runtime_error(__s) {}
1644684ddb6SLionel Sambuc
1654684ddb6SLionel Sambuc    virtual ~underflow_error() _NOEXCEPT;
1664684ddb6SLionel Sambuc};
1674684ddb6SLionel Sambuc
1684684ddb6SLionel Sambuc}  // std
1694684ddb6SLionel Sambuc
1704684ddb6SLionel Sambuc#endif  // _LIBCPP_STDEXCEPT
171