libcwdversion 2.0.0
The C++ Debugging Support Library
Loading...
Searching...
No Matches
config.h
Go to the documentation of this file.
1#pragma once
2
6
7#ifndef LIBCWD_CONFIG_H
8#define LIBCWD_CONFIG_H
9
10//
11// clang-format off
12//
13// DO NOT CHANGE THIS FILE
14//
15// The defines in this file are configuration options chosen during
16// compilation of libcwd. To change these options, rerun CMake with
17// the appropriate -D options. In order to be sure that a program is linking
18// with a library that was compiled with the same header file, call
19//
20// Debug(main_reached());
21//
22// at the top of main() in your program.
23//
24
51
52#define CWDEBUG_GLIBCXX_DEBUG 0
53
77
78#define CWDEBUG_LOCATION 1
79
97
98#define CWDEBUG_DEBUG 1
99
119
120#define CWDEBUG_DEBUGOUTPUT (CWDEBUG_DEBUG && 0)
121
122//
123// Configuration defines that are needed by public headers.
124//
125
126#define LIBCWD_DO_MAX 8 // Maximal total number of debug objects in a single application.
127#define LIBCWD_DC_MAX \
128 256 // Maximal total number of debug channels in a single application.
129 // Costs 4 kb of memory per channel (exclusive the actual channels).
130
149
150#define CWDEBUG_DEBUGT 1
151
152//
153// Configuration signature
154//
155
156#ifdef __cplusplus
157namespace libcwd {
158
159#if CWDEBUG_LOCATION
168inline constexpr int builtin_return_address_offset = -1;
169#endif
170
171inline constexpr unsigned long config_signature_header_c = (
172#if CWDEBUG_LOCATION
173 4 |
174#endif
175#if CWDEBUG_DEBUG
176 16 |
177#endif
178#if CWDEBUG_DEBUGT
179 64 |
180#endif
181#if CWDEBUG_DEBUGOUTPUT
182 256 |
183#endif
184 (512 * (2 + 128 * (0 + 128 * 0))));
185
186extern unsigned long get_config_signature_lib_c() __attribute__((const));
187extern void conf_check_failed();
188extern void version_check_failed();
189extern void internal_main_reached();
190
191inline constexpr bool has_location_support() { return config_signature_header_c & 4; }
192inline void get_version(int& major, int& minor, int& revision)
193{
194 major = (config_signature_header_c / 512) % 128;
195 minor = (config_signature_header_c / (512 * 128)) % 128;
196 revision = config_signature_header_c / (512 * 128 * 128);
197}
198
212inline void main_reached()
213{
214 if (get_config_signature_lib_c() != config_signature_header_c)
215 {
216 if (get_config_signature_lib_c() / 512 != config_signature_header_c / 512)
217 version_check_failed();
218 else
219 conf_check_failed();
220 }
221 internal_main_reached();
222}
223
224} // namespace libcwd
225#endif // __cplusplus
226
227#endif // LIBCWD_CONFIG_H
namespace for libcwd.