Conversation
|
DMD/LDC can be ignored. They are D toolchains, not C++. |
modules/vstudio/vs2010_vcxproj.lua
Outdated
| elseif (cfg.cppdialect == "C++20") then | ||
| m.element("LanguageStandard", condition, iif(_ACTION == "vs2017", 'stdcpplatest', 'stdcpp20')) | ||
| elseif (cfg.cppdialect == "C++23") then | ||
| m.element("LanguageStandard", condition, 'stdcpp23') |
There was a problem hiding this comment.
We should probably figure out a better, long term way of handling this, but for now, please change 'stdcpp23' here to the iif statement above. I believe these statements should likely be <= 'vs2017' for C++20 and <= 'vs2019' for C++23.
In addition, this will require an additional test to be written in the vstudio module.
There was a problem hiding this comment.
I'll make the change but I'm curious what is the point of it? For example you might request C++23 on vs2017 and because you get c++latest instead, your code might not compile in a non-obvious way?
Wouldn't it be better to explicitly use C++23 and let vs2017 give an error if it does not support it? (Or have premake spit an error, but it's harder to know exactly what vs supports).
There was a problem hiding this comment.
I'm curious what is the point of it?
Consistency and scope. As @nickclark2016 said, we need to figure out a better, long term way of handling this. Your argument also applies to C++20 and vs2017, so it goes beyond the scope of this PR. Getting C++23 support in is a good first step, and we can just log an issue to deal with this remapping stuff.
There was a problem hiding this comment.
I just noticed that vs2022 doesn't actually support stdcpp23 yet, so we should probably change it to use stdcpplatest (ie. replace the <= 2019 by < 2022).
If that sounds OK, I can a new PR tonight.
There was a problem hiding this comment.
You could probably just make it emit stdcpplatest, either works. Does MSC support C++23, or will that also need to be changed?
There was a problem hiding this comment.
Oh that's a good catch. It does not.
and fix the language stardard selection on VS versions that don't support C++23
| cppdialect "C++2b" | ||
| prepare() | ||
| test.contains({ "-std=c++2b" }, gcc.getcxxflags(cfg)) | ||
| test.contains({ }, gcc.getcflags(cfg)) |
There was a problem hiding this comment.
I know it is the same as others, but test.contains({}, any_string) would always be true, and can be removed.
test.excludes({ "-std=c++2b"}, gcc.getcflags(cfg)) might make more sense though
There was a problem hiding this comment.
Nice catch @Jarod42, test.contains({}, ...) should trigger an error since it does nothing. I'll submit a PR that introduces an error for doing that, and fix up any existing instances of that. I think we can merge this as-is though.
Add support for C++23 **What does this PR do?** Adds support for C++23. **How does this PR change Premake's behavior?** By cherry-picking this [commit](premake@0a244e0) from premake#2277 and resolving conflicts to keep the diff minimal. **Anything else we should know?** Only tested on MacOS as that's the only platform I have access to. **Did you check all the boxes?** - [x] Focus on a single fix or feature; remove any unrelated formatting or code changes - [ ] Add unit tests showing fix or feature works; all tests pass - [x] Mention any [related issues](https://github.com/premake/premake-core/issues) (put `closes #XXXX` in comment to auto-close issue when PR is merged) - [x] Follow our [coding conventions]([https://github.com/premake/premake-core/blob/master/CONTRIBUTING.md#coding-conventions](https://github.com/premake/premake-core/blob/master/CONTRIBUTING.md#coding-conventions)) - [x] Minimize the number of commits *You can now [support Premake on our OpenCollective](https://opencollective.com/premake). Your contributions help us spend more time responding to requests like these!* JIRA: https://socialpoint.atlassian.net/browse/DCT-614
What does this PR do?
It adds C++23, C++2b, gnu++23 and gnu++2b to
cppdialect.How does this PR change Premake's behavior?
It adds the new values for cppdialect and changes the behavior of C++Latest to C++23 on several platforms. I used 4a627cc (which added C++20) as a model for what to do.
Some notes though:
Anything else we should know?
Closes #2273
Did you check all the boxes?
closes #XXXXin comment to auto-close issue when PR is merged)You can now support Premake on our OpenCollective. Your contributions help us spend more time responding to requests like these!