Files
swift-mirror/test/lit.swift-features.cfg.inc
Daniel Rodríguez Troitiño d2d830fc0e [test] Warning about Swift features that do not exist (#77542)
Sometimes features are removed from `Features.def`, but they are not
removed from the test files. The compiler ignores every feature that
does not exist. This leads to removed features still being tested, and
with the introduction of #76740, `REQUIRED:`.

Modify the code that generates the active feature set for testing to
also generate the set of existing features, and pass this list of
existing features to the verifier script. If a feature is trying to be
activated and does not exist, the verifier will warn the user.

- `SwiftParser` feature was renamed `ParserASTGen`, but some tests were
  using both spellings. Remove the mentions of `SwiftParser` in the
  tests.
- `ImportObjcForwardDeclarations` was spelled with upper case `C` in
  a couple of tests. Fix it so the matching is easier.
- `TransferringArgsAndResults` was an experimental feature that was
  removed.
- Ignore the usage of inexisting feature in `swift-export-as.swift`
  because it seems to be what the test is actually testing.
- Ignore the test `availability_define.swift` because it tests the
  pseudo-feature `AvailabilityMacro=` which is not part of
  `Features.def`.
2024-11-12 08:58:53 -08:00

36 lines
1.6 KiB
C++

/* lit.swift-feature.cfg.inc - Config for Swift features for 'lit' test runner */
/*
* This source file is part of the Swift.org open source project
*
* Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
* Licensed under Apache License v2.0 with Runtime Library Exception
*
* See https://swift.org/LICENSE.txt for license information
* See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
*/
/*
* This is a configuration file for the 'lit' test runner. It takes the
* Features.def for the language and creates 'lit' features associated with
* them when the Swift feature is available. It allows using
* `REQUIRES: FeatureName` instead of `REQUIRES: asserts`, which tend to be
* left behind when the Swift feature becomes non-experimental.
*
* This file is preprocessed the Clang preprocessor and generates Python files.
* C comments are possible, but not Python comments (they look like preprocessor
* statements).
*/
config.existing_swift_features = set()
def language_feature(feature_name, enabled):
config.existing_swift_features.add(feature_name)
if enabled or "asserts" in config.available_features:
config.available_features.add("swift_feature_" + feature_name)
#define UPCOMING_FEATURE(FeatureName, SENumber, Version) language_feature(#FeatureName, True)
#define EXPERIMENTAL_FEATURE(FeatureName, AvailableInProd) language_feature(#FeatureName, #AvailableInProd == "true")
#define LANGUAGE_FEATURE(FeatureName, SENumber, Description) language_feature(#FeatureName, True)
#include <swift/Basic/Features.def>