xref: /aosp_15_r20/external/pigweed/third_party/fuchsia/repo/sdk/lib/stdcompat/include/lib/stdcompat/version.h (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1 // Copyright 2020 The Fuchsia Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef LIB_STDCOMPAT_VERSION_H_
6 #define LIB_STDCOMPAT_VERSION_H_
7 
8 // This <version> polyfills is meant to provide the feature testing macros for the rest of
9 // the stdcompat library. It is not meant to be a full polyfill of <version>.
10 
11 #if __has_include(<version>) && !defined(LIB_STDCOMPAT_USE_POLYFILLS)
12 #include <version>
13 #elif __cplusplus > 201703L && !defined(LIB_STDCOMPAT_USE_POLYFILLS)
14 #error "cpp=std20 must provide a '<version>' header."
15 #else
16 
17 #if __has_include(<optional>) && !defined(__cpp_lib_optional) && __cplusplus >= 201606L
18 #define __cpp_lib_optional 201606L
19 #endif
20 
21 #if __has_include(<string_view>) && !defined(__cpp_lib_string_view) && __cplusplus >= 201606L
22 #define __cpp_lib_string_view 201606L
23 #endif
24 
25 #if __has_include(<variant>) && !defined(__cpp_lib_variant) && __cplusplus >= 201606L
26 #define __cpp_lib_variant 201606L
27 #endif
28 
29 #if !defined(__cpp_lib_void_t) && __cplusplus >= 201411L
30 #define __cpp_lib_void_t 201411L
31 #endif
32 
33 #if !defined(__cpp_lib_logical_traits) && __cplusplus >= 201510L
34 #define __cpp_lib_logical_traits 201510L
35 #endif
36 
37 #if !defined(__cpp_lib_addressof_constexpr) && __cplusplus >= 201603L
38 #define __cpp_lib_addressof_constexpr 201603L
39 #endif
40 
41 #if !defined(__cpp_lib_nonmember_container_access) && __cplusplus >= 201411L
42 #define __cpp_lib_nonmember_container_access 201411L
43 #endif
44 
45 #if !defined(__cpp_lib_byte) && __cplusplus >= 201603L
46 #define __cpp_lib_byte 201603L
47 #endif
48 
49 #if !defined(__cpp_lib_bool_constant) && __cplusplus >= 201505L
50 #define __cpp_lib_bool_constant 201505L
51 #endif
52 
53 #if !defined(__cpp_lib_type_trait_variable_templates) && __cplusplus >= 201510L
54 #define __cpp_lib_type_trait_variable_templates 201510L
55 #endif
56 
57 #if !defined(__cpp_lib_is_aggregate) && __cplusplus >= 201703L
58 #define __cpp_lib_is_aggregate 201703L
59 #endif
60 
61 #if !defined(__cpp_lib_is_invocable) && __cplusplus >= 201703L
62 #define __cpp_lib_is_invocable 201703L
63 #endif
64 
65 #if !defined(__cpp_lib_invoke) && __cplusplus >= 201411L
66 #define __cpp_lib_invoke 201411L
67 #endif
68 
69 #if !defined(__cpp_lib_apply) && __cplusplus >= 201603L
70 #define __cpp_lib_apply 201603L
71 #endif
72 
73 #if !defined(__cpp_lib_as_const) && __cplusplus >= 201510L
74 #define __cpp_lib_as_const 201510L
75 #endif
76 
77 #endif  // __has_include(<version>) && !defined(LIB_STDCOMPAT_USE_POLYFILLS)
78 
79 #endif  // LIB_STDCOMPAT_VERSION_H_
80