SeqAn3  3.2.0
The Modern C++ library for sequence analysis.
platform.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2022, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2022, Knut Reinert & MPI für molekulare Genetik
4 // This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
5 // shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md
6 // -----------------------------------------------------------------------------------------------------
7 
13 #pragma once
14 
15 #include <cinttypes>
16 #include <ciso646> // makes _LIBCPP_VERSION available
17 #include <cstddef> // makes __GLIBCXX__ available
18 
19 // macro cruft
21 #define SEQAN3_STR_HELPER(x) #x
22 #define SEQAN3_STR(x) SEQAN3_STR_HELPER(x)
24 
25 // ============================================================================
26 // Documentation
27 // ============================================================================
28 
29 // Doxygen related
30 // this macro is a NO-OP unless doxygen parses it, in which case it resolves to the argument
31 #ifndef SEQAN3_DOXYGEN_ONLY
32 # define SEQAN3_DOXYGEN_ONLY(x)
33 #endif
34 
35 // ============================================================================
36 // Compiler support
37 // ============================================================================
38 
39 #if defined(__GNUC__) && (__GNUC__ < 10)
40 # error "SeqAn 3.1.x is the last version that supports GCC 7, 8, and 9. Please upgrade your compiler or use 3.1.x."
41 #endif // defined(__GNUC__) && (__GNUC__ < 10)
42 
43 #if SEQAN3_DOXYGEN_ONLY(1) 0
45 # define SEQAN3_DISABLE_NEWER_COMPILER_DIAGNOSTIC
46 #endif // SEQAN3_DOXYGEN_ONLY(1)0
47 
48 #ifndef SEQAN3_DISABLE_NEWER_COMPILER_DIAGNOSTIC
49 # if defined(__GNUC__) && (__GNUC__ > 12)
50 # pragma message \
51  "Your compiler is newer than the latest supported compiler of this SeqAn version (gcc-12). It might be that SeqAn does not compile due to this. You can disable this warning by setting -DSEQAN3_DISABLE_NEWER_COMPILER_DIAGNOSTIC."
52 # endif // defined(__GNUC__) && (__GNUC__ > 12)
53 #endif // SEQAN3_DISABLE_NEWER_COMPILER_DIAGNOSTIC
54 
55 // ============================================================================
56 // C++ standard and features
57 // ============================================================================
58 
59 // C++ standard [required]
60 // Note: gcc10 -std=c++20 still defines __cplusplus=201709
61 #ifdef __cplusplus
62 # if (__cplusplus < 201709)
63 # error "SeqAn3 requires C++20, make sure that you have set -std=c++20."
64 # endif
65 #else
66 # error "This is not a C++ compiler."
67 #endif
68 
69 #if __has_include(<version>)
70 # include <version>
71 #endif
72 
73 // ============================================================================
74 // Dependencies
75 // ============================================================================
76 
77 // SeqAn [required]
78 #if __has_include(<seqan3/version.hpp>)
79 # include <seqan3/version.hpp>
80 #else
81 # error SeqAn3 include directory not set correctly. Forgot to add -I ${INSTALLDIR}/include to your CXXFLAGS?
82 #endif
83 
84 // SDSL [required]
85 #if __has_include(<sdsl/version.hpp>)
86 # include <sdsl/version.hpp>
87 static_assert(sdsl::sdsl_version_major == 3, "Only version 3 of the SDSL is supported by SeqAn3.");
88 #else
89 # error The sdsl library was not included correctly. Forgot to add -I ${INSTALLDIR}/include to your CXXFLAGS?
90 #endif
91 
92 // Cereal [optional]
97 #ifndef SEQAN3_WITH_CEREAL
98 # if __has_include(<cereal/cereal.hpp>)
99 # define SEQAN3_WITH_CEREAL 1
100 # else
101 # define SEQAN3_WITH_CEREAL 0
102 # endif
103 #elif SEQAN3_WITH_CEREAL != 0
104 # if !__has_include(<cereal/cereal.hpp>)
105 # error Cereal was marked as required, but not found!
106 # endif
107 #endif
108 
110 #if !SEQAN3_WITH_CEREAL
116 # define CEREAL_SERIALIZE_FUNCTION_NAME serialize
117 # define CEREAL_LOAD_FUNCTION_NAME load
118 # define CEREAL_SAVE_FUNCTION_NAME save
119 # define CEREAL_LOAD_MINIMAL_FUNCTION_NAME load_minimal
120 # define CEREAL_SAVE_MINIMAL_FUNCTION_NAME save_minimal
122 #endif
124 
125 // Lemon [optional]
130 #ifndef SEQAN3_WITH_LEMON
131 # if __has_include(<lemon/config.h>)
132 # define SEQAN3_WITH_LEMON 1
133 # else
134 # define SEQAN3_WITH_LEMON 0
135 # endif
136 #elif SEQAN3_WITH_LEMON != 0
137 # if !__has_include(<lemon/config.h>)
138 # error Lemon was marked as required, but not found!
139 # endif
140 #endif
141 #if SEQAN3_WITH_LEMON == 1
142 # define LEMON_HAVE_LONG_LONG 1
143 # define LEMON_CXX11 1
144 # if defined(__unix__) || defined(__APPLE__)
145 # define LEMON_USE_PTHREAD 1
146 # define LEMON_USE_WIN32_THREADS 0
147 # define LEMON_WIN32 0
148 # else
149 # define LEMON_USE_PTHREAD 0
150 # define LEMON_USE_WIN32_THREADS 1
151 # define LEMON_WIN32 1
152 # endif
153 #endif
154 
155 // TODO (doesn't have a version.hpp, yet)
156 
157 // ============================================================================
158 // Deprecation Messages
159 // ============================================================================
160 
162 #ifndef SEQAN3_PRAGMA
163 # define SEQAN3_PRAGMA(non_string_literal) _Pragma(# non_string_literal)
164 #endif
165 
167 #ifndef SEQAN3_DEPRECATED_HEADER
168 # ifndef SEQAN3_DISABLE_DEPRECATED_WARNINGS
169 # define SEQAN3_DEPRECATED_HEADER(message) SEQAN3_PRAGMA(GCC warning message)
170 # else
171 # define SEQAN3_DEPRECATED_HEADER(message)
172 # endif
173 #endif
174 
176 #ifndef SEQAN3_REMOVE_DEPRECATED_330
177 # ifndef SEQAN3_DEPRECATED_330
178 # ifndef SEQAN3_DISABLE_DEPRECATED_WARNINGS
179 # define SEQAN3_DEPRECATED_330 \
180  [[deprecated("This will be removed in SeqAn-3.3.0; please see the documentation.")]]
181 # else
182 # define SEQAN3_DEPRECATED_330
183 # endif
184 # endif
185 #endif
186 
187 // ============================================================================
188 // Workarounds
189 // ============================================================================
190 
199 #if defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ <= 2)
200 # pragma GCC warning \
201  "Be aware that gcc 10.0, 10.1 and 10.2 are known to have several bugs that might make SeqAn3 fail to compile. Please use gcc >= 10.3."
202 #endif // defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ <= 1)
203 
204 #ifndef SEQAN3_WORKAROUND_VIEW_PERFORMANCE
206 # define SEQAN3_WORKAROUND_VIEW_PERFORMANCE 1
207 #endif
208 
210 #ifndef SEQAN3_WORKAROUND_GCC_96070 // fixed since gcc10.4
211 # if defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ < 4)
212 # define SEQAN3_WORKAROUND_GCC_96070 1
213 # else
214 # define SEQAN3_WORKAROUND_GCC_96070 0
215 # endif
216 #endif
217 
220 #ifndef SEQAN3_WORKAROUND_GCC_PIPEABLE_CONFIG_CONCEPT
221 # if defined(__GNUC__) && (__GNUC__ < 11)
222 # define SEQAN3_WORKAROUND_GCC_PIPEABLE_CONFIG_CONCEPT 1
223 # else
224 # define SEQAN3_WORKAROUND_GCC_PIPEABLE_CONFIG_CONCEPT 0
225 # endif
226 #endif
227 
229 #ifndef SEQAN3_WORKAROUND_DEFAULT_CONSTRUCTIBLE_VIEW
230 # if defined(__GNUC__) && (__GNUC__ < 12)
231 # define SEQAN3_WORKAROUND_DEFAULT_CONSTRUCTIBLE_VIEW 1
232 # else
233 # define SEQAN3_WORKAROUND_DEFAULT_CONSTRUCTIBLE_VIEW 0
234 # endif
235 #endif
236 
239 #ifndef SEQAN3_WORKAROUND_GCC_100139
240 # if defined(__GNUC__) && (__GNUC__ < 12)
241 # define SEQAN3_WORKAROUND_GCC_100139 1
242 # else
243 # define SEQAN3_WORKAROUND_GCC_100139 0
244 # endif
245 #endif
246 
250 #ifndef SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY
251 # if defined(__GNUC__) && (__GNUC__ == 12 && __GNUC_MINOR__ < 3)
252 # define SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY 1
253 # else
254 # define SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY 0
255 # endif
256 #endif
257 
268 #ifndef SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI
269 # if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
270 # define SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI 1
271 # else
272 # define SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI 0
273 # endif
274 #endif
275 
276 #if SEQAN3_DOXYGEN_ONLY(1) 0
278 # define SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
279 #endif // SEQAN3_DOXYGEN_ONLY(1)0
280 
281 #if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
282 # ifndef SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
283 # pragma message \
284  "We do not actively support compiler that have -D_GLIBCXX_USE_CXX11_ABI=0 set, and it might be that SeqAn does not compile due to this. It is known that all compiler of CentOS 7 / RHEL 7 set this flag by default (and that it cannot be overridden!). Note that these versions of the OSes are community-supported (see https://docs.seqan.de/seqan/3-master-user/about_api.html#platform_stability for more details). You can disable this warning by setting -DSEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC."
285 # endif // SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
286 #endif // _GLIBCXX_USE_CXX11_ABI == 0
287 
288 // ============================================================================
289 // Backmatter
290 // ============================================================================
291 
292 // macro cruft undefine
293 #undef SEQAN3_STR
294 #undef SEQAN3_STR_HELPER
295 
296 // ============================================================================
297 // API - Adds deprecations for seqan3/std/iterator. Will be removed in 3.3.0.
298 // This is the only file that is guaranteed to be included.
299 // Deprecations cannot be in previous header because changing the include to
300 // <iterator> will not include the cpp20 definitions.
301 // ============================================================================
302 
304 namespace std
305 {
306 
307 template <class Container>
308 class back_insert_iterator;
309 
310 template <class Container>
311 constexpr back_insert_iterator<Container> back_inserter(Container & c);
312 
313 template <class CharT>
314 class char_traits;
315 
316 template <class T, class CharT, class Traits>
317 class ostream_iterator;
318 
319 template <class CharT, class Traits>
320 class ostreambuf_iterator;
321 
322 } // namespace std
323 
324 namespace std::cpp20
325 {
326 
327 // Extra include guard is needed for header tests. Prevents redefinition.
328 #ifndef SEQAN3_CPP20_ODR
329 # define SEQAN3_CPP20_ODR 1
330 template <class Container>
332 {
333  return std::back_inserter(c);
334 }
335 #endif
336 
337 template <class T, class CharT = char, class Traits = std::char_traits<CharT>>
339 
340 template <class CharT, class Traits = std::char_traits<CharT>>
342 
343 } // namespace std::cpp20
T back_inserter(T... args)
SeqAn specific customisations in the standard namespace.
#define SEQAN3_DEPRECATED_330
Deprecation message for SeqAn 3.3.0 release.
Definition: platform.hpp:179
Provides SeqAn version macros and global variables.