-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Fix compilation under and enable C++20 #12658
Conversation
Taken from [release v1.9.1](https://github.com/CLIUtils/CLI11/releases/tag/v1.9.1), source commit | ||
[5cb3efa](https://github.com/CLIUtils/CLI11/commit/5cb3efabce007c3a0230e4cc2e27da491c646b6c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI In order to keep this PR compact I manually modified CLI11.hpp.
First I reformatted it with clang-format and then went through the file, reverting all irrelevant whitespace changes.
Without this basically the entire CLI11.hpp file would've been rewritten, since the original v1.9.0 uses a vastly different code format than the version we got.
@@ -12,7 +12,7 @@ | |||
#include <sddl.h> | |||
#include <wil/token_helpers.h> | |||
|
|||
static constexpr std::string_view Utf8Bom{ u8"\uFEFF" }; | |||
static constexpr std::string_view Utf8Bom{ "\xEF\xBB\xBF", 3 }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did we lose support for u8 literals? was that not a real c++ feature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea what's the deal here? was this just a happy accident that the compiler would translate \uFEFF
to the utf8 \xEF\xBB\xBF
, and now we're just being more explicit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a fallout from a breaking change in C++20 (source):
u8"s-char-sequence(optional)"
UTF-8 string literal. The type of a u8"..." string literal isconst char[N]
(until C++20)const char8_t[N]
(since C++20), whereN
is the size of the string in UTF-8 code units including the null terminator.
Breaking changes in the language; still no breaking ABI change in the STL. 🥲
#ifdef __cpp_lib_bit_cast | ||
#warning "Replace til::bit_cast and __builtin_bit_cast with std::bit_cast" | ||
#endif | ||
// TODO: Replace til::bit_cast and __builtin_bit_cast with std::bit_cast |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you'd like me to I can create an issue for this. I left it as a code-TODO since I personally consider this not particularly noteworthy. (I considered doing it as part of this PR, but I didn't want to burden us any more than necessary.)
4f9861c
to
e4003ae
Compare
[dd0d8e4](https://github.com/CLIUtils/CLI11/commit/dd0d8e4fe729e5b1110232c7a5c9566dad884686) | ||
|
||
Taken from [release v1.9.1](https://github.com/CLIUtils/CLI11/releases/tag/v1.9.1), source commit | ||
[5cb3efa](https://github.com/CLIUtils/CLI11/commit/5cb3efabce007c3a0230e4cc2e27da491c646b6c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if there is a cgmanifest.json in the cli11 folder plz update it to match this commit
@@ -12,7 +12,7 @@ | |||
#include <sddl.h> | |||
#include <wil/token_helpers.h> | |||
|
|||
static constexpr std::string_view Utf8Bom{ u8"\uFEFF" }; | |||
static constexpr std::string_view Utf8Bom{ "\xEF\xBB\xBF", 3 }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did we lose support for u8 literals? was that not a real c++ feature?
@@ -12,7 +12,7 @@ | |||
#include <sddl.h> | |||
#include <wil/token_helpers.h> | |||
|
|||
static constexpr std::string_view Utf8Bom{ u8"\uFEFF" }; | |||
static constexpr std::string_view Utf8Bom{ "\xEF\xBB\xBF", 3 }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea what's the deal here? was this just a happy accident that the compiler would translate \uFEFF
to the utf8 \xEF\xBB\xBF
, and now we're just being more explicit?
Hello @lhecker! Because this pull request has the Do note that I've been instructed to only help merge pull requests of this repository that have been opened for at least 8 hours, a condition that will be fulfilled in about 18 minutes. No worries though, I will be back when the time is right! 😉 p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
When Leonard updated CLI11 in #12658, he imported a version that no longer requires RTTI. Since CLI11 was the only reason we had enabled RTTI in any of our projects, we're finally able to turn it off. | | TerminalApp.dll | MSIX Package | | ------ | ---------------:| ------------:| | Before | 3180KiB | 6545KiB | | After | 1970KiB | 6426KiB | | Delta | **-1210KiB** | **-119KiB** |
When Leonard updated CLI11 in #12658, he imported a version that no longer requires RTTI. Since CLI11 was the only reason we had enabled RTTI in any of our projects, we're finally able to turn it off. | | TerminalApp.dll | MSIX Package | | ------ | ---------------:| ------------:| | Before | 3180KiB | 6545KiB | | After | 1970KiB | 6426KiB | | Delta | **-1210KiB** | **-119KiB** | (cherry picked from commit e682cda) Service-Card-Id: 85546966 Service-Version: 1.15
This commit enables
/std:c++20
for local development under VS17.Our CIs will continue to use VS16 and C++17 for now in order to reduce
the likelihood of regressions during the current development cycle.
It's expected that we'll migrate to VS17 soon, as this
is what conhost is already being built with anyways.
PR Checklist
Validation Steps Performed
/std:c++20
✅