xref: /netbsd-src/external/gpl3/gcc.old/dist/libstdc++-v3/libsupc++/exception.h (revision 4c3eb207d36f67d31994830c0a694161fc1ca39b)
13ad841b2Smrg // Exception Handling support header for -*- C++ -*-
23ad841b2Smrg 
3*4c3eb207Smrg // Copyright (C) 2016-2020 Free Software Foundation, Inc.
43ad841b2Smrg //
53ad841b2Smrg // This file is part of GCC.
63ad841b2Smrg //
73ad841b2Smrg // GCC is free software; you can redistribute it and/or modify
83ad841b2Smrg // it under the terms of the GNU General Public License as published by
93ad841b2Smrg // the Free Software Foundation; either version 3, or (at your option)
103ad841b2Smrg // any later version.
113ad841b2Smrg //
123ad841b2Smrg // GCC is distributed in the hope that it will be useful,
133ad841b2Smrg // but WITHOUT ANY WARRANTY; without even the implied warranty of
143ad841b2Smrg // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
153ad841b2Smrg // GNU General Public License for more details.
163ad841b2Smrg //
173ad841b2Smrg // Under Section 7 of GPL version 3, you are granted additional
183ad841b2Smrg // permissions described in the GCC Runtime Library Exception, version
193ad841b2Smrg // 3.1, as published by the Free Software Foundation.
203ad841b2Smrg 
213ad841b2Smrg // You should have received a copy of the GNU General Public License and
223ad841b2Smrg // a copy of the GCC Runtime Library Exception along with this program;
233ad841b2Smrg // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
243ad841b2Smrg // <http://www.gnu.org/licenses/>.
253ad841b2Smrg 
263ad841b2Smrg /** @file bits/exception.h
273ad841b2Smrg  *  This is an internal header file, included by other library headers.
283ad841b2Smrg  *  Do not attempt to use it directly.
293ad841b2Smrg  */
303ad841b2Smrg 
313ad841b2Smrg #ifndef __EXCEPTION_H
323ad841b2Smrg #define __EXCEPTION_H 1
333ad841b2Smrg 
343ad841b2Smrg #pragma GCC system_header
353ad841b2Smrg 
363ad841b2Smrg #pragma GCC visibility push(default)
373ad841b2Smrg 
383ad841b2Smrg #include <bits/c++config.h>
393ad841b2Smrg 
403ad841b2Smrg extern "C++" {
413ad841b2Smrg 
423ad841b2Smrg namespace std
433ad841b2Smrg {
443ad841b2Smrg   /**
453ad841b2Smrg    * @defgroup exceptions Exceptions
463ad841b2Smrg    * @ingroup diagnostics
473ad841b2Smrg    *
48*4c3eb207Smrg    * Classes and functions for reporting errors via exceptions.
493ad841b2Smrg    * @{
503ad841b2Smrg    */
513ad841b2Smrg 
523ad841b2Smrg   /**
533ad841b2Smrg    *  @brief Base class for all library exceptions.
543ad841b2Smrg    *
553ad841b2Smrg    *  This is the base class for all exceptions thrown by the standard
563ad841b2Smrg    *  library, and by certain language expressions.  You are free to derive
573ad841b2Smrg    *  your own %exception classes, or use a different hierarchy, or to
583ad841b2Smrg    *  throw non-class data (e.g., fundamental types).
593ad841b2Smrg    */
603ad841b2Smrg   class exception
613ad841b2Smrg   {
623ad841b2Smrg   public:
exception()63627f7eb2Smrg     exception() _GLIBCXX_NOTHROW { }
64627f7eb2Smrg     virtual ~exception() _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_NOTHROW;
65627f7eb2Smrg #if __cplusplus >= 201103L
66627f7eb2Smrg     exception(const exception&) = default;
67627f7eb2Smrg     exception& operator=(const exception&) = default;
68627f7eb2Smrg     exception(exception&&) = default;
69627f7eb2Smrg     exception& operator=(exception&&) = default;
70627f7eb2Smrg #endif
713ad841b2Smrg 
723ad841b2Smrg     /** Returns a C-style character string describing the general cause
733ad841b2Smrg      *  of the current error.  */
743ad841b2Smrg     virtual const char*
75627f7eb2Smrg     what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_NOTHROW;
763ad841b2Smrg   };
773ad841b2Smrg 
78*4c3eb207Smrg   /// @}
79*4c3eb207Smrg 
803ad841b2Smrg } // namespace std
813ad841b2Smrg 
823ad841b2Smrg }
833ad841b2Smrg 
843ad841b2Smrg #pragma GCC visibility pop
853ad841b2Smrg 
863ad841b2Smrg #endif
87