functexcept.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. // Function-Based Exception Support -*- C++ -*-
  2. // Copyright (C) 2001-2015 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. // Helper for exception objects in <typeinfo>
  43. void
  44. __throw_bad_cast(void) __attribute__((__noreturn__));
  45. void
  46. __throw_bad_typeid(void) __attribute__((__noreturn__));
  47. // Helpers for exception objects in <stdexcept>
  48. void
  49. __throw_logic_error(const char*) __attribute__((__noreturn__));
  50. void
  51. __throw_domain_error(const char*) __attribute__((__noreturn__));
  52. void
  53. __throw_invalid_argument(const char*) __attribute__((__noreturn__));
  54. void
  55. __throw_length_error(const char*) __attribute__((__noreturn__));
  56. void
  57. __throw_out_of_range(const char*) __attribute__((__noreturn__));
  58. void
  59. __throw_out_of_range_fmt(const char*, ...) __attribute__((__noreturn__))
  60. __attribute__((__format__(__gnu_printf__, 1, 2)));
  61. void
  62. __throw_runtime_error(const char*) __attribute__((__noreturn__));
  63. void
  64. __throw_range_error(const char*) __attribute__((__noreturn__));
  65. void
  66. __throw_overflow_error(const char*) __attribute__((__noreturn__));
  67. void
  68. __throw_underflow_error(const char*) __attribute__((__noreturn__));
  69. // Helpers for exception objects in <ios>
  70. void
  71. __throw_ios_failure(const char*) __attribute__((__noreturn__));
  72. void
  73. __throw_system_error(int) __attribute__((__noreturn__));
  74. void
  75. __throw_future_error(int) __attribute__((__noreturn__));
  76. // Helpers for exception objects in <functional>
  77. void
  78. __throw_bad_function_call() __attribute__((__noreturn__));
  79. _GLIBCXX_END_NAMESPACE_VERSION
  80. } // namespace
  81. #endif