This PR is related to bitcoin/bitcoin#24169. It adjusts code in order to avoid -Wdeprecated-enum-enum-conversion
warnings instead of disabling them.
Could be tested with gcc 11.2.
This PR is related to bitcoin/bitcoin#24169. It adjusts code in order to avoid -Wdeprecated-enum-enum-conversion
warnings instead of disabling them.
Could be tested with gcc 11.2.
448@@ -449,6 +449,7 @@ if test "$CXXFLAGS_overridden" = "no"; then
449 [AC_LANG_SOURCE([[struct A { virtual void f(); }; struct B : A { void f() final; };]])])
450 AX_CHECK_COMPILE_FLAG([-Wunreachable-code-loop-increment], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wunreachable-code-loop-increment"], [], [$CXXFLAG_WERROR])
451 AX_CHECK_COMPILE_FLAG([-Wimplicit-fallthrough], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wimplicit-fallthrough"], [], [$CXXFLAG_WERROR])
452+ AX_CHECK_COMPILE_FLAG([-Wdeprecated-enum-enum-conversion], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wdeprecated-enum-enum-conversion"], [], [$CXXFLAG_WERROR])
-Wenum-conversion
, which is part of -Wextra
, which we already enable. Although in that case it may only be applied to C code.
I presume it is not enabled by default in C++17
Correct.
It’s enabled by default in Clang, which should be good enough coverage for us.
For me it is only enabled with c++20. Do you have steps to reproduce?
Do you have steps to reproduce?
No. I assumed Clang might be enabling with any standard, given they don’t specify otherwise, like GCC does. However, I’m still a NACK on adding this. It’s already enabled by default when it’s needed, it’s only available on fairly “new” compilers, so having everyone building with older ones check for availability is pointless, and I’d prefer that our configure checks don’t return to being a grab-bag of checks for random flags. In any case, given the only existence of warning producing code, are a few instances in the GUI, I’d say the likelihood of any warning producing code being introduced is a also very low.
I’m still a NACK on adding this.
An additional minor pro for adding this line is simplicity of testing this PR by reviewers using gcc.
An additional minor pro for adding this line is simplicity of testing this PR by reviewers using gcc.
I don’t really think we should be adding warning flags to our build system for the sake of making testing PRs easier. If anyone wants to test this change, they can do ./configure CXXFLAGS="-Wdeprecated-enum-enum-conversion"
using a compiler that supports the option.
251@@ -251,28 +252,28 @@ void BitcoinGUI::createActions()
252 overviewAction->setStatusTip(tr("Show general overview of wallet"));
253 overviewAction->setToolTip(overviewAction->statusTip());
254 overviewAction->setCheckable(true);
255- overviewAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_1));
256+ overviewAction->setShortcut(QKeySequence(tr("Alt+1")));
tr
used to mark messages for translation? If yes, why is this needed here? If this is needed to convert to QString
, why not call QString{}
instead?
Isn’t
tr
used to mark messages for translation?
Yes, it is.
If yes, why is this needed here? If this is needed to convert to
QString
, why not callQString{}
instead?
No need for translation here. Updated in the recent push.
Thanks!
251@@ -251,28 +252,28 @@ void BitcoinGUI::createActions()
252 overviewAction->setStatusTip(tr("Show general overview of wallet"));
253 overviewAction->setToolTip(overviewAction->statusTip());
254 overviewAction->setCheckable(true);
255- overviewAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_1));
256+ overviewAction->setShortcut(QKeySequence(QString{"Alt+1"}));
0fea3846d0d6ec69dadd8bf043afd3c25971d07f
nit, here and below, use QStringLiteral
, see https://doc.qt.io/qt-5/qstring.html#more-efficient-string-construction
414@@ -414,7 +415,7 @@ void bringToFront(QWidget* w)
415
416 void handleCloseWindowShortcut(QWidget* w)
417 {
418- QObject::connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), w), &QShortcut::activated, w, &QWidget::close);
419+ QObject::connect(new QShortcut(QKeySequence(QShortcut::tr("Ctrl+W")), w), &QShortcut::activated, w, &QWidget::close);
0fea3846d0d6ec69dadd8bf043afd3c25971d07f
QObject::tr()
This is recommended by Qt docs.
See: https://doc.qt.io/qt-5/qkeysequence.html#details
Also this change avoids -Wdeprecated-enum-enum-conversion warnings.
Updated 38cffbb301e8d2ddf8dbc12afee99e76d8b54ebd -> 103b8dd8b89c772b7f6d097383e83d742b5ed55c (pr24624.03 -> pr24624.04, diff):
Can you explain why any of this needs translation? Is it displayed anywhere to the user?
Updated 103b8dd8b89c772b7f6d097383e83d742b5ed55c -> acd98adaf1d83b71eda235c49d41a92f30c16313 (pr24624.04 -> pr24624.05, diff):
Approach ACK acd98adaf1d83b71eda235c49d41a92f30c16313
For testing locally, #24169 will need to be merged. Edit: Or ./configure CXXFLAGS="-Wdeprecated-enum-enum-conversion"
, according to #24624 (review)
hebasto
fanquake
MarcoFalke
promag
Labels
Build system