libstdc++
|
00001 // Exception Handling support header for -*- C++ -*- 00002 00003 // Copyright (C) 2016-2019 Free Software Foundation, Inc. 00004 // 00005 // This file is part of GCC. 00006 // 00007 // GCC is free software; you can redistribute it and/or modify 00008 // it under the terms of the GNU General Public License as published by 00009 // the Free Software Foundation; either version 3, or (at your option) 00010 // any later version. 00011 // 00012 // GCC is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // 00017 // Under Section 7 of GPL version 3, you are granted additional 00018 // permissions described in the GCC Runtime Library Exception, version 00019 // 3.1, as published by the Free Software Foundation. 00020 00021 // You should have received a copy of the GNU General Public License and 00022 // a copy of the GCC Runtime Library Exception along with this program; 00023 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 00024 // <http://www.gnu.org/licenses/>. 00025 00026 /** @file bits/exception.h 00027 * This is an internal header file, included by other library headers. 00028 * Do not attempt to use it directly. 00029 */ 00030 00031 #ifndef __EXCEPTION_H 00032 #define __EXCEPTION_H 1 00033 00034 #pragma GCC system_header 00035 00036 #pragma GCC visibility push(default) 00037 00038 #include <bits/c++config.h> 00039 00040 extern "C++" { 00041 00042 namespace std 00043 { 00044 /** 00045 * @defgroup exceptions Exceptions 00046 * @ingroup diagnostics 00047 * 00048 * Classes and functions for reporting errors via exception classes. 00049 * @{ 00050 */ 00051 00052 /** 00053 * @brief Base class for all library exceptions. 00054 * 00055 * This is the base class for all exceptions thrown by the standard 00056 * library, and by certain language expressions. You are free to derive 00057 * your own %exception classes, or use a different hierarchy, or to 00058 * throw non-class data (e.g., fundamental types). 00059 */ 00060 class exception 00061 { 00062 public: 00063 exception() _GLIBCXX_NOTHROW { } 00064 virtual ~exception() _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_NOTHROW; 00065 #if __cplusplus >= 201103L 00066 exception(const exception&) = default; 00067 exception& operator=(const exception&) = default; 00068 exception(exception&&) = default; 00069 exception& operator=(exception&&) = default; 00070 #endif 00071 00072 /** Returns a C-style character string describing the general cause 00073 * of the current error. */ 00074 virtual const char* 00075 what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_NOTHROW; 00076 }; 00077 00078 } // namespace std 00079 00080 } 00081 00082 #pragma GCC visibility pop 00083 00084 #endif