Embedded Template Library
1.0
determine_compiler_language_support.h
Go to the documentation of this file.
1
2
3
/******************************************************************************
4
The MIT License(MIT)
5
6
Embedded Template Library.
7
https://github.com/ETLCPP/etl
8
https://www.etlcpp.com
9
10
Copyright(c) 2019 John Wellbelove
11
12
Permission is hereby granted, free of charge, to any person obtaining a copy
13
of this software and associated documentation files(the "Software"), to deal
14
in the Software without restriction, including without limitation the rights
15
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
16
copies of the Software, and to permit persons to whom the Software is
17
furnished to do so, subject to the following conditions :
18
19
The above copyright notice and this permission notice shall be included in all
20
copies or substantial portions of the Software.
21
22
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
25
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
SOFTWARE.
29
******************************************************************************/
30
31
#ifndef ETL_DETERMINE_COMPILER_LANGUAGE_SUPPORT_H_INCLUDED
32
#define ETL_DETERMINE_COMPILER_LANGUAGE_SUPPORT_H_INCLUDED
33
34
#include <math.h>
35
36
#include "
determine_compiler.h
"
37
38
// Determine C++23 support
39
#if !defined(ETL_CPP23_SUPPORTED)
40
#define ETL_CPP23_SUPPORTED 0
41
#endif
42
43
#if ETL_CPP23_SUPPORTED
44
#define ETL_CPP11_SUPPORTED 1
45
#define ETL_CPP14_SUPPORTED 1
46
#define ETL_CPP17_SUPPORTED 1
47
#define ETL_CPP20_SUPPORTED 1
48
#endif
49
50
// Determine C++20 support
51
#if !defined(ETL_CPP20_SUPPORTED)
52
#if defined(__cplusplus)
53
#if defined(ETL_COMPILER_MICROSOFT)
54
#if defined(_MSVC_LANG)
55
#define ETL_CPP20_SUPPORTED (_MSVC_LANG >= 202002L)
56
#else
57
#define ETL_CPP20_SUPPORTED (_MSC_VER >= 1929)
58
#endif
59
#elif defined(ETL_COMPILER_ARM5)
60
#define ETL_CPP20_SUPPORTED 0
61
#else
62
#define ETL_CPP20_SUPPORTED (__cplusplus >= 202002L)
63
#endif
64
#else
65
#define ETL_CPP20_SUPPORTED 0
66
#endif
67
#endif
68
69
#if ETL_CPP20_SUPPORTED
70
#define ETL_CPP11_SUPPORTED 1
71
#define ETL_CPP14_SUPPORTED 1
72
#define ETL_CPP17_SUPPORTED 1
73
#endif
74
75
// Determine C++17 support
76
#if !defined(ETL_CPP17_SUPPORTED)
77
#if defined(__cplusplus)
78
#if defined(ETL_COMPILER_MICROSOFT)
79
#if defined(_MSVC_LANG)
80
#define ETL_CPP17_SUPPORTED (_MSVC_LANG >= 201703L)
81
#else
82
#define ETL_CPP17_SUPPORTED (_MSC_VER >= 1914)
83
#endif
84
#elif defined(ETL_COMPILER_ARM5)
85
#define ETL_CPP17_SUPPORTED 0
86
#else
87
#define ETL_CPP17_SUPPORTED (__cplusplus >= 201703L)
88
#endif
89
#else
90
#define ETL_CPP17_SUPPORTED 0
91
#endif
92
#endif
93
94
#if ETL_CPP17_SUPPORTED
95
#define ETL_CPP11_SUPPORTED 1
96
#define ETL_CPP14_SUPPORTED 1
97
#endif
98
99
// Determine C++14 support
100
#if !defined(ETL_CPP14_SUPPORTED)
101
#if defined(__cplusplus)
102
#if defined(ETL_COMPILER_MICROSOFT)
103
#if defined(_MSVC_LANG)
104
#define ETL_CPP14_SUPPORTED (_MSVC_LANG >= 201402L)
105
#else
106
#define ETL_CPP14_SUPPORTED (_MSC_VER >= 1900)
107
#endif
108
#elif defined(ETL_COMPILER_ARM5)
109
#define ETL_CPP14_SUPPORTED 0
110
#else
111
#define ETL_CPP14_SUPPORTED (__cplusplus >= 201402L)
112
#endif
113
#else
114
#define ETL_CPP14_SUPPORTED 0
115
#endif
116
#endif
117
118
#if ETL_CPP14_SUPPORTED
119
#define ETL_CPP11_SUPPORTED 1
120
#endif
121
122
// Determine C++11 support
123
#if !defined(ETL_CPP11_SUPPORTED)
124
#if defined(__cplusplus)
125
#if defined(ETL_COMPILER_MICROSOFT)
126
#if defined(_MSVC_LANG)
127
#define ETL_CPP11_SUPPORTED (_MSVC_LANG >= 201103L)
128
#else
129
#define ETL_CPP11_SUPPORTED (_MSC_VER >= 1700)
130
#endif
131
#elif defined(ETL_COMPILER_ARM5)
132
#define ETL_CPP11_SUPPORTED 0
133
#else
134
#define ETL_CPP11_SUPPORTED (__cplusplus >= 201103L)
135
#endif
136
#else
137
#define ETL_CPP11_SUPPORTED 0
138
#endif
139
#endif
140
141
// Helper macros
142
#define ETL_CPP11_NOT_SUPPORTED (!ETL_CPP11_SUPPORTED)
143
#define ETL_CPP14_NOT_SUPPORTED (!ETL_CPP14_SUPPORTED)
144
#define ETL_CPP17_NOT_SUPPORTED (!ETL_CPP17_SUPPORTED)
145
#define ETL_CPP20_NOT_SUPPORTED (!ETL_CPP20_SUPPORTED)
146
#define ETL_CPP23_NOT_SUPPORTED (!ETL_CPP23_SUPPORTED)
147
148
// 'Using' macros
149
#define ETL_USING_CPP11 (ETL_CPP11_SUPPORTED == 1)
150
#define ETL_USING_CPP14 (ETL_CPP14_SUPPORTED == 1)
151
#define ETL_USING_CPP17 (ETL_CPP17_SUPPORTED == 1)
152
#define ETL_USING_CPP20 (ETL_CPP20_SUPPORTED == 1)
153
#define ETL_USING_CPP23 (ETL_CPP23_SUPPORTED == 1)
154
155
#define ETL_NOT_USING_CPP11 (ETL_CPP11_SUPPORTED == 0)
156
#define ETL_NOT_USING_CPP14 (ETL_CPP14_SUPPORTED == 0)
157
#define ETL_NOT_USING_CPP17 (ETL_CPP17_SUPPORTED == 0)
158
#define ETL_NOT_USING_CPP20 (ETL_CPP20_SUPPORTED == 0)
159
#define ETL_NOT_USING_CPP23 (ETL_CPP23_SUPPORTED == 0)
160
161
#if !defined(ETL_NO_NULLPTR_SUPPORT)
162
#define ETL_NO_NULLPTR_SUPPORT ETL_NOT_USING_CPP11
163
#endif
164
165
#if !defined(ETL_NO_SMALL_CHAR_SUPPORT)
166
#if ETL_USING_CPP20
167
#define ETL_NO_SMALL_CHAR_SUPPORT 0
168
#else
169
#define ETL_NO_SMALL_CHAR_SUPPORT 1
170
#endif
171
#endif
172
173
#if !defined(ETL_NO_LARGE_CHAR_SUPPORT)
174
#define ETL_NO_LARGE_CHAR_SUPPORT ETL_NOT_USING_CPP11
175
#endif
176
177
#if !defined(ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED)
178
#define ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED ETL_USING_CPP11
179
#endif
180
181
// Language standard
182
#if ETL_USING_CPP23
183
#define ETL_LANGUAGE_STANDARD 23
184
#elif ETL_USING_CPP20
185
#define ETL_LANGUAGE_STANDARD 20
186
#elif ETL_USING_CPP17
187
#define ETL_LANGUAGE_STANDARD 17
188
#elif ETL_USING_CPP14
189
#define ETL_LANGUAGE_STANDARD 14
190
#elif ETL_USING_CPP11
191
#define ETL_LANGUAGE_STANDARD 11
192
#else
193
#define ETL_LANGUAGE_STANDARD 3
194
#endif
195
196
// NAN not defined or Rowley CrossWorks
197
#if !defined(NAN) || defined(__CROSSWORKS_ARM) || defined(ETL_COMPILER_ARM5) || defined(ARDUINO)
198
#define ETL_NO_CPP_NAN_SUPPORT
199
#endif
200
201
#endif
determine_compiler.h
include
etl
profiles
determine_compiler_language_support.h
Generated on Wed Oct 4 2023 20:11:17 for Embedded Template Library by
1.9.4