xapian-core  1.4.26
deprecated.h
Go to the documentation of this file.
1 
4 // Copyright (C) 2006,2007,2009,2011,2012,2013,2014 Olly Betts
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (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 #ifndef XAPIAN_INCLUDED_DEPRECATED_H
21 #define XAPIAN_INCLUDED_DEPRECATED_H
22 
23 #if !defined XAPIAN_IN_XAPIAN_H && !defined XAPIAN_LIB_BUILD
24 # error Never use <xapian/deprecated.h> directly; include <xapian.h> instead.
25 #endif
26 
27 // How to make use of XAPIAN_DEPRECATED, etc is documented in HACKING - see
28 // the section "Marking Features as Deprecated". Don't forget to update the
29 // documentation of deprecated methods for end users in docs/deprecation.rst
30 // too!
31 
32 // Don't give deprecation warnings for features marked as externally deprecated
33 // when building the library.
34 #ifdef XAPIAN_IN_XAPIAN_H
35 # define XAPIAN_DEPRECATED_EX(D) XAPIAN_DEPRECATED(D)
36 # define XAPIAN_DEPRECATED_CLASS_EX XAPIAN_DEPRECATED_CLASS
37 #else
38 # define XAPIAN_DEPRECATED_EX(D) D
39 # define XAPIAN_DEPRECATED_CLASS_EX
40 #endif
41 
42 // xapian-bindings needs to wrap deprecated functions without warnings,
43 // so check if XAPIAN_DEPRECATED is defined so xapian-bindings can override
44 // it.
45 #ifndef XAPIAN_DEPRECATED
46 # ifdef __GNUC__
47 // __attribute__((__deprecated__)) is supported by GCC 3.1 and later, which
48 // is now our minimum requirement, so there's no need to check the GCC version
49 // in use.
50 # define XAPIAN_DEPRECATED(D) D __attribute__((__deprecated__))
51 # define XAPIAN_DEPRECATED_CLASS __attribute__((__deprecated__))
52 # elif defined _MSC_VER && _MSC_VER >= 1300
53 // __declspec(deprecated) is supported by MSVC 7.0 and later.
54 # define XAPIAN_DEPRECATED(D) __declspec(deprecated) D
55 # define XAPIAN_DEPRECATED_CLASS __declspec(deprecated)
56 # else
57 # define XAPIAN_DEPRECATED(D) D
58 # endif
59 #endif
60 
61 #ifndef XAPIAN_DEPRECATED_CLASS
62 # define XAPIAN_DEPRECATED_CLASS
63 #endif
64 
65 #endif