exception_defines.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // -fno-exceptions 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/exception_defines.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. #ifndef _EXCEPTION_DEFINES_H
  25. #define _EXCEPTION_DEFINES_H 1
  26. #if ! __cpp_exceptions
  27. // Iff -fno-exceptions, transform error handling code to work without it.
  28. # define __try if (true)
  29. # define __catch(X) if (false)
  30. # define __throw_exception_again
  31. #else
  32. // Else proceed normally.
  33. # define __try try
  34. # define __catch(X) catch(X)
  35. # define __throw_exception_again throw
  36. #endif
  37. #endif