1414// features.
1515//
1616//
17- // LANGUAGE_FEATURE(FeatureName, IsAdoptable, SENumber, Description)
17+ // LANGUAGE_FEATURE(FeatureName, SENumber, Description)
1818//
1919// The LANGUAGE_FEATURE macro describes each named feature that is
2020// introduced in Swift. It allows Swift code to check for a particular
2121// feature with "#if $FeatureName" in source code.
2222//
2323// FeatureName: The name given to this feature to be used in source code,
2424// 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- //
3925// SENumber: The number assigned to this feature in the Swift Evolution
4026// process, or 0 if there isn't one.
4127// Description: A string literal describing the feature.
10591#endif
10692
10793#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)
11196#endif
11297
11398#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)
116101#endif
117102
118103// A feature that's both conditionally-suppressible and experimental.
131116#endif
132117
133118#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)
150121#endif
151122
152123#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)
156126#endif
157127
158128#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)
163133#endif
164134
165135#ifndef EXPERIMENTAL_FEATURE_EXCLUDED_FROM_MODULE_INTERFACE
168138#endif
169139
170140#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)
174143#endif
175144
176145BASELINE_LANGUAGE_FEATURE (AsyncAwait, 296 , " async/await" )
@@ -241,14 +210,10 @@ BASELINE_LANGUAGE_FEATURE(BodyMacros, 415, "Function body macros")
241210SUPPRESSIBLE_LANGUAGE_FEATURE(SendingArgsAndResults, 430 , " Sending arg and results" )
242211BASELINE_LANGUAGE_FEATURE(BorrowingSwitch, 432 , " Noncopyable type pattern matching" )
243212CONDITIONALLY_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" )
252217SUPPRESSIBLE_LANGUAGE_FEATURE(MemorySafetyAttributes, 458 , " @unsafe attribute" )
253218
254219// Swift 6
@@ -269,7 +234,7 @@ UPCOMING_FEATURE(NonfrozenEnumExhaustivity, 192, 6)
269234UPCOMING_FEATURE(GlobalActorIsolatedTypesUsability, 0434 , 6 )
270235
271236// Swift 7
272- ADOPTABLE_UPCOMING_FEATURE (ExistentialAny, 335 , 7 )
237+ UPCOMING_FEATURE (ExistentialAny, 335 , 7 )
273238UPCOMING_FEATURE(InternalImportsByDefault, 409 , 7 )
274239UPCOMING_FEATURE(MemberImportVisibility, 444 , 7 )
275240
@@ -520,7 +485,6 @@ EXPERIMENTAL_FEATURE(CompileTimeValues, true)
520485#undef EXPERIMENTAL_FEATURE_EXCLUDED_FROM_MODULE_INTERFACE
521486#undef EXPERIMENTAL_FEATURE
522487#undef UPCOMING_FEATURE
523- #undef ADOPTABLE_UPCOMING_FEATURE
524488#undef BASELINE_LANGUAGE_FEATURE
525489#undef OPTIONAL_LANGUAGE_FEATURE
526490#undef CONDITIONALLY_SUPPRESSIBLE_EXPERIMENTAL_FEATURE
0 commit comments