libsmbios_c library
src
include
smbios
config
suffix.hpp
Go to the documentation of this file.
1
// Boost config.hpp configuration header file ------------------------------//
2
3
// (C) Copyright John Maddock 2001 - 2003.
4
// (C) Copyright Darin Adler 2001.
5
// (C) Copyright Peter Dimov 2001.
6
// (C) Copyright Bill Kempf 2002.
7
// (C) Copyright Jens Maurer 2002.
8
// (C) Copyright David Abrahams 2002 - 2003.
9
// (C) Copyright Gennaro Prota 2003.
10
// (C) Copyright Eric Friedman 2003.
11
// Use, modification and distribution are subject to the
12
// Boost Software License, Version 1.0. (See accompanying file
13
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
14
15
// See http://www.boost.org for most recent version.
16
17
// Boost config.hpp policy and rationale documentation has been moved to
18
// http://www.boost.org/libs/config
19
//
20
// This file is intended to be stable, and relatively unchanging.
21
// It should contain boilerplate code only - no compiler specific
22
// code unless it is unavoidable - no changes unless unavoidable.
23
24
#ifndef LIBSMBIOS_CONFIG_SUFFIX_HPP
25
#define LIBSMBIOS_CONFIG_SUFFIX_HPP
26
27
//
28
// look for long long by looking for the appropriate macros in <limits.h>.
29
// Note that we use limits.h rather than climits for maximal portability,
30
// remember that since these just declare a bunch of macros, there should be
31
// no namespace issues from this.
32
//
33
#include <limits.h>
34
# if !defined(LIBSMBIOS_HAS_LONG_LONG) \
35
&& !(defined(LIBSMBIOS_MSVC) && LIBSMBIOS_MSVC <=1300) && !defined(__BORLANDC__) \
36
&& (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX))
37
# define LIBSMBIOS_HAS_LONG_LONG
38
#endif
39
#if !defined(LIBSMBIOS_HAS_LONG_LONG) && !defined(LIBSMBIOS_NO_INTEGRAL_INT64_T)
40
# define LIBSMBIOS_NO_INTEGRAL_INT64_T
41
#endif
42
43
// GCC 3.x will clean up all of those nasty macro definitions that
44
// LIBSMBIOS_NO_CTYPE_FUNCTIONS is intended to help work around, so undefine
45
// it under GCC 3.x.
46
#if defined(__GNUC__) && (__GNUC__ >= 3) && defined(LIBSMBIOS_NO_CTYPE_FUNCTIONS)
47
# undef LIBSMBIOS_NO_CTYPE_FUNCTIONS
48
#endif
49
50
51
//
52
// Assume any extensions are in namespace std:: unless stated otherwise:
53
//
54
# ifndef LIBSMBIOS_STD_EXTENSION_NAMESPACE
55
# define LIBSMBIOS_STD_EXTENSION_NAMESPACE std
56
# endif
57
58
//
59
// If cv-qualified specializations are not allowed, then neither are cv-void ones:
60
//
61
# if defined(LIBSMBIOS_NO_CV_SPECIALIZATIONS) \
62
&& !defined(LIBSMBIOS_NO_CV_VOID_SPECIALIZATIONS)
63
# define LIBSMBIOS_NO_CV_VOID_SPECIALIZATIONS
64
# endif
65
66
//
67
// If there is no numeric_limits template, then it can't have any compile time
68
// constants either!
69
//
70
# if defined(LIBSMBIOS_NO_LIMITS) \
71
&& !defined(LIBSMBIOS_NO_LIMITS_COMPILE_TIME_CONSTANTS)
72
# define LIBSMBIOS_NO_LIMITS_COMPILE_TIME_CONSTANTS
73
# define LIBSMBIOS_NO_MS_INT64_NUMERIC_LIMITS
74
# define LIBSMBIOS_NO_LONG_LONG_NUMERIC_LIMITS
75
# endif
76
77
//
78
// if there is no long long then there is no specialisation
79
// for numeric_limits<long long> either:
80
//
81
#if !defined(LIBSMBIOS_HAS_LONG_LONG) && !defined(LIBSMBIOS_NO_LONG_LONG_NUMERIC_LIMITS)
82
# define LIBSMBIOS_NO_LONG_LONG_NUMERIC_LIMITS
83
#endif
84
85
//
86
// if there is no __int64 then there is no specialisation
87
// for numeric_limits<__int64> either:
88
//
89
#if !defined(LIBSMBIOS_HAS_MS_INT64) && !defined(LIBSMBIOS_NO_MS_INT64_NUMERIC_LIMITS)
90
# define LIBSMBIOS_NO_MS_INT64_NUMERIC_LIMITS
91
#endif
92
93
//
94
// if member templates are supported then so is the
95
// VC6 subset of member templates:
96
//
97
# if !defined(LIBSMBIOS_NO_MEMBER_TEMPLATES) \
98
&& !defined(LIBSMBIOS_MSVC6_MEMBER_TEMPLATES)
99
# define LIBSMBIOS_MSVC6_MEMBER_TEMPLATES
100
# endif
101
102
//
103
// Without partial specialization, can't test for partial specialisation bugs:
104
//
105
# if defined(LIBSMBIOS_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
106
&& !defined(LIBSMBIOS_BCB_PARTIAL_SPECIALIZATION_BUG)
107
# define LIBSMBIOS_BCB_PARTIAL_SPECIALIZATION_BUG
108
# endif
109
110
//
111
// Without partial specialization, we can't have array-type partial specialisations:
112
//
113
# if defined(LIBSMBIOS_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
114
&& !defined(LIBSMBIOS_NO_ARRAY_TYPE_SPECIALIZATIONS)
115
# define LIBSMBIOS_NO_ARRAY_TYPE_SPECIALIZATIONS
116
# endif
117
118
//
119
// Without partial specialization, std::iterator_traits can't work:
120
//
121
# if defined(LIBSMBIOS_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
122
&& !defined(LIBSMBIOS_NO_STD_ITERATOR_TRAITS)
123
# define LIBSMBIOS_NO_STD_ITERATOR_TRAITS
124
# endif
125
126
//
127
// Without member template support, we can't have template constructors
128
// in the standard library either:
129
//
130
# if defined(LIBSMBIOS_NO_MEMBER_TEMPLATES) \
131
&& !defined(LIBSMBIOS_MSVC6_MEMBER_TEMPLATES) \
132
&& !defined(LIBSMBIOS_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
133
# define LIBSMBIOS_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
134
# endif
135
136
//
137
// Without member template support, we can't have a conforming
138
// std::allocator template either:
139
//
140
# if defined(LIBSMBIOS_NO_MEMBER_TEMPLATES) \
141
&& !defined(LIBSMBIOS_MSVC6_MEMBER_TEMPLATES) \
142
&& !defined(LIBSMBIOS_NO_STD_ALLOCATOR)
143
# define LIBSMBIOS_NO_STD_ALLOCATOR
144
# endif
145
146
//
147
// without ADL support then using declarations will break ADL as well:
148
//
149
#if defined(LIBSMBIOS_NO_ARGUMENT_DEPENDENT_LOOKUP) && !defined(LIBSMBIOS_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL)
150
# define LIBSMBIOS_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
151
#endif
152
153
//
154
// If we have a standard allocator, then we have a partial one as well:
155
//
156
#if !defined(LIBSMBIOS_NO_STD_ALLOCATOR)
157
# define LIBSMBIOS_HAS_PARTIAL_STD_ALLOCATOR
158
#endif
159
160
//
161
// We can't have a working std::use_facet if there is no std::locale:
162
//
163
# if defined(LIBSMBIOS_NO_STD_LOCALE) && !defined(LIBSMBIOS_NO_STD_USE_FACET)
164
# define LIBSMBIOS_NO_STD_USE_FACET
165
# endif
166
167
//
168
// We can't have a std::messages facet if there is no std::locale:
169
//
170
# if defined(LIBSMBIOS_NO_STD_LOCALE) && !defined(LIBSMBIOS_NO_STD_MESSAGES)
171
# define LIBSMBIOS_NO_STD_MESSAGES
172
# endif
173
174
//
175
// We can't have a working std::wstreambuf if there is no std::locale:
176
//
177
# if defined(LIBSMBIOS_NO_STD_LOCALE) && !defined(LIBSMBIOS_NO_STD_WSTREAMBUF)
178
# define LIBSMBIOS_NO_STD_WSTREAMBUF
179
# endif
180
181
//
182
// We can't have a <cwctype> if there is no <cwchar>:
183
//
184
# if defined(LIBSMBIOS_NO_CWCHAR) && !defined(LIBSMBIOS_NO_CWCTYPE)
185
# define LIBSMBIOS_NO_CWCTYPE
186
# endif
187
188
//
189
// We can't have a swprintf if there is no <cwchar>:
190
//
191
# if defined(LIBSMBIOS_NO_CWCHAR) && !defined(LIBSMBIOS_NO_SWPRINTF)
192
# define LIBSMBIOS_NO_SWPRINTF
193
# endif
194
195
//
196
// If Win32 support is turned off, then we must turn off
197
// threading support also, unless there is some other
198
// thread API enabled:
199
//
200
#if defined(LIBSMBIOS_DISABLE_WIN32) && defined(_WIN32) \
201
&& !defined(LIBSMBIOS_DISABLE_THREADS) && !defined(LIBSMBIOS_HAS_PTHREADS)
202
# define LIBSMBIOS_DISABLE_THREADS
203
#endif
204
205
//
206
// Turn on threading support if the compiler thinks that it's in
207
// multithreaded mode. We put this here because there are only a
208
// limited number of macros that identify this (if there's any missing
209
// from here then add to the appropriate compiler section):
210
//
211
#if (defined(__MT__) || defined(_MT) || defined(_REENTRANT) \
212
|| defined(_PTHREADS)) && !defined(LIBSMBIOS_HAS_THREADS)
213
# define LIBSMBIOS_HAS_THREADS
214
#endif
215
216
//
217
// Turn threading support off if LIBSMBIOS_DISABLE_THREADS is defined:
218
//
219
#if defined(LIBSMBIOS_DISABLE_THREADS) && defined(LIBSMBIOS_HAS_THREADS)
220
# undef LIBSMBIOS_HAS_THREADS
221
#endif
222
223
//
224
// Turn threading support off if we don't recognise the threading API:
225
//
226
#if defined(LIBSMBIOS_HAS_THREADS) && !defined(LIBSMBIOS_HAS_PTHREADS)\
227
&& !defined(LIBSMBIOS_HAS_WINTHREADS) && !defined(LIBSMBIOS_HAS_BETHREADS)\
228
&& !defined(LIBSMBIOS_HAS_MPTASKS)
229
# undef LIBSMBIOS_HAS_THREADS
230
#endif
231
232
//
233
// Turn threading detail macros off if we don't (want to) use threading
234
//
235
#ifndef LIBSMBIOS_HAS_THREADS
236
# undef LIBSMBIOS_HAS_PTHREADS
237
# undef LIBSMBIOS_HAS_PTHREAD_MUTEXATTR_SETTYPE
238
# undef LIBSMBIOS_HAS_WINTHREADS
239
# undef LIBSMBIOS_HAS_BETHREADS
240
# undef LIBSMBIOS_HAS_MPTASKS
241
#endif
242
243
//
244
// If the compiler claims to be C99 conformant, then it had better
245
// have a <stdint.h>:
246
//
247
# if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)
248
# define LIBSMBIOS_HAS_STDINT_H
249
# endif
250
251
//
252
// Define LIBSMBIOS_NO_SLIST and LIBSMBIOS_NO_HASH if required.
253
// Note that this is for backwards compatibility only.
254
//
255
# ifndef LIBSMBIOS_HAS_SLIST
256
# define LIBSMBIOS_NO_SLIST
257
# endif
258
259
# ifndef LIBSMBIOS_HAS_HASH
260
# define LIBSMBIOS_NO_HASH
261
# endif
262
263
// LIBSMBIOS_HAS_ABI_HEADERS
264
// This macro gets set if we have headers that fix the ABI,
265
// and prevent ODR violations when linking to external libraries:
266
#if defined(LIBSMBIOS_ABI_PREFIX) && defined(LIBSMBIOS_ABI_SUFFIX) && !defined(LIBSMBIOS_HAS_ABI_HEADERS)
267
# define LIBSMBIOS_HAS_ABI_HEADERS
268
#endif
269
270
#if defined(LIBSMBIOS_HAS_ABI_HEADERS) && defined(LIBSMBIOS_DISABLE_ABI_HEADERS)
271
# undef LIBSMBIOS_HAS_ABI_HEADERS
272
#endif
273
274
// LIBSMBIOS_NO_STDC_NAMESPACE workaround --------------------------------------//
275
// Because std::size_t usage is so common, even in headers which do not
276
// otherwise use the C library, the <cstddef> workaround is included here so
277
// that ugly workaround code need not appear in many other boost headers.
278
// NOTE WELL: This is a workaround for non-conforming compilers; <cstddef>
279
// must still be #included in the usual places so that <cstddef> inclusion
280
// works as expected with standard conforming compilers. The resulting
281
// double inclusion of <cstddef> is harmless.
282
283
# ifdef LIBSMBIOS_NO_STDC_NAMESPACE
284
# include <cstddef>
285
namespace
std { using ::ptrdiff_t; using ::size_t; }
286
# endif
287
288
// LIBSMBIOS_NO_STD_MIN_MAX workaround -----------------------------------------//
289
290
# ifdef LIBSMBIOS_NO_STD_MIN_MAX
291
292
namespace
std {
293
template
<
class
_Tp>
294
inline
const
_Tp& min(
const
_Tp& __a,
const
_Tp& __b) {
295
return
__b < __a ? __b : __a;
296
}
297
template
<
class
_Tp>
298
inline
const
_Tp& max(
const
_Tp& __a,
const
_Tp& __b) {
299
return
__a < __b ? __b : __a;
300
}
301
}
302
303
# endif
304
305
// LIBSMBIOS_STATIC_CONSTANT workaround --------------------------------------- //
306
// On compilers which don't allow in-class initialization of static integral
307
// constant members, we must use enums as a workaround if we want the constants
308
// to be available at compile-time. This macro gives us a convenient way to
309
// declare such constants.
310
311
# ifdef LIBSMBIOS_NO_INCLASS_MEMBER_INITIALIZATION
312
# define LIBSMBIOS_STATIC_CONSTANT(type, assignment) enum { assignment }
313
# else
314
# define LIBSMBIOS_STATIC_CONSTANT(type, assignment) static const type assignment
315
# endif
316
317
// LIBSMBIOS_USE_FACET workaround ----------------------------------------------//
318
// When the standard library does not have a conforming std::use_facet there
319
// are various workarounds available, but they differ from library to library.
320
// This macro provides a consistent way to access a locale's facets.
321
// Usage:
322
// replace
323
// std::use_facet<Type>(loc);
324
// with
325
// LIBSMBIOS_USE_FACET(Type, loc);
326
// Note do not add a std:: prefix to the front of LIBSMBIOS_USE_FACET!
327
328
#if defined(LIBSMBIOS_NO_STD_USE_FACET)
329
# ifdef LIBSMBIOS_HAS_TWO_ARG_USE_FACET
330
# define LIBSMBIOS_USE_FACET(Type, loc) std::use_facet(loc, static_cast<Type*>(0))
331
# elif defined(LIBSMBIOS_HAS_MACRO_USE_FACET)
332
# define LIBSMBIOS_USE_FACET(Type, loc) std::_USE(loc, Type)
333
# elif defined(LIBSMBIOS_HAS_STLP_USE_FACET)
334
# define LIBSMBIOS_USE_FACET(Type, loc) (*std::_Use_facet<Type >(loc))
335
# endif
336
#else
337
# define LIBSMBIOS_USE_FACET(Type, loc) std::use_facet< Type >(loc)
338
#endif
339
340
// LIBSMBIOS_NESTED_TEMPLATE workaround ------------------------------------------//
341
// Member templates are supported by some compilers even though they can't use
342
// the A::template member<U> syntax, as a workaround replace:
343
//
344
// typedef typename A::template rebind<U> binder;
345
//
346
// with:
347
//
348
// typedef typename A::LIBSMBIOS_NESTED_TEMPLATE rebind<U> binder;
349
350
#ifndef LIBSMBIOS_NO_MEMBER_TEMPLATE_KEYWORD
351
# define LIBSMBIOS_NESTED_TEMPLATE template
352
#else
353
# define LIBSMBIOS_NESTED_TEMPLATE
354
#endif
355
356
// LIBSMBIOS_UNREACHABLE_RETURN(x) workaround -------------------------------------//
357
// Normally evaluates to nothing, unless LIBSMBIOS_NO_UNREACHABLE_RETURN_DETECTION
358
// is defined, in which case it evaluates to return x; Use when you have a return
359
// statement that can never be reached.
360
361
#ifdef LIBSMBIOS_NO_UNREACHABLE_RETURN_DETECTION
362
# define LIBSMBIOS_UNREACHABLE_RETURN(x) return x;
363
#else
364
# define LIBSMBIOS_UNREACHABLE_RETURN(x)
365
#endif
366
367
// LIBSMBIOS_DEDUCED_TYPENAME workaround ------------------------------------------//
368
//
369
// Some compilers don't support the use of `typename' for dependent
370
// types in deduced contexts, e.g.
371
//
372
// template <class T> void f(T, typename T::type);
373
// ^^^^^^^^
374
// Replace these declarations with:
375
//
376
// template <class T> void f(T, LIBSMBIOS_DEDUCED_TYPENAME T::type);
377
378
#ifndef LIBSMBIOS_NO_DEDUCED_TYPENAME
379
# define LIBSMBIOS_DEDUCED_TYPENAME typename
380
#else
381
# define LIBSMBIOS_DEDUCED_TYPENAME
382
#endif
383
384
// LIBSMBIOS_[APPEND_]EXPLICIT_TEMPLATE_[NON_]TYPE macros --------------------------//
385
//
386
// Some compilers have problems with function templates whose
387
// template parameters don't appear in the function parameter
388
// list (basically they just link one instantiation of the
389
// template in the final executable). These macros provide a
390
// uniform way to cope with the problem with no effects on the
391
// calling syntax.
392
393
// Example:
394
//
395
// #include <iostream>
396
// #include <ostream>
397
// #include <typeinfo>
398
//
399
// template <int n>
400
// void f() { std::cout << n << ' '; }
401
//
402
// template <typename T>
403
// void g() { std::cout << typeid(T).name() << ' '; }
404
//
405
// int main() {
406
// f<1>();
407
// f<2>();
408
//
409
// g<int>();
410
// g<double>();
411
// }
412
//
413
// With VC++ 6.0 the output is:
414
//
415
// 2 2 double double
416
//
417
// To fix it, write
418
//
419
// template <int n>
420
// void f(LIBSMBIOS_EXPLICIT_TEMPLATE_NON_TYPE(int, n)) { ... }
421
//
422
// template <typename T>
423
// void g(LIBSMBIOS_EXPLICIT_TEMPLATE_TYPE(T)) { ... }
424
//
425
426
427
// Don't think we need the following boost constructs for libsmbios
428
//#if defined LIBSMBIOS_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
429
//
430
//# include "smbios/type.hpp"
431
//# include "smbios/non_type.hpp"
432
//
433
//# define LIBSMBIOS_EXPLICIT_TEMPLATE_TYPE(t) smbios::type<t>* = 0
434
//# define LIBSMBIOS_EXPLICIT_TEMPLATE_TYPE_SPEC(t) smbios::type<t>*
435
//# define LIBSMBIOS_EXPLICIT_TEMPLATE_NON_TYPE(t, v) smbios::non_type<t, v>* = 0
436
//# define LIBSMBIOS_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) smbios::non_type<t, v>*
437
//
438
//# define LIBSMBIOS_APPEND_EXPLICIT_TEMPLATE_TYPE(t) , LIBSMBIOS_EXPLICIT_TEMPLATE_TYPE(t)
439
//# define LIBSMBIOS_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t) , LIBSMBIOS_EXPLICIT_TEMPLATE_TYPE_SPEC(t)
440
//# define LIBSMBIOS_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v) , LIBSMBIOS_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
441
//# define LIBSMBIOS_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) , LIBSMBIOS_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)
442
//
443
//#else
444
//
446
//
447
//# define LIBSMBIOS_EXPLICIT_TEMPLATE_TYPE(t)
448
//# define LIBSMBIOS_EXPLICIT_TEMPLATE_TYPE_SPEC(t)
449
//# define LIBSMBIOS_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
450
//# define LIBSMBIOS_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)
451
//
452
//# define LIBSMBIOS_APPEND_EXPLICIT_TEMPLATE_TYPE(t)
453
//# define LIBSMBIOS_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t)
454
//# define LIBSMBIOS_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
455
//# define LIBSMBIOS_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)
456
//
457
//
458
//#endif // defined LIBSMBIOS_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
459
460
461
// ---------------------------------------------------------------------------//
462
463
//
464
// Helper macro LIBSMBIOS_STRINGIZE:
465
// Converts the parameter X to a string after macro replacement
466
// on X has been performed.
467
//
468
#define LIBSMBIOS_STRINGIZE(X) LIBSMBIOS_DO_STRINGIZE(X)
469
#define LIBSMBIOS_DO_STRINGIZE(X) #X
470
471
//
472
// Helper macro LIBSMBIOS_JOIN:
473
// The following piece of macro magic joins the two
474
// arguments together, even when one of the arguments is
475
// itself a macro (see 16.3.1 in C++ standard). The key
476
// is that macro expansion of macro arguments does not
477
// occur in LIBSMBIOS_DO_JOIN2 but does in LIBSMBIOS_DO_JOIN.
478
//
479
#define LIBSMBIOS_JOIN( X, Y ) LIBSMBIOS_DO_JOIN( X, Y )
480
#define LIBSMBIOS_DO_JOIN( X, Y ) LIBSMBIOS_DO_JOIN2(X,Y)
481
#define LIBSMBIOS_DO_JOIN2( X, Y ) X##Y
482
483
//
484
// Set some default values for compiler/library/platform names.
485
// These are for debugging config setup only:
486
//
487
# ifndef LIBSMBIOS_COMPILER
488
# define LIBSMBIOS_COMPILER "Unknown ISO C++ Compiler"
489
# endif
490
# ifndef LIBSMBIOS_STDLIB
491
# define LIBSMBIOS_STDLIB "Unknown ISO standard library"
492
# endif
493
# ifndef LIBSMBIOS_PLATFORM
494
# if defined(unix) || defined(__unix) || defined(_XOPEN_SOURCE) \
495
|| defined(_POSIX_SOURCE)
496
# define LIBSMBIOS_PLATFORM "Generic Unix"
497
# else
498
# define LIBSMBIOS_PLATFORM "Unknown"
499
# endif
500
# endif
501
502
#endif
503
504
505
Generated on Sun Oct 9 2016 21:21:11 for libsmbios_c library by
1.8.12