Embedded Template Library
1.0
Loading...
Searching...
No Matches
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
#elif defined(ETL_COMPILER_GCC)
62
#if (__GNUC__ == 10)
63
#define ETL_CPP20_SUPPORTED (__cplusplus >= 201709L)
64
#else
65
#define ETL_CPP20_SUPPORTED (__cplusplus >= 202002L)
66
#endif
67
#else
68
#define ETL_CPP20_SUPPORTED (__cplusplus >= 202002L)
69
#endif
70
#else
71
#define ETL_CPP20_SUPPORTED 0
72
#endif
73
#endif
74
75
#if ETL_CPP20_SUPPORTED
76
#define ETL_CPP11_SUPPORTED 1
77
#define ETL_CPP14_SUPPORTED 1
78
#define ETL_CPP17_SUPPORTED 1
79
#endif
80
81
// Determine C++17 support
82
#if !defined(ETL_CPP17_SUPPORTED)
83
#if defined(__cplusplus)
84
#if defined(ETL_COMPILER_MICROSOFT)
85
#if defined(_MSVC_LANG)
86
#define ETL_CPP17_SUPPORTED (_MSVC_LANG >= 201703L)
87
#else
88
#define ETL_CPP17_SUPPORTED (_MSC_VER >= 1914)
89
#endif
90
#elif defined(ETL_COMPILER_ARM5)
91
#define ETL_CPP17_SUPPORTED 0
92
#else
93
#define ETL_CPP17_SUPPORTED (__cplusplus >= 201703L)
94
#endif
95
#else
96
#define ETL_CPP17_SUPPORTED 0
97
#endif
98
#endif
99
100
#if ETL_CPP17_SUPPORTED
101
#define ETL_CPP11_SUPPORTED 1
102
#define ETL_CPP14_SUPPORTED 1
103
#endif
104
105
// Determine C++14 support
106
#if !defined(ETL_CPP14_SUPPORTED)
107
#if defined(__cplusplus)
108
#if defined(ETL_COMPILER_MICROSOFT)
109
#if defined(_MSVC_LANG)
110
#define ETL_CPP14_SUPPORTED (_MSVC_LANG >= 201402L)
111
#else
112
#define ETL_CPP14_SUPPORTED (_MSC_VER >= 1900)
113
#endif
114
#elif defined(ETL_COMPILER_ARM5)
115
#define ETL_CPP14_SUPPORTED 0
116
#else
117
#define ETL_CPP14_SUPPORTED (__cplusplus >= 201402L)
118
#endif
119
#else
120
#define ETL_CPP14_SUPPORTED 0
121
#endif
122
#endif
123
124
#if ETL_CPP14_SUPPORTED
125
#define ETL_CPP11_SUPPORTED 1
126
#endif
127
128
// Determine C++11 support
129
#if !defined(ETL_CPP11_SUPPORTED)
130
#if defined(__cplusplus)
131
#if defined(ETL_COMPILER_MICROSOFT)
132
#if defined(_MSVC_LANG)
133
#define ETL_CPP11_SUPPORTED (_MSVC_LANG >= 201103L)
134
#else
135
#define ETL_CPP11_SUPPORTED (_MSC_VER >= 1700)
136
#endif
137
#elif defined(ETL_COMPILER_ARM5)
138
#define ETL_CPP11_SUPPORTED 0
139
#else
140
#define ETL_CPP11_SUPPORTED (__cplusplus >= 201103L)
141
#endif
142
#else
143
#define ETL_CPP11_SUPPORTED 0
144
#endif
145
#endif
146
147
// Helper macros
148
#define ETL_CPP11_NOT_SUPPORTED (!ETL_CPP11_SUPPORTED)
149
#define ETL_CPP14_NOT_SUPPORTED (!ETL_CPP14_SUPPORTED)
150
#define ETL_CPP17_NOT_SUPPORTED (!ETL_CPP17_SUPPORTED)
151
#define ETL_CPP20_NOT_SUPPORTED (!ETL_CPP20_SUPPORTED)
152
#define ETL_CPP23_NOT_SUPPORTED (!ETL_CPP23_SUPPORTED)
153
154
// 'Using' macros
155
#define ETL_USING_CPP11 (ETL_CPP11_SUPPORTED == 1)
156
#define ETL_USING_CPP14 (ETL_CPP14_SUPPORTED == 1)
157
#define ETL_USING_CPP17 (ETL_CPP17_SUPPORTED == 1)
158
#define ETL_USING_CPP20 (ETL_CPP20_SUPPORTED == 1)
159
#define ETL_USING_CPP23 (ETL_CPP23_SUPPORTED == 1)
160
161
#define ETL_NOT_USING_CPP11 (ETL_CPP11_SUPPORTED == 0)
162
#define ETL_NOT_USING_CPP14 (ETL_CPP14_SUPPORTED == 0)
163
#define ETL_NOT_USING_CPP17 (ETL_CPP17_SUPPORTED == 0)
164
#define ETL_NOT_USING_CPP20 (ETL_CPP20_SUPPORTED == 0)
165
#define ETL_NOT_USING_CPP23 (ETL_CPP23_SUPPORTED == 0)
166
167
#if !defined(ETL_NO_NULLPTR_SUPPORT)
168
#define ETL_NO_NULLPTR_SUPPORT ETL_NOT_USING_CPP11
169
#endif
170
171
#if !defined(ETL_NO_SMALL_CHAR_SUPPORT)
172
#if ETL_USING_CPP20
173
#define ETL_NO_SMALL_CHAR_SUPPORT 0
174
#else
175
#define ETL_NO_SMALL_CHAR_SUPPORT 1
176
#endif
177
#endif
178
179
#if !defined(ETL_NO_LARGE_CHAR_SUPPORT)
180
#define ETL_NO_LARGE_CHAR_SUPPORT ETL_NOT_USING_CPP11
181
#endif
182
183
#if !defined(ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED)
184
#define ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED ETL_USING_CPP11
185
#endif
186
187
// Language standard
188
#if !defined(ETL_LANGUAGE_STANDARD)
189
#if ETL_USING_CPP23
190
#define ETL_LANGUAGE_STANDARD 23
191
#elif ETL_USING_CPP20
192
#define ETL_LANGUAGE_STANDARD 20
193
#elif ETL_USING_CPP17
194
#define ETL_LANGUAGE_STANDARD 17
195
#elif ETL_USING_CPP14
196
#define ETL_LANGUAGE_STANDARD 14
197
#elif ETL_USING_CPP11
198
#define ETL_LANGUAGE_STANDARD 11
199
#else
200
#define ETL_LANGUAGE_STANDARD 3
201
#endif
202
#endif
203
204
// NAN not defined or Rowley CrossWorks
205
#if !defined(ETL_NO_CPP_NAN_SUPPORT) && (!defined(NAN) || defined(__CROSSWORKS_ARM) || defined(ETL_COMPILER_ARM5) || defined(ARDUINO))
206
#define ETL_NO_CPP_NAN_SUPPORT
207
#endif
208
209
#endif
determine_compiler.h
include
etl
profiles
determine_compiler_language_support.h
Generated on Wed Apr 23 2025 07:41:04 for Embedded Template Library by
1.9.8