-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
c_std, cpp_std: Change to a list of desired versions in preference order #10332
Conversation
xclaesse
commented
Apr 28, 2022
10e7e3c
to
a396a2c
Compare
Codecov Report
@@ Coverage Diff @@
## master #10332 +/- ##
==========================================
- Coverage 70.10% 65.32% -4.79%
==========================================
Files 218 203 -15
Lines 47689 43592 -4097
Branches 11368 9526 -1842
==========================================
- Hits 33434 28475 -4959
- Misses 11773 12854 +1081
+ Partials 2482 2263 -219 |
@dcbaker @eli-schwartz @jpakkane I know there are been recurrent requests for more flexible way of defining the std. What do you think about this proposal? Are there use-cases not covered? |
The first thing I thought about when reading this is, it seems like it might break any meson.build that does On second look, it seems like at evaluation time it always yields whichever one gets selected in the end? Clever... |
Yes exactly, that's the trick, you set a list but it selects just one. |
I don't see any blockers for merging this? Other than resolving conflicts and fixing mypy. |
It conflicts pretty bad #11280… I think getting rid of the individual functions is going the wrong way |
But I think that this is the right language change, I’m just not sure about the implementation |
And merged, so this needs fixing. |
Rebased. |
ed5001f
to
c5ba3aa
Compare
@dcbaker looks like you had a concern here |
I solved the conflicts and kept the functions in optinterpreter. |
The only place it can be set to False is from optinterpreter. Better check value there and deprecate string usage.
a9d0f26
to
639b8c2
Compare
Projects that prefer GNU C but can fallback to ISO C can now set for example `default_options: 'c_std=gnu11,c11'` and it will use gnu11 when available, fallback to c11 otherwise. It is an error only if none of the values are supported by the current compiler. This allows to deprecate gnuXX values from MSVC compiler, that means that `default_options: 'c_std=gnu11'` will now print warning with MSVC but still fallback to 'c11' value. No warning is printed if at least one of the values is valid, i.e. `default_options: 'c_std=gnu11,c11'`. In the future that deprecation warning will become an hard error because `c_std=gnu11` should mean GNU is required, for projects that cannot be built with MSVC for example.
The obvious question to this is whether this works only for this option or should it work for all options with choices? I don't think it should work with anything except this, but OTOH it does add a behavioural inconsistency (though a mild and arguably good in any case). |
@jpakkane I don't think we can do it for project options. The trick here is Meson selects which of the choices is used, so get_option() only return one value, but for project option you would have to return all values because only the project can select... Which is no different from a regular array option. I think it is a specific behavior for a very specific problem, I don't currently see how it could be generalized. |
I agree this should not be a generally available thing, but I suspect people are going to ask for it anyway, so it's better to be prepared. |
c++26 supoprt was added in mesonbuild#11986, but regressed in mesonbuild#10332 because the versions now get checked against the global _ALL_STDS list, and c++26 was missing there. Fix by adding c++26 to _ALL_STDS
c++26 support was added in mesonbuild#11986, but regressed in mesonbuild#10332 because the versions now get checked against the global _ALL_STDS list, and c++26 was missing there. Fix by adding c++26 to _ALL_STDS
c++26 support was added in mesonbuild#11986, but regressed in mesonbuild#10332 because the versions now get checked against the global _ALL_STDS list, and c++26 was missing there. Fix by adding c++26 to _ALL_STDS
c++26 support was added in mesonbuild#11986, but regressed in mesonbuild#10332 because the versions now get checked against the global _ALL_STDS list, and c++26 was missing there. Fix by adding c++26 to _ALL_STDS
c++26 support was added in mesonbuild#11986, but regressed in mesonbuild#10332 because the versions now get checked against the global _ALL_STDS list, and c++26 was missing there. Fix by adding c++26 to _ALL_STDS