xapian-core  1.4.25
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, write to the Free Software",
25 "// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA",
26 "",
27 "#ifndef XAPIAN_INCLUDED_VERSION_H",
28 "#define XAPIAN_INCLUDED_VERSION_H",
29 "",
30 // Disabled for now, since str.h is used by omega, and includes visibility.h
31 // which includes version.h. (FIXME)
32 //"#if !defined XAPIAN_INCLUDED_XAPIAN_H && !defined XAPIAN_LIB_BUILD",
33 //"# error @@Never use <xapian/version.h> directly; include <xapian.h> instead.@@",
34 //"#endif",
35 //"",
36 #ifdef __GNUC__
37 // We used to check __GXX_ABI_VERSION here which was helpful in the GCC 3 days,
38 // but ABI versions 2 and up are compatible aside from obscure corner cases,
39 // and GCC now defaults to using the latest ABI version it supports. The
40 // result is that this check was no longer useful enough to justify the noise.
41 //
42 // We still check that the setting of _GLIBCXX_DEBUG matches since that
43 // introduces ABI-like incompatibilities.
44 //
45 // After preprocessing with "g++ -E" or similar (which will expand macros,
46 // strip comments such as this block, etc) we remove lines starting with a
47 // '#', remove blank lines, and collapse multiple spaces. And we strip out
48 // double quotes, then replace '@@' with '"', and drop ',' at the end of a
49 // line (the purpose of the ',' is to prevent certain preprocessors from
50 // concatenating literal strings).
51 //
52 // So for lines we want in the output, we quote parts of the line which we
53 // don't want substituting, and use @@ where we really want " in the output.
54 "#ifdef __GNUC__",
55 "#if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ == 0)",
56 "#error Xapian no longer supports GCC < 3.1",
57 "#else",
58 // _GLIBCXX_DEBUG is supported by GCC 3.4 and later so we only need to check
59 // it for those versions.
60 #if (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || __GNUC__ >= 4
61 #ifdef _GLIBCXX_DEBUG
62 "#ifndef _GLIBCXX_DEBUG",
63 "#error This library was compiled with _GLIBCXX_DEBUG defined, but you",
64 "#error have not specified this flag. The settings must match or your",
65 "#error program will not work correctly.",
66 "#endif",
67 #else
68 "#ifdef _GLIBCXX_DEBUG",
69 "#error You are compiling with _GLIBCXX_DEBUG defined, but the library",
70 "#error was not compiled with this flag. The settings must match or your",
71 "#error program will not work correctly.",
72 "#endif",
73 #endif
74 #endif
75 "#endif",
76 "#endif",
77 "",
78 #elif defined _MSC_VER
79 // When building the library with MSVC, generate preprocessor code to check
80 // that the same setting of _DEBUG is used for building applications as was
81 // used for building the library.
82 "#ifdef _MSC_VER",
83 #ifdef _DEBUG
84 "#ifndef _DEBUG",
85 "#error This library was compiled with _DEBUG defined, but you",
86 "#error have not specified this flag. The settings must match or your",
87 "#error program will not work correctly.",
88 "#endif",
89 #else
90 "#ifdef _DEBUG",
91 "#error You are compiling with _DEBUG defined, but the library",
92 "#error was not compiled with this flag. The settings must match or your",
93 "#error program will not work correctly.",
94 "#endif",
95 #endif
96 "#endif",
97 "",
98 #endif
99 #ifdef XAPIAN_ENABLE_VISIBILITY
100 "/// The library was compiled with GCC's -fvisibility=hidden option.",
101 "#define XAPIAN_ENABLE_VISIBILITY",
102 "",
103 #endif
104 "/// The version of Xapian as a C string literal.",
105 "#define XAPIAN_VERSION ", STRING_VERSION,
106 "",
107 "/** The major component of the Xapian version.",
108 " * E.g. for Xapian 1.0.14 this would be: 1",
109 " */",
110 "#define XAPIAN_MAJOR_VERSION ", MAJOR_VERSION,
111 "",
112 "/** The minor component of the Xapian version.",
113 " * E.g. for Xapian 1.0.14 this would be: 0",
114 " */",
115 "#define XAPIAN_MINOR_VERSION ", MINOR_VERSION,
116 "",
117 "/** The revision component of the Xapian version.",
118 " * E.g. for Xapian 1.0.14 this would be: 14",
119 " */",
120 "#define XAPIAN_REVISION ", REVISION,
121 "",
122 "/// Base (signed) type for Xapian::docid and related types.",
123 "#define XAPIAN_DOCID_BASE_TYPE ", XAPIAN_DOCID_BASE_TYPE,
124 "",
125 "/// Base (signed) type for Xapian::termcount and related types.",
126 "#define XAPIAN_TERMCOUNT_BASE_TYPE ", XAPIAN_TERMCOUNT_BASE_TYPE,
127 "",
128 "/// Base (signed) type for Xapian::termpos.",
129 "#define XAPIAN_TERMPOS_BASE_TYPE ", XAPIAN_TERMPOS_BASE_TYPE,
130 "",
131 "/// Type for returning total document length.",
132 "#define XAPIAN_TOTALLENGTH_TYPE ", XAPIAN_REVISION_TYPE,
133 "",
134 "/// Underlying type for Xapian::rev.",
135 "#define XAPIAN_REVISION_TYPE ", XAPIAN_REVISION_TYPE,
136 "",
137 "/// XAPIAN_HAS_CHERT_BACKEND Defined if the chert backend is enabled.",
138 #ifdef XAPIAN_HAS_CHERT_BACKEND
139 "#define XAPIAN_HAS_CHERT_BACKEND 1",
140 #else
141 "/* #undef XAPIAN_HAS_CHERT_BACKEND */",
142 #endif
143 "",
144 "/// XAPIAN_HAS_GLASS_BACKEND Defined if the glass backend is enabled.",
145 #ifdef XAPIAN_HAS_GLASS_BACKEND
146 "#define XAPIAN_HAS_GLASS_BACKEND 1",
147 #else
148 "/* #undef XAPIAN_HAS_GLASS_BACKEND */",
149 #endif
150 "",
151 "/// XAPIAN_HAS_INMEMORY_BACKEND Defined if the inmemory backend is enabled.",
152 #ifdef XAPIAN_HAS_INMEMORY_BACKEND
153 "#define XAPIAN_HAS_INMEMORY_BACKEND 1",
154 #else
155 "/* #undef XAPIAN_HAS_INMEMORY_BACKEND */",
156 #endif
157 "",
158 "/// XAPIAN_HAS_REMOTE_BACKEND Defined if the remote backend is enabled.",
159 #ifdef XAPIAN_HAS_REMOTE_BACKEND
160 "#define XAPIAN_HAS_REMOTE_BACKEND 1",
161 #else
162 "/* #undef XAPIAN_HAS_REMOTE_BACKEND */",
163 #endif
164 "",
165 "/// XAPIAN_AT_LEAST(A,B,C) checks for xapian-core >= A.B.C - use like so:",
166 "///",
167 "/// @code",
168 "/// #if XAPIAN_AT_LEAST(1,4,2)",
169 "/// /* Code needing features needing Xapian >= 1.4.2. */",
170 "/// #endif",
171 "/// @endcode",
172 "///",
173 "/// Added in Xapian 1.4.2.",
174 "#define XAPIAN_AT_LEAST(A,B,C) \\",
175 " (XAPIAN_MAJOR_VERSION > (A) || \\",
176 " (XAPIAN_MAJOR_VERSION == (A) && \\",
177 " (XAPIAN_MINOR_VERSION > (B) || \\",
178 " (XAPIAN_MINOR_VERSION == (B) && XAPIAN_REVISION >= (C)))))",
179 "",
180 "/// We support move semantics when we're confident the compiler supports it.",
181 "///",
182 "/// C++11 move semantics are very useful in threaded code that wants to",
183 "/// hand-off Xapian objects to worker threads, but in this case it's very",
184 "/// unhelpful for availability of these semantics to vary by compiler as it",
185 "/// quietly leads to a build with non-threadsafe behaviour.",
186 "///",
187 "/// User code can #define XAPIAN_MOVE_SEMANTICS to force this on, and will",
188 "/// then get a compilation failure if the compiler lacks suitable support.",
189 "#ifndef XAPIAN_MOVE_SEMANTICS",
190 "# if __cplusplus >= 201103L || \\",
191 " (defined _MSC_VER && _MSC_VER >= 1900) || \\",
192 " defined XAPIAN_LIB_BUILD",
193 "# define XAPIAN_MOVE_SEMANTICS",
194 "# endif",
195 "#endif",
196 "",
197 "#endif /* XAPIAN_INCLUDED_VERSION_H */"
198 };
#define XAPIAN_TERMPOS_BASE_TYPE
Base (signed) type for Xapian::termpos.
Definition: version.h:63
const char * dummy[]
Definition: version_h.cc:7
#define XAPIAN_REVISION_TYPE
Underlying type for Xapian::rev.
Definition: version.h:69
#define XAPIAN_DOCID_BASE_TYPE
Base (signed) type for Xapian::docid and related types.
Definition: version.h:57
unsigned REVISION(const uint8_t *b)
Definition: chert_table.h:150
#define XAPIAN_TERMCOUNT_BASE_TYPE
Base (signed) type for Xapian::termcount and related types.
Definition: version.h:60