xapian-core  1.4.20
noreturn.h
Go to the documentation of this file.
1 
4 /* Copyright (C) 2007,2011 Olly Betts
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of the
9  * License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef XAPIAN_INCLUDED_NORETURN_H
22 #define XAPIAN_INCLUDED_NORETURN_H
23 
24 // The macro needs to be applied to a declaration, so use it like so:
25 //
26 // XAPIAN_NORETURN(static void throw_read_only());
27 // static void
28 // throw_read_only()
29 // {
30 // throw Xapian::InvalidOperationError("Server is read-only");
31 // }
32 
33 // Allow the user to override XAPIAN_NORETURN on the compiler command line.
34 #ifndef XAPIAN_NORETURN
35 # if defined __GNUC__
36 // __attribute__((__noreturn__)) is supported by GCC 2.5 and later so there's
37 // no need to check the GCC version in use.
38 # define XAPIAN_NORETURN(D) D __attribute__((__noreturn__))
39 # elif defined _MSC_VER && _MSC_VER >= 1300
40 // __declspec(noreturn) appears to be supported by MSVC 7.0 and later.
41 # define XAPIAN_NORETURN(D) __declspec(noreturn) D
42 # else
43 # define XAPIAN_NORETURN(D) D
44 # endif
45 #endif
46 
47 #endif // XAPIAN_INCLUDED_NORETURN_H