xapian-core  2.0.0
version_h.cc
Go to the documentation of this file.
1 
6 #include <config.h>
7 const char * dummy[] = {
8 "/** @file",
9 " * @brief Define preprocessor symbols for the library version",
10 " */",
11 "// Copyright (C) 2002-2022 Olly Betts",
12 "//",
13 "// This program is free software; you can redistribute it and/or",
14 "// modify it under the terms of the GNU General Public License as",
15 "// published by the Free Software Foundation; either version 2 of the",
16 "// License, or (at your option) any later version.",
17 "//",
18 "// This program is distributed in the hope that it will be useful,",
19 "// but WITHOUT ANY WARRANTY; without even the implied warranty of",
20 "// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",
21 "// GNU General Public License for more details.",
22 "//",
23 "// You should have received a copy of the GNU General Public License",
24 "// along with this program; if not, see",
25 "// <https://www.gnu.org/licenses/>.",
26 "",
27 "#ifndef XAPIAN_INCLUDED_VERSION_H",
28 "#define XAPIAN_INCLUDED_VERSION_H",
29 "",
30 "#if !defined XAPIAN_IN_XAPIAN_H && !defined XAPIAN_LIB_BUILD",
31 "# error @@Never use <xapian/version.h> directly; include <xapian.h> instead.@@",
32 "#endif",
33 "",
34 #ifdef __GNUC__
35 // We used to check __GXX_ABI_VERSION here which was helpful in the GCC 3 days,
36 // but ABI versions 2 and up are compatible aside from obscure corner cases,
37 // and GCC now defaults to using the latest ABI version it supports. The
38 // result is that this check was no longer useful enough to justify the noise.
39 //
40 // We still check that the setting of _GLIBCXX_DEBUG matches since that
41 // introduces ABI-like incompatibilities.
42 //
43 // After preprocessing with "g++ -E" or similar (which will expand macros,
44 // strip comments such as this block, etc) we remove lines starting with a
45 // '#', remove blank lines, and collapse multiple spaces. And we strip out
46 // double quotes, then replace '@@' with '"', and drop ',' at the end of a
47 // line (the purpose of the ',' is to prevent certain preprocessors from
48 // concatenating literal strings).
49 //
50 // So for lines we want in the output, we quote parts of the line which we
51 // don't want substituting, and use @@ where we really want " in the output.
52 "#ifdef __GNUC__",
53 // Clang always masquerades as GCC 4.2; Intel's compiler seems to vary.
54 "#if !defined __clang__ && !defined __INTEL_COMPILER && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8))",
55 "#error Xapian no longer supports GCC < 4.8",
56 "#else",
57 // _GLIBCXX_DEBUG is supported by GCC 3.4 and later.
58 #ifdef _GLIBCXX_DEBUG
59 "#ifndef _GLIBCXX_DEBUG",
60 "#error This library was compiled with _GLIBCXX_DEBUG defined, but you",
61 "#error have not specified this flag. The settings must match or your",
62 "#error program will not work correctly.",
63 "#endif",
64 #else
65 "#ifdef _GLIBCXX_DEBUG",
66 "#error You are compiling with _GLIBCXX_DEBUG defined, but the library",
67 "#error was not compiled with this flag. The settings must match or your",
68 "#error program will not work correctly.",
69 "#endif",
70 #endif
71 "#endif",
72 "#endif",
73 "",
74 #elif defined _MSC_VER
75 // When building the library with MSVC, generate preprocessor code to check
76 // that the same setting of _DEBUG is used for building applications as was
77 // used for building the library.
78 "#ifdef _MSC_VER",
79 #ifdef _DEBUG
80 "#ifndef _DEBUG",
81 "#error This library was compiled with _DEBUG defined, but you",
82 "#error have not specified this flag. The settings must match or your",
83 "#error program will not work correctly.",
84 "#endif",
85 #else
86 "#ifdef _DEBUG",
87 "#error You are compiling with _DEBUG defined, but the library",
88 "#error was not compiled with this flag. The settings must match or your",
89 "#error program will not work correctly.",
90 "#endif",
91 #endif
92 "#endif",
93 "",
94 #endif
95 #ifdef XAPIAN_ENABLE_VISIBILITY
96 "/// The library was compiled with GCC's -fvisibility=hidden option.",
97 "#define XAPIAN_ENABLE_VISIBILITY",
98 "",
99 #endif
100 "/// The version of Xapian as a C string literal.",
101 "#define XAPIAN_VERSION ", STRING_VERSION,
102 "",
103 "/** The major component of the Xapian version.",
104 " * E.g. for Xapian 1.0.14 this would be: 1",
105 " */",
106 "#define XAPIAN_MAJOR_VERSION ", MAJOR_VERSION,
107 "",
108 "/** The minor component of the Xapian version.",
109 " * E.g. for Xapian 1.0.14 this would be: 0",
110 " */",
111 "#define XAPIAN_MINOR_VERSION ", MINOR_VERSION,
112 "",
113 "/** The revision component of the Xapian version.",
114 " * E.g. for Xapian 1.0.14 this would be: 14",
115 " */",
116 "#define XAPIAN_REVISION ", REVISION,
117 "",
118 "/// Base (signed) type for Xapian::docid and related types.",
119 "#define XAPIAN_DOCID_BASE_TYPE ", XAPIAN_DOCID_BASE_TYPE,
120 "",
121 "/// Base (signed) type for Xapian::termcount and related types.",
122 "#define XAPIAN_TERMCOUNT_BASE_TYPE ", XAPIAN_TERMCOUNT_BASE_TYPE,
123 "",
124 "/// Base (signed) type for Xapian::termpos.",
125 "#define XAPIAN_TERMPOS_BASE_TYPE ", XAPIAN_TERMPOS_BASE_TYPE,
126 "",
127 "/// Type for returning total document length.",
128 "#define XAPIAN_TOTALLENGTH_TYPE ", XAPIAN_REVISION_TYPE,
129 "",
130 "/// Underlying type for Xapian::rev.",
131 "#define XAPIAN_REVISION_TYPE ", XAPIAN_REVISION_TYPE,
132 "",
133 "/// XAPIAN_HAS_GLASS_BACKEND Defined if the glass backend is enabled.",
134 #ifdef XAPIAN_HAS_GLASS_BACKEND
135 "#define XAPIAN_HAS_GLASS_BACKEND 1",
136 #else
137 "/* #undef XAPIAN_HAS_GLASS_BACKEND */",
138 #endif
139 "",
140 "/// XAPIAN_HAS_HONEY_BACKEND Defined if the honey backend is enabled.",
141 #ifdef XAPIAN_HAS_HONEY_BACKEND
142 "#define XAPIAN_HAS_HONEY_BACKEND 1",
143 #else
144 "/* #undef XAPIAN_HAS_HONEY_BACKEND */",
145 #endif
146 "",
147 "/// XAPIAN_HAS_INMEMORY_BACKEND Defined if the inmemory backend is enabled.",
148 #ifdef XAPIAN_HAS_INMEMORY_BACKEND
149 "#define XAPIAN_HAS_INMEMORY_BACKEND 1",
150 #else
151 "/* #undef XAPIAN_HAS_INMEMORY_BACKEND */",
152 #endif
153 "",
154 "/// XAPIAN_HAS_REMOTE_BACKEND Defined if the remote backend is enabled.",
155 #ifdef XAPIAN_HAS_REMOTE_BACKEND
156 "#define XAPIAN_HAS_REMOTE_BACKEND 1",
157 #else
158 "/* #undef XAPIAN_HAS_REMOTE_BACKEND */",
159 #endif
160 "",
161 "/// XAPIAN_AT_LEAST(A,B,C) checks for xapian-core >= A.B.C - use like so:",
162 "///",
163 "/// @code",
164 "/// #if XAPIAN_AT_LEAST(1,4,2)",
165 "/// /* Code needing features needing Xapian >= 1.4.2. */",
166 "/// #endif",
167 "/// @endcode",
168 "///",
169 "/// XAPIAN_AT_LEAST was added in Xapian 1.4.2. This was released 2016-12-26",
170 "/// so is now a reasonable hard requirement.",
171 "///",
172 "/// If you really want to support older versions beware that a check like:",
173 "///",
174 "/// #if defined XAPIAN_AT_LEAST && XAPIAN_AT_LEAST(1,4,12)",
175 "///",
176 "/// works with newer Xapian but fails to compile if the macro is not",
177 "/// defined:",
178 "///",
179 "/// error: missing binary operator before token ‘(’",
180 "///",
181 "/// In this situation we recommend copying the definition of XAPIAN_AT_LEAST",
182 "/// into your code and wrapping it in `#ifndef XAPIAN_AT_LEAST` ... `#endif`",
183 "/// so you can use it unconditionally.",
184 "///",
185 "/// @since Xapian 1.4.2.",
186 "#define XAPIAN_AT_LEAST(A,B,C) \\",
187 " (XAPIAN_MAJOR_VERSION > (A) || \\",
188 " (XAPIAN_MAJOR_VERSION == (A) && \\",
189 " (XAPIAN_MINOR_VERSION > (B) || \\",
190 " (XAPIAN_MINOR_VERSION == (B) && XAPIAN_REVISION >= (C)))))",
191 "",
192 "#endif /* XAPIAN_INCLUDED_VERSION_H */"
193 };
uint4 REVISION(const uint8_t *b)
Definition: glass_table.h:109
#define XAPIAN_DOCID_BASE_TYPE
Base (signed) type for Xapian::docid and related types.
Definition: version.h:61
#define XAPIAN_TERMCOUNT_BASE_TYPE
Base (signed) type for Xapian::termcount and related types.
Definition: version.h:64
#define XAPIAN_REVISION_TYPE
Underlying type for Xapian::rev.
Definition: version.h:73
#define XAPIAN_TERMPOS_BASE_TYPE
Base (signed) type for Xapian::termpos.
Definition: version.h:67
const char * dummy[]
Definition: version_h.cc:7