48
48
// for features that can be assumed to be available in any Swift compiler that
49
49
// will be used to process the textual interface files produced by this
50
50
// Swift compiler.
51
+ //
52
+ // OPTIONAL_LANGUAGE_FEATURE is the same as LANGUAGE_FEATURE, but describes
53
+ // accepted features that can be enabled independently of language version and
54
+ // are not scheduled to be enabled in some specific language version. Examples
55
+ // of optional language features include strict memory safety checking (SE-0458)
56
+ // and Embedded Swift.
51
57
// ===----------------------------------------------------------------------===//
52
58
53
59
#ifndef LANGUAGE_FEATURE
89
95
LANGUAGE_FEATURE (FeatureName, SENumber, Description)
90
96
#endif
91
97
98
+ #ifndef OPTIONAL_LANGUAGE_FEATURE
99
+ # define OPTIONAL_LANGUAGE_FEATURE (FeatureName, SENumber, Description ) \
100
+ LANGUAGE_FEATURE (FeatureName, SENumber, Description)
101
+ #endif
102
+
92
103
// A feature that's both conditionally-suppressible and experimental.
93
104
// Delegates to whichever the includer defines.
94
105
#ifndef CONDITIONALLY_SUPPRESSIBLE_EXPERIMENTAL_FEATURE
@@ -203,6 +214,7 @@ LANGUAGE_FEATURE(IsolatedAny2, 431, "@isolated(any) function types")
203
214
LANGUAGE_FEATURE(ObjCImplementation, 436 , " @objc @implementation extensions" )
204
215
LANGUAGE_FEATURE(NonescapableTypes, 446 , " Nonescapable types" )
205
216
LANGUAGE_FEATURE(BuiltinEmplaceTypedThrows, 0 , " Builtin.emplace typed throws" )
217
+ SUPPRESSIBLE_LANGUAGE_FEATURE(MemorySafetyAttributes, 458 , " @unsafe attribute" )
206
218
207
219
// Swift 6
208
220
UPCOMING_FEATURE(ConciseMagicFile, 274 , 6 )
@@ -226,6 +238,14 @@ UPCOMING_FEATURE(ExistentialAny, 335, 7)
226
238
UPCOMING_FEATURE(InternalImportsByDefault, 409 , 7 )
227
239
UPCOMING_FEATURE(MemberImportVisibility, 444 , 7 )
228
240
241
+ // Optional language features / modes
242
+
243
+ // / Diagnose uses of language constructs and APIs that can violate memory
244
+ // / safety.
245
+ OPTIONAL_LANGUAGE_FEATURE(StrictMemorySafety, 458 , " Strict memory safety" )
246
+
247
+ // Experimental features
248
+
229
249
EXPERIMENTAL_FEATURE(StaticAssert, false )
230
250
EXPERIMENTAL_FEATURE(NamedOpaqueTypes, false )
231
251
EXPERIMENTAL_FEATURE(FlowSensitiveConcurrencyCaptures, false )
@@ -396,12 +416,6 @@ EXPERIMENTAL_FEATURE(Extern, true)
396
416
// Enable trailing comma for comma-separated lists.
397
417
EXPERIMENTAL_FEATURE(TrailingComma, false )
398
418
399
- // / Allow the @unsafe attribute.
400
- SUPPRESSIBLE_EXPERIMENTAL_FEATURE(AllowUnsafeAttribute, true )
401
-
402
- // / Warn on use of unsafe constructs.
403
- EXPERIMENTAL_FEATURE(WarnUnsafe, true )
404
-
405
419
// Import bounds safety and lifetime attributes from interop headers to
406
420
// generate Swift wrappers with safe pointer types.
407
421
EXPERIMENTAL_FEATURE(SafeInteropWrappers, false )
@@ -463,6 +477,7 @@ EXPERIMENTAL_FEATURE(IsolatedConformances, true)
463
477
#undef EXPERIMENTAL_FEATURE
464
478
#undef UPCOMING_FEATURE
465
479
#undef BASELINE_LANGUAGE_FEATURE
480
+ #undef OPTIONAL_LANGUAGE_FEATURE
466
481
#undef CONDITIONALLY_SUPPRESSIBLE_EXPERIMENTAL_FEATURE
467
482
#undef CONDITIONALLY_SUPPRESSIBLE_LANGUAGE_FEATURE
468
483
#undef SUPPRESSIBLE_EXPERIMENTAL_FEATURE
0 commit comments