exception_defines.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // -fno-exceptions Support -*- C++ -*-
  2. // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2006, 2007, 2008, 2009
  3. // Free Software Foundation, Inc.
  4. //
  5. // This file is part of the GNU ISO C++ Library. This library is free
  6. // software; you can redistribute it and/or modify it under the
  7. // terms of the GNU General Public License as published by the
  8. // Free Software Foundation; either version 3, or (at your option)
  9. // any later version.
  10. // This library is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. // GNU General Public License for more details.
  14. // Under Section 7 of GPL version 3, you are granted additional
  15. // permissions described in the GCC Runtime Library Exception, version
  16. // 3.1, as published by the Free Software Foundation.
  17. // You should have received a copy of the GNU General Public License and
  18. // a copy of the GCC Runtime Library Exception along with this program;
  19. // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  20. // <http://www.gnu.org/licenses/>.
  21. //
  22. // ISO C++ 14882: 19.1 Exception classes
  23. //
  24. /** @file exception_defines.h
  25. * This is a Standard C++ Library header.
  26. */
  27. #ifndef _EXCEPTION_DEFINES_H
  28. #define _EXCEPTION_DEFINES_H 1
  29. #ifndef __EXCEPTIONS
  30. // Iff -fno-exceptions, transform error handling code to work without it.
  31. # define __try if (true)
  32. # define __catch(X) if (false)
  33. # define __throw_exception_again
  34. #else
  35. // Else proceed normally.
  36. # define __try try
  37. # define __catch(X) catch(X)
  38. # define __throw_exception_again throw
  39. #endif
  40. #endif