-
Notifications
You must be signed in to change notification settings - Fork 25
/
config.hpp.in
113 lines (88 loc) · 4.04 KB
/
config.hpp.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/* Copyright 2009-2017 Francesco Biscani ([email protected])
This file is part of the Piranha library.
The Piranha library is free software; you can redistribute it and/or modify
it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free Software
Foundation; either version 3 of the License, or (at your option) any
later version.
or both in parallel, as here.
The Piranha library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received copies of the GNU General Public License and the
GNU Lesser General Public License along with the Piranha library. If not,
see https://www.gnu.org/licenses/. */
#ifndef PIRANHA_CONFIG_HPP
#define PIRANHA_CONFIG_HPP
#include <cassert>
// Start of defines instantiated by CMake.
// clang-format off
@PIRANHA_PTHREAD_AFFINITY@
@PIRANHA_POSIX_MEMALIGN@
#define PIRANHA_VERSION_STRING "@piranha_VERSION@"
#define PIRANHA_VERSION_MAJOR @piranha_VERSION_MAJOR@
#define PIRANHA_VERSION_MINOR @piranha_VERSION_MINOR@
#define PIRANHA_GIT_REVISION "@PIRANHA_GIT_REVISION@"
@PIRANHA_SYSTEM_LOGICAL_PROCESSOR_INFORMATION@
@PIRANHA_ENABLE_BOOST_S11N@
@PIRANHA_ENABLE_BOOST_STACKTRACE@
@PIRANHA_ENABLE_MSGPACK@
@PIRANHA_ENABLE_ZLIB@
@PIRANHA_ENABLE_BZIP2@
// clang-format on
// End of defines instantiated by CMake.
// Import a bunch of macros/definitions from mp++.
#include <mp++/config.hpp>
#define likely(x) mppp_likely(x)
#define unlikely(x) mppp_unlikely(x)
#define PIRANHA_MAYBE_TLS MPPP_MAYBE_TLS
#if defined(MPPP_HAVE_THREAD_LOCAL)
#define PIRANHA_HAVE_THREAD_LOCAL
#endif
#if defined(MPPP_HAVE_CONCEPTS)
#define PIRANHA_HAVE_CONCEPTS
#endif
#define PIRANHA_CPLUSPLUS MPPP_CPLUSPLUS
// NOTE: clang has to go first, as it might define __GNUC__ internally.
// Same thing could happen with ICC.
#if defined(__clang__)
#include <piranha/detail/config_clang.hpp>
#elif defined(__INTEL_COMPILER)
#include <piranha/detail/config_intel.hpp>
#elif defined(__GNUC__)
#include <piranha/detail/config_gcc.hpp>
#else
// NOTE: additional compiler configurations go here or in separate files as above.
#define PIRANHA_PRETTY_FUNCTION __func__
#endif
// Assertion macro. If we have stacktrace support and we are in debug mode,
// then we will print the current stacktrace on assertion failure and then abort().
// Otherwise, just call the standard assert() macro.
#if defined(PIRANHA_WITH_BOOST_STACKTRACE) && !defined(NDEBUG)
#include <cstdlib>
#include <iostream>
#include <ostream>
#include <piranha/detail/stacktrace.hpp>
// NOTE: here we want to:
// - make sure the x argument is evaluated only once,
// - make sure we print the file/line/function as specified in the standard:
// http://en.cppreference.com/w/cpp/error/assert
// Note that we may end up using something else than __func__, and we don't have the
// constant subexpression guarantee (may implement it down the line).
#define piranha_assert(x) \
if (!static_cast<bool>(x)) { \
piranha::stream_stacktrace(std::cerr, piranha::stacktrace{}); \
std::cerr << '\n' \
<< __FILE__ << ':' << __LINE__ << ": " << PIRANHA_PRETTY_FUNCTION << ": Assertion `" << #x \
<< "' failed." << std::endl; \
std::abort(); \
}
#else
#define piranha_assert(x) assert(x)
#endif
#endif