nlib
Config_gcc.h
1 
2 #pragma once
3 #ifndef INCLUDE_NN_NLIB_CONFIG_GCC_H_
4 #define INCLUDE_NN_NLIB_CONFIG_GCC_H_
5 #ifndef INCLUDE_NN_NLIB_CONFIG_H_
6 # error do not include directly
7 #endif
8 
9 #if defined(__GNUC__)
10 
11 #ifdef __EXCEPTIONS
12 # define NLIB_EXCEPTION_ENABLED
13 #endif
14 
15 #if __GNUC__ > 4
16 # define NLIB_CXX11_RVALUE_REFERENCES
17 # define NLIB_CXX11_STATIC_ASSERTIONS
18 # define NLIB_CXX11_EXTERN_TEMPLATES
19 # define NLIB_CXX11_DEFAULTED_AND_DELETED_FUNCTIONS
20 # define NLIB_CXX11_EXPLICIT_CONVERSION_OPERATORS
21 # define NLIB_CXX11_NULL_POINTER_CONSTANT
22 # define NLIB_CXX11_RANGE_BASED_FOR
23 # define NLIB_CXX11_EXPLICIT_VIRTUAL_OVERRIDES
24 # define NLIB_CXX11_TEMPLATE_ALIAS
25 # define NLIB_CXX11_ALIGNMENT_SUPPORT
26 # define NLIB_CXX11_LAMBDAS
27 # define NLIB_CXX11_CONSTEXPR
28 # define NLIB_CXX11_DEFAULT_TEMPLATE_ARGUMENT_FOR_FUNCTION_TEMPLATES
29 #elif __GNUC__ == 4
30 # if __GNUC_MINOR__ <= 6 || __cplusplus > 199711L
31 
32 # if __GNUC_MINOR__ >= 3
33 # define NLIB_CXX11_RVALUE_REFERENCES
34 # define NLIB_CXX11_STATIC_ASSERTIONS
35 # define NLIB_CXX11_EXTERN_TEMPLATES
36 # define NLIB_CXX11_SWAPHEADER
37 # define NLIB_CXX11_DEFAULT_TEMPLATE_ARGUMENT_FOR_FUNCTION_TEMPLATES
38 # endif
39 
40 # if __GNUC_MINOR__ >= 4
41 # define NLIB_CXX11_DEFAULTED_AND_DELETED_FUNCTIONS
42 # endif
43 
44 # if __GNUC_MINOR__ >= 5
45 # endif
46 
47 # if __GNUC_MINOR__ >= 6
48 # define NLIB_CXX11_EXPLICIT_CONVERSION_OPERATORS
49 # define NLIB_CXX11_NULL_POINTER_CONSTANT
50 # define NLIB_CXX11_RANGE_BASED_FOR
51 # endif
52 
53 # if __GNUC_MINOR__ >= 7
54 # define NLIB_CXX11_VARIADIC_TEMPLATES // gcc4.6 cannot expand 'typedef Types<TAIL...> Tail;'
55 # define NLIB_CXX11_CONSTEXPR
56 # define NLIB_CXX11_EXPLICIT_VIRTUAL_OVERRIDES
57 # define NLIB_CXX11_TEMPLATE_ALIAS
58 # define NLIB_CXX11_LAMBDAS
59 # define NLIB_CXX11_DELEGATING_CONSTRUCTORS
60 # endif
61 
62 # if __GNUC_MINOR__ >= 8
63 # define NLIB_CXX11_ALIGNMENT_SUPPORT
64 # endif
65 # endif
66 #else
67 # error
68 #endif
69 
70 #include <bits/c++config.h>
71 #ifndef __GLIBCXX__
72 # error c++config.h should define __GLIBCXX__ ...
73 #endif
74 
75 #if __GLIBCXX__ >= 20100414
76 # define NLIB_CXX11_UNIQUEPTR
77 # define NLIB_CXX11_STDLIB_ARRAY
78 # define NLIB_CXX11_STDLIB_UNORDERED
79 # define NLIB_CXX11_STDLIB_TUPLE
80 #endif
81 #if __GLIBCXX__ >= 20120322
82 // https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html
83 # define NLIB_HAS_NATIVE_TYPETRAITS
84 # define NLIB_CXX11_STDLIB_RANDOM
85 # define NLIB_CXX11_STDLIB_CHRONO
86 # define NLIB_CXX11_STDLIB_ATOMIC
87 #endif
88 
89 #include <cassert> // NOLINT
90 #define NLIB_ASSERT assert
91 
92 #define NLIB_ALIGNAS(x) __attribute__((aligned(x)))
93 #define NLIB_ALIGNOF(tp) __alignof__(tp)
94 
95 #endif
96 #endif // INCLUDE_NN_NLIB_CONFIG_GCC_H_