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