-
Notifications
You must be signed in to change notification settings - Fork 9
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
Compatibility Information in CPS Files #80
Comments
I... don't think CPS does that? (Well, your package can do that, but that would be a case of "you shouldn't do that".) Language level is a feature, not a flag. I'm also not sure what the use case is. Your library should specify the minimum language level required to compile against it. Anything else is informative, and therefore I don't know how we would normatively specify how to provide such information. (Suggestions?) |
The use case is detecting when different libraries incorrectly disagree on relevant flags like It's not generally possible for a built binary to be compatible for a range of standard versions, so we don't want to express that. We do want to be able to express that a given library was built with C++20 and its headers should likewise be parsed that way or run the risk of violating the One Definition Rule. Same goes for other flags like a -D flag set to be compatible with another library but this library otherwise doesn't provide or require. |
I'm flexible on how to express these... I guess they're requirements, but in my mind they would inform compatibility checks to be performed by linters or build tools. Probably to start, I would add fields to my CPS files as an extension and then report back once I try some things out and come back with what I like. But it's a legitimate use case if we want tools to tell us our libraries are behaving in ODR suspicious ways as a group. I think we do want that. |
Don't specify This is why we have features. We almost certainly need more features than are currently in the specification, but again, it's unclear why features aren't the solution here. I'm less convinced that I can't build my C++20 project against a C++11 library or vice versa, but if you want consumers to use (at least) C++20 to consume your library, declare the (The original intention is for standard library versions/flavors to be part of the platform definition. That, of course, is in flux, and we've also kicked around the idea of standard libraries being dependencies — your idea, IIRC. Again, an area that needs work, but in its current form, I'm not sure what this issue is adding to that conversation.) |
I guess I am concerned that there is a large, unbounded, and nonportable set of compatibility modes to enumerate to avoid the ODR and compatibility bugs I'm concerned about. Off the top of my head:
I don't expect to reasonably model all of that in CPS, especially things in that last category.
One solution is that everything that depends on |
It would be nice if my CPS files could describe how my library was built without be prescriptive to downstream consumers about how they should build.
For instance, it would be helpful to know that my library was built for C++20. It would not be helpful for my library to require all of its users to use a specific flag setting the C++ standard to 20. That goes in a build toolchain file, a build configuration file, or something of that nature.
I expect this information would be used to quickly ascertain incompatibilities across dependencies in clear ways that are not possible at the moment. In fact, it's is possible at the moment that a mismatching C++ standard, for instance, will compile and link fine but cause runtime issues in an production environment.
The text was updated successfully, but these errors were encountered: