functexcept.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. // Function-Based Exception Support -*- C++ -*-
  2. // Copyright (C) 2001-2022 Free Software Foundation, Inc.
  3. //
  4. // This file is part of the GNU ISO C++ Library. This library is free
  5. // software; you can redistribute it and/or modify it under the
  6. // terms of the GNU General Public License as published by the
  7. // Free Software Foundation; either version 3, or (at your option)
  8. // any later version.
  9. // This library is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. // Under Section 7 of GPL version 3, you are granted additional
  14. // permissions described in the GCC Runtime Library Exception, version
  15. // 3.1, as published by the Free Software Foundation.
  16. // You should have received a copy of the GNU General Public License and
  17. // a copy of the GCC Runtime Library Exception along with this program;
  18. // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  19. // <http://www.gnu.org/licenses/>.
  20. /** @file bits/functexcept.h
  21. * This is an internal header file, included by other library headers.
  22. * Do not attempt to use it directly. @headername{exception}
  23. *
  24. * This header provides support for -fno-exceptions.
  25. */
  26. //
  27. // ISO C++ 14882: 19.1 Exception classes
  28. //
  29. #ifndef _FUNCTEXCEPT_H
  30. #define _FUNCTEXCEPT_H 1
  31. #include <bits/c++config.h>
  32. #include <bits/exception_defines.h>
  33. namespace std _GLIBCXX_VISIBILITY(default)
  34. {
  35. _GLIBCXX_BEGIN_NAMESPACE_VERSION
  36. // Helper for exception objects in <except>
  37. void
  38. __throw_bad_exception(void) __attribute__((__noreturn__));
  39. // Helper for exception objects in <new>
  40. void
  41. __throw_bad_alloc(void) __attribute__((__noreturn__));
  42. void
  43. __throw_bad_array_new_length(void) __attribute__((__noreturn__));
  44. // Helper for exception objects in <typeinfo>
  45. void
  46. __throw_bad_cast(void) __attribute__((__noreturn__));
  47. void
  48. __throw_bad_typeid(void) __attribute__((__noreturn__));
  49. // Helpers for exception objects in <stdexcept>
  50. void
  51. __throw_logic_error(const char*) __attribute__((__noreturn__));
  52. void
  53. __throw_domain_error(const char*) __attribute__((__noreturn__));
  54. void
  55. __throw_invalid_argument(const char*) __attribute__((__noreturn__));
  56. void
  57. __throw_length_error(const char*) __attribute__((__noreturn__));
  58. void
  59. __throw_out_of_range(const char*) __attribute__((__noreturn__));
  60. void
  61. __throw_out_of_range_fmt(const char*, ...) __attribute__((__noreturn__))
  62. __attribute__((__format__(__gnu_printf__, 1, 2)));
  63. void
  64. __throw_runtime_error(const char*) __attribute__((__noreturn__));
  65. void
  66. __throw_range_error(const char*) __attribute__((__noreturn__));
  67. void
  68. __throw_overflow_error(const char*) __attribute__((__noreturn__));
  69. void
  70. __throw_underflow_error(const char*) __attribute__((__noreturn__));
  71. // Helpers for exception objects in <ios>
  72. void
  73. __throw_ios_failure(const char*) __attribute__((__noreturn__));
  74. void
  75. __throw_ios_failure(const char*, int) __attribute__((__noreturn__));
  76. // Helpers for exception objects in <system_error>
  77. void
  78. __throw_system_error(int) __attribute__((__noreturn__));
  79. // Helpers for exception objects in <future>
  80. void
  81. __throw_future_error(int) __attribute__((__noreturn__));
  82. // Helpers for exception objects in <functional>
  83. void
  84. __throw_bad_function_call() __attribute__((__noreturn__));
  85. _GLIBCXX_END_NAMESPACE_VERSION
  86. } // namespace
  87. #endif