-
Notifications
You must be signed in to change notification settings - Fork 968
Move to C++20 #16077
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: master
Are you sure you want to change the base?
Move to C++20 #16077
Conversation
…en though the second is reversed Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
…an incomplete class Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
58483c0
to
f9e42a3
Compare
Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
Do we really want to move to C++20 at this point? Do you see any benefit in switching to that standard? (also be warned that if this happens, I will introduce and use spaceship operators in the code) |
Pull Request Test Coverage Report for Build 17551617099Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
Nothing dramatic, a few things nice to have, see https://en.cppreference.com/w/cpp/20.html |
@Habbie @rgacogne @pieterlexis any opinions on the matter? Code changes needed are fairly minimal and we get a few nice features, so I am inclined to go for C++20, but I won't press it. |
I was just mentioning to Otto yesterday that us not being on ++20 has not stopped you from doing three way compares, but that they would look more fun in 20 :) |
pdns/dnsdistdist/meson.build
Outdated
'buildtype=debugoptimized', | ||
'warning_level=2', # TODO Move this to 3 to enable -Wpedantic | ||
'cpp_std=c++17', | ||
'cpp_std=c++20', |
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.
while we're here, I'd love to switch this to gnu++20, which improves portability (at least to Haiku, perhaps also other OSes)
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.
As long as clang does the right thing...
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 believe it does, but it deserves the same amount of testing you did for this PR. We can also do it separately. None of our currently shipping targets care about the difference anyway.
The code changes look entirely acceptable to me. I have no objections to the move. |
I have no issues with moving to C++20 :) |
Moving to C++20 sounds like a good idea to me. Do we need to test some additional distributions, like CentOS/Amazon Linux/etc? |
Doesn't the CI run test these systems already? Or maybe you should trigger a tentative package build and see how well it fares. |
I tested a few, see above. |
But not the ones tested by https://github.com/PowerDNS/pdns/blob/master/.github/workflows/builder.yml, right? |
Nope, there's no convenient button to test a specific branch there. Do you know an easy way to test this branch? |
It is a reusable workflow but there does not seem to be any dispatcher for it. Give me a sec. |
Thanks, so the only thing left open is the warnings from |
For the |
I'm also OK with switching dnsdist to |
This is going to be problematic, as clang's libc++ does not seem to support that yet: https://en.cppreference.com/w/cpp/20.html search for "Atomic std::shared_ptr " So the situation is: using GCC libstdc++ it will nag about using a deprecated feature, but we cannot switch until |
This is great.. I wonder if we can detect whether support is available without too much hassle. |
C++20 comes with feature detection macros: https://en.cppreference.com/w/cpp/experimental/feature_test.html, |
Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
As said in the commit message: I'm not really happy with the last commit. Soliciting feedback before going further on this road. WATCH OUT: only compile tested as well. So move to Draft. |
001bdc3
to
2f41821
Compare
pdns/tcpiohandler.cc
Outdated
auto tmp = parentLoad(); | ||
if (tmp) { |
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.
auto tmp = parentLoad(); | |
if (tmp) { | |
if (auto tmp = parentLoad(); tmp) { |
pdns/tcpiohandler.hh
Outdated
auto tmp = load(); | ||
if (tmp) { |
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.
auto tmp = load(); | |
if (tmp) { | |
if (auto tmp = load(); tmp) { |
This might inded become error-prone if someone adds/edits code without realizing there are two possible code paths to use depending on library support. |
Agreed. The options I see are:
|
I think we can live with the deprecation warnings until it itches too much for somebody. |
… e.g. Suse and Haiku easier. Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
2f41821
to
0aacc6c
Compare
It turns out that both dnsdist and auth still have trouble building on el-8 and bullseye. See https://github.com/omoerbeek/pdns/actions/runs/17548656275 and https://github.com/omoerbeek/pdns/actions/runs/17548660109. Did not look into bullseye yet. The issues might be the same as el-8 or not. |
until 3a03e2d, pdns.spec had:
which apparently was enough |
That worked! So I have dnsdist and auth now also building on el-8 locally. bullseye shows for auth:
|
dnsdist on bulleye also goes wrong:
|
I'll commit what I have now. bullseye seems to be a road block until somebody finds some time.. |
Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
Short description
Fixes #14734
Currently running test package builds: all fine (see https://github.com/omoerbeek/pdns/actions/runs/17457993427)
Checklist
I have:
A few compare calls needed to be made explicit to avoid on trixie clang 19:
One set of warnings remain on trixie using clang 19: