xref: /netbsd-src/external/gpl3/gcc.old/dist/libstdc++-v3/libsupc++/exception.h (revision 3ad841b2f6c3e57f95d0e6cec2feda2e43f1ebd0)
1*3ad841b2Smrg // Exception Handling support header for -*- C++ -*-
2*3ad841b2Smrg 
3*3ad841b2Smrg // Copyright (C) 2016-2017 Free Software Foundation, Inc.
4*3ad841b2Smrg //
5*3ad841b2Smrg // This file is part of GCC.
6*3ad841b2Smrg //
7*3ad841b2Smrg // GCC is free software; you can redistribute it and/or modify
8*3ad841b2Smrg // it under the terms of the GNU General Public License as published by
9*3ad841b2Smrg // the Free Software Foundation; either version 3, or (at your option)
10*3ad841b2Smrg // any later version.
11*3ad841b2Smrg //
12*3ad841b2Smrg // GCC is distributed in the hope that it will be useful,
13*3ad841b2Smrg // but WITHOUT ANY WARRANTY; without even the implied warranty of
14*3ad841b2Smrg // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15*3ad841b2Smrg // GNU General Public License for more details.
16*3ad841b2Smrg //
17*3ad841b2Smrg // Under Section 7 of GPL version 3, you are granted additional
18*3ad841b2Smrg // permissions described in the GCC Runtime Library Exception, version
19*3ad841b2Smrg // 3.1, as published by the Free Software Foundation.
20*3ad841b2Smrg 
21*3ad841b2Smrg // You should have received a copy of the GNU General Public License and
22*3ad841b2Smrg // a copy of the GCC Runtime Library Exception along with this program;
23*3ad841b2Smrg // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
24*3ad841b2Smrg // <http://www.gnu.org/licenses/>.
25*3ad841b2Smrg 
26*3ad841b2Smrg /** @file bits/exception.h
27*3ad841b2Smrg  *  This is an internal header file, included by other library headers.
28*3ad841b2Smrg  *  Do not attempt to use it directly.
29*3ad841b2Smrg  */
30*3ad841b2Smrg 
31*3ad841b2Smrg #ifndef __EXCEPTION_H
32*3ad841b2Smrg #define __EXCEPTION_H 1
33*3ad841b2Smrg 
34*3ad841b2Smrg #pragma GCC system_header
35*3ad841b2Smrg 
36*3ad841b2Smrg #pragma GCC visibility push(default)
37*3ad841b2Smrg 
38*3ad841b2Smrg #include <bits/c++config.h>
39*3ad841b2Smrg 
40*3ad841b2Smrg extern "C++" {
41*3ad841b2Smrg 
42*3ad841b2Smrg namespace std
43*3ad841b2Smrg {
44*3ad841b2Smrg   /**
45*3ad841b2Smrg    * @defgroup exceptions Exceptions
46*3ad841b2Smrg    * @ingroup diagnostics
47*3ad841b2Smrg    *
48*3ad841b2Smrg    * Classes and functions for reporting errors via exception classes.
49*3ad841b2Smrg    * @{
50*3ad841b2Smrg    */
51*3ad841b2Smrg 
52*3ad841b2Smrg   /**
53*3ad841b2Smrg    *  @brief Base class for all library exceptions.
54*3ad841b2Smrg    *
55*3ad841b2Smrg    *  This is the base class for all exceptions thrown by the standard
56*3ad841b2Smrg    *  library, and by certain language expressions.  You are free to derive
57*3ad841b2Smrg    *  your own %exception classes, or use a different hierarchy, or to
58*3ad841b2Smrg    *  throw non-class data (e.g., fundamental types).
59*3ad841b2Smrg    */
60*3ad841b2Smrg   class exception
61*3ad841b2Smrg   {
62*3ad841b2Smrg   public:
63*3ad841b2Smrg     exception() _GLIBCXX_USE_NOEXCEPT { }
64*3ad841b2Smrg     virtual ~exception() _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT;
65*3ad841b2Smrg 
66*3ad841b2Smrg     /** Returns a C-style character string describing the general cause
67*3ad841b2Smrg      *  of the current error.  */
68*3ad841b2Smrg     virtual const char*
69*3ad841b2Smrg     what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT;
70*3ad841b2Smrg   };
71*3ad841b2Smrg 
72*3ad841b2Smrg } // namespace std
73*3ad841b2Smrg 
74*3ad841b2Smrg }
75*3ad841b2Smrg 
76*3ad841b2Smrg #pragma GCC visibility pop
77*3ad841b2Smrg 
78*3ad841b2Smrg #endif
79