-
Notifications
You must be signed in to change notification settings - Fork 283
Fix build problems w/ fmt and C++23 #1102
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
base: main
Are you sure you want to change the base?
Conversation
MarkCallow
left a comment
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.
I have only the one question.
tools/ktx/command_compare.cpp
Outdated
| virtual std::string value(std::size_t index, OutputFormat format) const override { | ||
| if (format == OutputFormat::text) { | ||
| return fmt::format(fmt::format("0x{{:0{}x}}", sizeof(T) << 1), DiffBase<T>::rawValue(index)); | ||
| return fmt::format(fmt::runtime(fmt::format("0x{{:0{}x}}", sizeof(T) << 1)), DiffBase<T>::rawValue(index)); |
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.
What is the fmt::runtime for?
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.
It just turns off the compile-time checking of the format string for the outer format call. I basically added it whenever the format string was runtime-generated.
Actually, I think in this case, you can probably get away with just a single format call and get rid of fmt::runtime. AFAIK, fmt can deal with placeholders in placeholders just fine.
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.
I'd prefer if we can get rid of it.
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.
Ok, done.
Sorry. I did not pay proper attention to your description. I initially thought this was a problem this PR fixes. The issue is that c++20 supports the new |
|
The fix for the OutputStreamEx constructor for c++20 is now in main from PR #1103. Please rebase this. |
|
Ok, I rebased and removed that For Not sure what the intention is with those, since the type does not really seem movable? But it's an external anyways, so I'm not sure whether you want that fixed. For I think the return type should be |
Sorry for the stupid copy and paste error. The return type should indeed be std::u8string. Please fix it in this PR.
Sorry about that too. I started implementation in command.cpp but when I realized it would simply convert the input and call the other constructor I moved it to the class definition. I do not understand how everything built in our CI. All of the libktx tests use c++20 and two of them include I have fixed the InputStream and fmtInFile issues. Please see the c++fixes branch for the fixes. I am leaving tomorrow for a 10-day trip. I'm not sure I will have time to merge this to main before I leave. Should I not, please feel free to include the fixes directly in this PR. I won't run the workflows until the fixes are in this PR. I could not thoroughly test building the ktx tool with the above changes because of all the fmt related issues whose fixes are in this PR. As for the C++23 issue with |
The fixes are merged. See PR #1104. |
|
Great! It works for C++17 and C++20 for me now, C++23 if I fix or disable (via |
|
Interestingly, it seems like you already reported the build problem in basisu a while ago: BinomialLLC/basis_universal#366 |
PR for Issue #1101
Pretty superficial fixes, e.g. formatOptionalFileOffset could probably be refactored to work without fmt::runtime, but this was less invasive.
Unfortunately, it doesn't compile with C++ 20 and 23 for me anymore after I rebased onto main, but due to different problems, i.e.:
I don't know how to proceed there. You seem to have put some thought into utf8 handling and might better know how to fix that one.