@@ -58,8 +58,66 @@ def _getAndroidDeviceApi(cfg):
58
58
)
59
59
)
60
60
61
-
61
+ # Lit features are evaluated in order. Some checks may require the compiler detection to have
62
+ # run first in order to work properly.
62
63
DEFAULT_FEATURES = [
64
+ Feature (name = "apple-clang" , when = _isAppleClang ),
65
+ Feature (
66
+ name = lambda cfg : "apple-clang-{__clang_major__}" .format (** compilerMacros (cfg )),
67
+ when = _isAppleClang ,
68
+ ),
69
+ Feature (
70
+ name = lambda cfg : "apple-clang-{__clang_major__}.{__clang_minor__}" .format (** compilerMacros (cfg )),
71
+ when = _isAppleClang ,
72
+ ),
73
+ Feature (
74
+ name = lambda cfg : "apple-clang-{__clang_major__}.{__clang_minor__}.{__clang_patchlevel__}" .format (** compilerMacros (cfg )),
75
+ when = _isAppleClang ,
76
+ ),
77
+ Feature (name = "clang" , when = _isClang ),
78
+ Feature (
79
+ name = lambda cfg : "clang-{__clang_major__}" .format (** compilerMacros (cfg )),
80
+ when = _isClang ,
81
+ ),
82
+ Feature (
83
+ name = lambda cfg : "clang-{__clang_major__}.{__clang_minor__}" .format (** compilerMacros (cfg )),
84
+ when = _isClang ,
85
+ ),
86
+ Feature (
87
+ name = lambda cfg : "clang-{__clang_major__}.{__clang_minor__}.{__clang_patchlevel__}" .format (** compilerMacros (cfg )),
88
+ when = _isClang ,
89
+ ),
90
+ # Note: Due to a GCC bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104760), we must disable deprecation warnings
91
+ # on GCC or spurious diagnostics are issued.
92
+ #
93
+ # TODO:
94
+ # - Enable -Wplacement-new with GCC.
95
+ # - Enable -Wclass-memaccess with GCC.
96
+ Feature (
97
+ name = "gcc" ,
98
+ when = _isGCC ,
99
+ actions = [
100
+ AddCompileFlag ("-D_LIBCPP_DISABLE_DEPRECATION_WARNINGS" ),
101
+ AddCompileFlag ("-Wno-placement-new" ),
102
+ AddCompileFlag ("-Wno-class-memaccess" ),
103
+ AddFeature ("GCC-ALWAYS_INLINE-FIXME" ),
104
+ ],
105
+ ),
106
+ Feature (
107
+ name = lambda cfg : "gcc-{__GNUC__}" .format (** compilerMacros (cfg )), when = _isGCC
108
+ ),
109
+ Feature (
110
+ name = lambda cfg : "gcc-{__GNUC__}.{__GNUC_MINOR__}" .format (** compilerMacros (cfg )),
111
+ when = _isGCC ,
112
+ ),
113
+ Feature (
114
+ name = lambda cfg : "gcc-{__GNUC__}.{__GNUC_MINOR__}.{__GNUC_PATCHLEVEL__}" .format (** compilerMacros (cfg )),
115
+ when = _isGCC ,
116
+ ),
117
+ Feature (name = "msvc" , when = _isMSVC ),
118
+ Feature (name = lambda cfg : "msvc-{}" .format (* _msvcVersion (cfg )), when = _isMSVC ),
119
+ Feature (name = lambda cfg : "msvc-{}.{}" .format (* _msvcVersion (cfg )), when = _isMSVC ),
120
+
63
121
Feature (
64
122
name = "thread-safety" ,
65
123
when = lambda cfg : hasCompileFlag (cfg , "-Werror=thread-safety" ),
@@ -231,62 +289,6 @@ def _getAndroidDeviceApi(cfg):
231
289
AddSubstitution ("%{clang-tidy}" , lambda cfg : _getSuitableClangTidy (cfg ))
232
290
],
233
291
),
234
- Feature (name = "apple-clang" , when = _isAppleClang ),
235
- Feature (
236
- name = lambda cfg : "apple-clang-{__clang_major__}" .format (** compilerMacros (cfg )),
237
- when = _isAppleClang ,
238
- ),
239
- Feature (
240
- name = lambda cfg : "apple-clang-{__clang_major__}.{__clang_minor__}" .format (** compilerMacros (cfg )),
241
- when = _isAppleClang ,
242
- ),
243
- Feature (
244
- name = lambda cfg : "apple-clang-{__clang_major__}.{__clang_minor__}.{__clang_patchlevel__}" .format (** compilerMacros (cfg )),
245
- when = _isAppleClang ,
246
- ),
247
- Feature (name = "clang" , when = _isClang ),
248
- Feature (
249
- name = lambda cfg : "clang-{__clang_major__}" .format (** compilerMacros (cfg )),
250
- when = _isClang ,
251
- ),
252
- Feature (
253
- name = lambda cfg : "clang-{__clang_major__}.{__clang_minor__}" .format (** compilerMacros (cfg )),
254
- when = _isClang ,
255
- ),
256
- Feature (
257
- name = lambda cfg : "clang-{__clang_major__}.{__clang_minor__}.{__clang_patchlevel__}" .format (** compilerMacros (cfg )),
258
- when = _isClang ,
259
- ),
260
- # Note: Due to a GCC bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104760), we must disable deprecation warnings
261
- # on GCC or spurious diagnostics are issued.
262
- #
263
- # TODO:
264
- # - Enable -Wplacement-new with GCC.
265
- # - Enable -Wclass-memaccess with GCC.
266
- Feature (
267
- name = "gcc" ,
268
- when = _isGCC ,
269
- actions = [
270
- AddCompileFlag ("-D_LIBCPP_DISABLE_DEPRECATION_WARNINGS" ),
271
- AddCompileFlag ("-Wno-placement-new" ),
272
- AddCompileFlag ("-Wno-class-memaccess" ),
273
- AddFeature ("GCC-ALWAYS_INLINE-FIXME" ),
274
- ],
275
- ),
276
- Feature (
277
- name = lambda cfg : "gcc-{__GNUC__}" .format (** compilerMacros (cfg )), when = _isGCC
278
- ),
279
- Feature (
280
- name = lambda cfg : "gcc-{__GNUC__}.{__GNUC_MINOR__}" .format (** compilerMacros (cfg )),
281
- when = _isGCC ,
282
- ),
283
- Feature (
284
- name = lambda cfg : "gcc-{__GNUC__}.{__GNUC_MINOR__}.{__GNUC_PATCHLEVEL__}" .format (** compilerMacros (cfg )),
285
- when = _isGCC ,
286
- ),
287
- Feature (name = "msvc" , when = _isMSVC ),
288
- Feature (name = lambda cfg : "msvc-{}" .format (* _msvcVersion (cfg )), when = _isMSVC ),
289
- Feature (name = lambda cfg : "msvc-{}.{}" .format (* _msvcVersion (cfg )), when = _isMSVC ),
290
292
]
291
293
292
294
# Deduce and add the test features that that are implied by the #defines in
0 commit comments