-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add features file describing new available flags #34697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The only available method to check for features at the moment is through version checks. This is errorprone and doesn't work well for OSS toolchains or locally built compilers. features.json is intended to communicate to build systems that a new flag is available, in order to assist with a transitional period where not all supported toolchains may have a particular flag. It is *not* intended to be a comprehensive report of all flags available. Note that the names are intended to be features, so while they may match up to the corresponding flag name, this isn't necessarily the case.
c5c1ccc
to
d57d9fd
Compare
@nkcsgexi this is an approach that avoids the complexity of needing to run the just-built compiler. |
@swift-ci please smoke test |
@akyrtzi can we just run |
Yet another option would be to just run the preprocessor on a JSON file including Options.inc (like the -emit-supported-features option does, but at compile time). Or is that what you meant @nkcsgexi? |
Yeah, in general I'm not a big fan of maintaining this file manually. We could potentially generate this source using the preprocessor. A better option is to change the existing |
There's not much maintenance involved given this is for transition of new flags only. Once you add a new flag, intended to be used by a build system, you add a new entry. After about a year we can choose to prune out old entries, assuming all supported toolchains have the flag. Not all frontend flags we add are intended to be used a build system, having a comprehensive list is nice but I don't see a critical use case and there is inherent complexity to set up. At a minimum we could start with the manual list of new flags for now, since it is dead-simple, and make it comprehensive later. |
I’m not entirely confident that every new commit of adding a compiler flag will be accompanied with an update of this json file. How would we ensure people remember doing that? Also, we need to validate this is a valid json file, ideally not manually. |
It is not necessary that every new commit of adding a compiler flag is added to this file. It's only necessary if we intend for the build system to use it, and the fact the build system needs to check for a "feature" name being present in the file before using the new flag is what will force and ensure its presence in the file, even if the initial swift commit happens to forget to update the file. |
@swift-ci please build toolchain |
Linux Toolchain (Ubuntu 16.04) Install command |
macOS Toolchain Install command |
Linux: OSX: Looks good! |
The only available method to check for features at the moment is through
version checks. This is errorprone and doesn't work well for OSS
toolchains or locally built compilers.
features.json is intended to communicate to build systems that a new
flag is available, in order to assist with a transitional period where
not all supported toolchains may have a particular flag. It is not
intended to be a comprehensive report of all flags available.
Note that the names are intended to be features, so while they may match
up to the corresponding flag name, this isn't necessarily the case.