Skip to content
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 building transmission with C++23 #6832

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

nevack
Copy link
Member

@nevack nevack commented May 7, 2024

No description provided.

@nevack nevack requested a review from tearfur May 7, 2024 12:45
Copy link
Member

@tearfur tearfur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this exhaustive? I haven't tried, but translatable strings wrapped in _() probably needs fmt::runtime() too.

@nevack
Copy link
Member Author

nevack commented May 8, 2024

Is this exhaustive? I haven't tried, but translatable strings wrapped in _() probably needs fmt::runtime() too.

As I said, I haven't touched UI code in gtk/ and qt/

Only libtransmission and cli are updated

@tearfur
Copy link
Member

tearfur commented May 8, 2024

There are a bunch of translatable strings in libtransmission too. For example:

tr_logAddWarn(
fmt::format(
_("Couldn't parse announce response: {error} ({error_code})"),
fmt::arg("error", error.message()),
fmt::arg("error_code", error.code())),
log_name);

@nevack
Copy link
Member Author

nevack commented May 8, 2024

For example:

My bad, I don't have HAVE_GETTEXT, so #define _(a) (a).

We can merge this one as it is, and I will fix other issues in later PRs with the help of my Linux machine.
Or I can convert this one to draft and incrementally fix building any other possible configurations.
I do not have any preference on this.

@tearfur
Copy link
Member

tearfur commented May 8, 2024

I'd say do it in one go, but you decide whatever works for you :)

@mikedld
Copy link
Member

mikedld commented May 10, 2024

How are we guaranteeing that this won't break tomorrow, given that we're still on C++17?

@nevack
Copy link
Member Author

nevack commented May 14, 2024

How are we guaranteeing that this won't break tomorrow, given that we're still on C++17?

I can add workflow for that, but it must be optional for now.

I convert this PR to draft and will add more fixes while thinking how to check this on CI.

@nevack nevack marked this pull request as draft May 14, 2024 19:03
@nevack nevack changed the title Fix building libtransmission/ and utils/ with C++20 and C++23 Fix building transmission with C++23 May 19, 2024
@nevack nevack force-pushed the nevack/fix-std20-std23-fmt branch 2 times, most recently from 7931ac3 to bb2feaa Compare May 19, 2024 23:19
@nevack nevack requested a review from tearfur May 20, 2024 18:06
@nevack
Copy link
Member Author

nevack commented May 20, 2024

@tearfur You were right, I missed a lot of issues with fmt strings on the first iteration.
Should be fixed now.

Copy link
Member

@tearfur tearfur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice that you have made the changes to qt and gtk too!

CMakeLists.txt Outdated Show resolved Hide resolved
libtransmission/peer-mse.cc Outdated Show resolved Hide resolved
qt/Application.h Outdated Show resolved Hide resolved
@nevack nevack force-pushed the nevack/fix-std20-std23-fmt branch 4 times, most recently from 1028e5b to 1d9ac88 Compare May 22, 2024 20:52
Fixes build error with C++20/C++23

error: return type 'auto' of selected 'operator==' function for rewritten '!=' comparison is not 'bool'

Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com>
Fixes building with C++20/C++23
error: no matching function for call to 'size'
function 'size' with deduced return type cannot be used before it is defined

Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com>
fmt::format_string ctor is consteval with C++20
See fmtlib/fmt#2438

Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com>
Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com>
Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com>
Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com>
Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com>
Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com>
@nevack nevack force-pushed the nevack/fix-std20-std23-fmt branch from 1d9ac88 to 3676a8c Compare May 22, 2024 21:39
@nevack nevack marked this pull request as ready for review May 22, 2024 21:40
@ckerr ckerr added needs update The PR has needs to be updated by the submitter type:refactor A code change that neither fixes a bug nor adds a feature notes:none Should not be listed in release notes labels May 26, 2024
Copy link
Member

@mikedld mikedld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks quite intrusive. Since we moved away from FMT_STRING() (or whatever it was called) some time ago, which was intrusive as well, I wonder if there's an option in libfmt to differentiate automatically based on the type of argument being either char const* or char const[N]...

@ckerr, anything specific you had in mind when adding needs update label other than syncing the PR with current main to resolve conflicts?

@@ -990,3 +990,80 @@ jobs:
working-directory: ./android
run: |
gradle build

ubuntu-24-04-from-tarball-cxx-23:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I think we have enough from-tarball configurations as is, since this one doesn't exactly need to prove that it builds specifically from a tarball we can speed feedback up by building from git clone instead to not block on tarball generation job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs update The PR has needs to be updated by the submitter notes:none Should not be listed in release notes type:refactor A code change that neither fixes a bug nor adds a feature
Development

Successfully merging this pull request may close these issues.

None yet

4 participants