14
14
// features.
15
15
//
16
16
//
17
- // LANGUAGE_FEATURE(FeatureName, IsAdoptable, SENumber, Description)
17
+ // LANGUAGE_FEATURE(FeatureName, SENumber, Description)
18
18
//
19
19
// The LANGUAGE_FEATURE macro describes each named feature that is
20
20
// introduced in Swift. It allows Swift code to check for a particular
21
21
// feature with "#if $FeatureName" in source code.
22
22
//
23
23
// FeatureName: The name given to this feature to be used in source code,
24
24
// e.g., AsyncAwait.
25
- // IsAdoptable: Whether the feature implements adoption mode.
26
- //
27
- // If the feature is upcoming (source-breaking) and provides for a
28
- // mechanical code migration, it should implement adoption mode.
29
- //
30
- // Adoption mode is a feature-oriented code migration mechanism: a mode
31
- // of operation that should produce compiler warnings with attached
32
- // fix-its that can be applied to preserve the behavior of the code once
33
- // the upcoming feature is enacted.
34
- // These warnings must belong to a diagnostic group named after the
35
- // feature. Adoption mode itself *and* the fix-its it produces must be
36
- // source and binary compatible with how the code is compiled when the
37
- // feature is disabled.
38
- //
39
25
// SENumber: The number assigned to this feature in the Swift Evolution
40
26
// process, or 0 if there isn't one.
41
27
// Description: A string literal describing the feature.
105
91
#endif
106
92
107
93
#ifndef SUPPRESSIBLE_LANGUAGE_FEATURE
108
- #define SUPPRESSIBLE_LANGUAGE_FEATURE (FeatureName, SENumber, Description ) \
109
- LANGUAGE_FEATURE (FeatureName, /* IsAdoptable=*/ false , SENumber, \
110
- Description)
94
+ # define SUPPRESSIBLE_LANGUAGE_FEATURE (FeatureName, SENumber, Description ) \
95
+ LANGUAGE_FEATURE (FeatureName, SENumber, Description)
111
96
#endif
112
97
113
98
#ifndef OPTIONAL_LANGUAGE_FEATURE
114
- # define OPTIONAL_LANGUAGE_FEATURE (FeatureName, SENumber, Description ) \
115
- LANGUAGE_FEATURE (FeatureName, /* IsAdoptable= */ false , SENumber, Description)
99
+ # define OPTIONAL_LANGUAGE_FEATURE (FeatureName, SENumber, Description ) \
100
+ LANGUAGE_FEATURE (FeatureName, SENumber, Description)
116
101
#endif
117
102
118
103
// A feature that's both conditionally-suppressible and experimental.
131
116
#endif
132
117
133
118
#ifndef CONDITIONALLY_SUPPRESSIBLE_LANGUAGE_FEATURE
134
- #define CONDITIONALLY_SUPPRESSIBLE_LANGUAGE_FEATURE (FeatureName, SENumber, \
135
- Description) \
136
- LANGUAGE_FEATURE (FeatureName, /* IsAdoptable=*/ false , SENumber, \
137
- Description)
138
- #endif
139
-
140
- // An upcoming feature that supports adoption mode.
141
- #ifndef ADOPTABLE_UPCOMING_FEATURE
142
- #if defined(UPCOMING_FEATURE)
143
- #define ADOPTABLE_UPCOMING_FEATURE (FeatureName, SENumber, Version ) \
144
- UPCOMING_FEATURE (FeatureName, SENumber, Version)
145
- #else
146
- #define ADOPTABLE_UPCOMING_FEATURE (FeatureName, SENumber, Version ) \
147
- LANGUAGE_FEATURE (FeatureName, /* IsAdoptable=*/ true , SENumber, \
148
- #FeatureName)
149
- #endif
119
+ # define CONDITIONALLY_SUPPRESSIBLE_LANGUAGE_FEATURE (FeatureName, SENumber, Description ) \
120
+ LANGUAGE_FEATURE (FeatureName, SENumber, Description)
150
121
#endif
151
122
152
123
#ifndef UPCOMING_FEATURE
153
- #define UPCOMING_FEATURE (FeatureName, SENumber, Version ) \
154
- LANGUAGE_FEATURE (FeatureName, /* IsAdoptable=*/ false , SENumber, \
155
- #FeatureName)
124
+ # define UPCOMING_FEATURE (FeatureName, SENumber, Version ) \
125
+ LANGUAGE_FEATURE (FeatureName, SENumber, #FeatureName)
156
126
#endif
157
127
158
128
#ifndef EXPERIMENTAL_FEATURE
159
- // Warning: setting `AvailableInProd` to `true` on a feature means that the
160
- // flag cannot be dropped in the future.
161
- # define EXPERIMENTAL_FEATURE (FeatureName, AvailableInProd ) \
162
- LANGUAGE_FEATURE (FeatureName, /* IsAdoptable= */ false , 0 , #FeatureName)
129
+ // Warning: setting `AvailableInProd` to `true` on a feature means that the flag
130
+ // cannot be dropped in the future.
131
+ # define EXPERIMENTAL_FEATURE (FeatureName, AvailableInProd ) \
132
+ LANGUAGE_FEATURE (FeatureName, 0 , #FeatureName)
163
133
#endif
164
134
165
135
#ifndef EXPERIMENTAL_FEATURE_EXCLUDED_FROM_MODULE_INTERFACE
168
138
#endif
169
139
170
140
#ifndef BASELINE_LANGUAGE_FEATURE
171
- #define BASELINE_LANGUAGE_FEATURE (FeatureName, SENumber, Description ) \
172
- LANGUAGE_FEATURE (FeatureName, /* IsAdoptable=*/ false , SENumber, \
173
- Description)
141
+ # define BASELINE_LANGUAGE_FEATURE (FeatureName, SENumber, Description ) \
142
+ LANGUAGE_FEATURE (FeatureName, SENumber, Description)
174
143
#endif
175
144
176
145
BASELINE_LANGUAGE_FEATURE (AsyncAwait, 296 , " async/await" )
@@ -241,14 +210,10 @@ BASELINE_LANGUAGE_FEATURE(BodyMacros, 415, "Function body macros")
241
210
SUPPRESSIBLE_LANGUAGE_FEATURE(SendingArgsAndResults, 430 , " Sending arg and results" )
242
211
BASELINE_LANGUAGE_FEATURE(BorrowingSwitch, 432 , " Noncopyable type pattern matching" )
243
212
CONDITIONALLY_SUPPRESSIBLE_LANGUAGE_FEATURE(IsolatedAny, 431 , " @isolated(any) function types" )
244
- LANGUAGE_FEATURE(IsolatedAny2, /* IsAdoptable=*/ false , 431 ,
245
- " @isolated(any) function types" )
246
- LANGUAGE_FEATURE(ObjCImplementation, /* IsAdoptable=*/ false , 436 ,
247
- " @objc @implementation extensions" )
248
- LANGUAGE_FEATURE(NonescapableTypes, /* IsAdoptable=*/ false , 446 ,
249
- " Nonescapable types" )
250
- LANGUAGE_FEATURE(BuiltinEmplaceTypedThrows, /* IsAdoptable=*/ false , 0 ,
251
- " Builtin.emplace typed throws" )
213
+ LANGUAGE_FEATURE(IsolatedAny2, 431 , " @isolated(any) function types" )
214
+ LANGUAGE_FEATURE(ObjCImplementation, 436 , " @objc @implementation extensions" )
215
+ LANGUAGE_FEATURE(NonescapableTypes, 446 , " Nonescapable types" )
216
+ LANGUAGE_FEATURE(BuiltinEmplaceTypedThrows, 0 , " Builtin.emplace typed throws" )
252
217
SUPPRESSIBLE_LANGUAGE_FEATURE(MemorySafetyAttributes, 458 , " @unsafe attribute" )
253
218
254
219
// Swift 6
@@ -269,7 +234,7 @@ UPCOMING_FEATURE(NonfrozenEnumExhaustivity, 192, 6)
269
234
UPCOMING_FEATURE(GlobalActorIsolatedTypesUsability, 0434 , 6 )
270
235
271
236
// Swift 7
272
- ADOPTABLE_UPCOMING_FEATURE (ExistentialAny, 335 , 7 )
237
+ UPCOMING_FEATURE (ExistentialAny, 335 , 7 )
273
238
UPCOMING_FEATURE(InternalImportsByDefault, 409 , 7 )
274
239
UPCOMING_FEATURE(MemberImportVisibility, 444 , 7 )
275
240
@@ -520,7 +485,6 @@ EXPERIMENTAL_FEATURE(CompileTimeValues, true)
520
485
#undef EXPERIMENTAL_FEATURE_EXCLUDED_FROM_MODULE_INTERFACE
521
486
#undef EXPERIMENTAL_FEATURE
522
487
#undef UPCOMING_FEATURE
523
- #undef ADOPTABLE_UPCOMING_FEATURE
524
488
#undef BASELINE_LANGUAGE_FEATURE
525
489
#undef OPTIONAL_LANGUAGE_FEATURE
526
490
#undef CONDITIONALLY_SUPPRESSIBLE_EXPERIMENTAL_FEATURE
0 commit comments