|
| 1 | +//===--- Features.def - Swift Features Metaprogramming ----------*- C++ -*-===// |
| 2 | +// |
| 3 | +// This source file is part of the Swift.org open source project |
| 4 | +// |
| 5 | +// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors |
| 6 | +// Licensed under Apache License v2.0 with Runtime Library Exception |
| 7 | +// |
| 8 | +// See https://swift.org/LICENSE.txt for license information |
| 9 | +// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors |
| 10 | +// |
| 11 | +//===----------------------------------------------------------------------===// |
| 12 | +// |
| 13 | +// This file defines macros used for macro-metaprogramming with language |
| 14 | +// features. |
| 15 | +// |
| 16 | +// |
| 17 | +// FEATURE(FeatureName, SENumber, Description, Option) |
| 18 | +// |
| 19 | +// The FEATURE macro describes each named feature that is introduced in |
| 20 | +// Swift. It allows Swift code to check for a particular feature with |
| 21 | +// "#if $FeatureName" in source code. |
| 22 | +// |
| 23 | +// FeatureName: The name given to this feature to be used in source code, |
| 24 | +// e.g., AsyncAwait. |
| 25 | +// SENumber: The number assigned to this feature in the Swift Evolution |
| 26 | +// process, or 0 if there isn't one. |
| 27 | +// Description: A string literal describing the feature. |
| 28 | +// Option: either a reference to a language option in the form |
| 29 | +// "langOpts.<option name>" or "true" to indicate that it's always |
| 30 | +// enabled. |
| 31 | +//===----------------------------------------------------------------------===// |
| 32 | + |
| 33 | +#ifndef LANGUAGE_FEATURE |
| 34 | +# error define LANGUAGE_FEATURE before including Features.def |
| 35 | +#endif |
| 36 | + |
| 37 | +LANGUAGE_FEATURE(StaticAssert, 0, "#assert", langOpts.EnableExperimentalStaticAssert) |
| 38 | +LANGUAGE_FEATURE(AsyncAwait, 296, "async/await", true) |
| 39 | +LANGUAGE_FEATURE(Actors, 0, "actors", langOpts.EnableExperimentalConcurrency) |
| 40 | + |
| 41 | +#undef LANGUAGE_FEATURE |
0 commit comments