-
Notifications
You must be signed in to change notification settings - Fork 38.7k
build: Suppress -Wdeprecated-copy warnings #18738
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
Conversation
|
|
Is there a way to only add this flag when a file is compiled in the |
Unfortunately, it does not help. Warnings are emitted from It seems @Empact's 422dcd5 from #14920 or @vasild's c9376ae from #18149 could help, no? |
|
The warnings are emitted when compiling our So compiling (in this example rcpconsole.cpp) with |
|
@MarcoFalke mind looking into https://github.com/hebasto/bitcoin/commits/pr18738.02 ? |
Concept ACK |
But it does not work (comment) 😕 UPDATE: I found bugs in my solution :) |
|
Updated 0025d09 -> 710a072 (pr18738.01 -> pr18738.03, diff):
|
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsNo conflicts as of last run. |
|
Updated 710a072 -> d69174c (pr18738.03 -> pr18738.04, diff):
|
Yes, we can compile Why imperfect? Because it would also suppress warnings from our code that is in How can we do better? We can tell the compiler to suppress warnings from headers located in a particular directory:
Those two commits are actually the same thing. I will submit it as a separate PR, isolated from other changes contained in the above PRs. |
Here it is: #18750 |
|
I see make src/bitcoind -j8
...
In file included from addrman.cpp:6:
In file included from ./addrman.h:15:
In file included from ./util/system.h:20:
In file included from ./fs.h:14:
In file included from /usr/local/include/boost/filesystem.hpp:16:
In file included from /usr/local/include/boost/filesystem/path.hpp:32:
/usr/local/include/boost/io/detail/quoted_manip.hpp:62:23: warning: definition of implicit copy constructor for 'quoted_proxy<const std::__1::basic_string<char> &, char>' is deprecated because it has a user-declared copy assignment operator [-Wdeprecated-copy]
quoted_proxy& operator=(const quoted_proxy&); // = deleted
^
/usr/local/include/boost/io/detail/quoted_manip.hpp:166:14: note: in implicit copy constructor for 'boost::io::detail::quoted_proxy<const std::__1::basic_string<char> &, char>' first required here
return detail::quoted_proxy<std::basic_string<Char, Traits, Alloc> const &, Char>
^
/usr/local/include/boost/filesystem/path.hpp:827:21: note: in instantiation of function template specialization 'boost::io::quoted<char, std::__1::char_traits<char>, std::__1::allocator<char> >' requested here
<< boost::io::quoted(p.template string<std::basic_string<Char> >(), static_cast<Char>('&'));
^
./tinyformat.h:358:13: note: in instantiation of function template specialization 'boost::filesystem::operator<<<char, std::__1::char_traits<char> >' requested here
out << value;
^
./tinyformat.h:543:13: note: in instantiation of function template specialization 'tinyformat::formatValue<boost::filesystem::path>' requested here
formatValue(out, fmtBegin, fmtEnd, ntrunc, *static_cast<const T*>(value));
^
./tinyformat.h:519:27: note: in instantiation of function template specialization 'tinyformat::detail::FormatArg::formatImpl<boost::filesystem::path>' requested here
m_formatImpl(&formatImpl<T>),
^
./tinyformat.h:975:32: note: (skipping 1 context in backtrace; use -ftemplate-backtrace-limit=0 to see all)
m_formatterStore { FormatArg(args)... }
^
./tinyformat.h:1028:12: note: in instantiation of function template specialization 'tinyformat::detail::FormatListN<2>::FormatListN<boost::filesystem::path, int>' requested here
return detail::FormatListN<sizeof...(args)>(args...);
^
./tinyformat.h:1064:23: note: in instantiation of function template specialization 'tinyformat::makeFormatList<boost::filesystem::path, int>' requested here
vformat(out, fmt, makeFormatList(args...));
^
./tinyformat.h:1073:5: note: in instantiation of function template specialization 'tinyformat::format<boost::filesystem::path, int>' requested here
format(oss, fmt, args...);
^
./logging.h:169:28: note: in instantiation of function template specialization 'tinyformat::format<boost::filesystem::path, int>' requested here
log_msg = tfm::format(fmt, args...);
^
addrman.cpp:638:5: note: in instantiation of function template specialization 'LogPrintf<boost::filesystem::path, int>' requested here
LogPrintf("Opened asmap file %s (%d bytes) from disk\n", path, length);
^
1 warning generated.So if we are going to suppress these I don't think it should be qt specific. |
|
@fanquake I can see these |
|
So it seems this warning is not yet ready for general use. I guess we can disable it for 0.21.0. Hopefully removing boost in 0.22.0 will also make the warnings go away and we can turn it back on. |
|
Reverted back d69174c -> 0025d09 (pr18738.04 -> pr18738.01):
|
|
The commit message needs updating as well. |
|
Updated 0025d09 -> 0c63f80 (pr18738.01 -> pr18738.05, diff):
|
|
ACK 0c63f80 seems fine to disable this warning for the 0.21.0 release temporarily and then enable it for 0.22.0, when boost is removed. |
|
@MarcoFalke Is it worth backporting to 0.20 branch before rc2 for neat user experience on Ubuntu Focal? |
|
cc @fanquake ^ |
fanquake
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.
ACK 0c63f80 - I think it's ok to suppress these for now, given that -Wdeprecated-copy is enabled (via -Wextra) in GCC 9 and Clang 10. The Qt output is pretty noisy, and there's a few warnings from Boost as well.
|
Backport to 0.20? |
0c63f80 build: Suppress -Wdeprecated-copy warnings (Hennadii Stepanov) Pull request description: Tomorrow, on Apr 23 the Ubuntu 20.04 release is expected. It packaged with Qt 5.12 LTS that has a nasty peculiarity to cause modern compilers, including Clang 10.0 and GCC 9.3, to emit spammy `-Wdeprecated-copy` warnings (bitcoin#15822, bitcoin#18419). This PR suppress such warnings _temporarily_, until the [upstream is fixed](https://codereview.qt-project.org/c/qt/qtbase/+/272258). Here are some affected systems (with system packages): - Ubuntu 20.04 LTS + Qt 5.12.8 LTS + { Clang 10.0 | GCC 9.3 } - Fedora 32 + Qt 5.13.2 + Clang 10.0 Reference: [QTBUG-75210](https://bugreports.qt.io/browse/QTBUG-75210) Also see **fanquake**'s [comment](bitcoin#18738 (comment)). ACKs for top commit: MarcoFalke: ACK 0c63f80 seems fine to disable this warning for the 0.21.0 release temporarily and then enable it for 0.22.0, when boost is removed. fanquake: ACK 0c63f80 - I think it's ok to suppress these for now, given that `-Wdeprecated-copy` is enabled (via `-Wextra`) in GCC 9 and Clang 10. The Qt output is pretty noisy, and there's a few warnings from Boost as well. Tree-SHA512: 7064a3272bc9eae00b73a16c421ac58be148f374cbef87320e8f092f52761f6e98166eff60346b70867f8a69a9698a79455dc16b42d92f8fbe7c56519571ac08
ae41ebe Remove redundant explicitly defined copy ctors (Dan Raviv) 454aa37 Trivial: explicit (default) copy-constructor for CTransaction (random-zebra) 2af2306 Cleanup: Remove redundant copy-constructor for CSignedMessage (random-zebra) e28259d Masternode: proper copy-assignment for CMasternode/CmasternodePing (random-zebra) Pull request description: Fix the `-Wdeprecated-copy` warnings listed in #2076 **Background** While perfectly valid in C++98, implicit generation of the copy constructor is declared as deprecated in C++11, when there is already a user-defined copy assignment operator, or vice-versa. The rationale behind this is the "rule of three" (https://en.cppreference.com/w/cpp/language/rule_of_three) > If a class requires a user-defined destructor, a user-defined copy constructor, or a user-defined copy assignment operator, it almost certainly requires all three. **Issue - Fix** We have several places that define redundant copy assignment operators (and then use the implicit copy constructor), or that do need non-default ctors/dtors but don't define copy assignment. (See also bitcoin#11161, which is also cherry-picked here) Specifically: - `CSignedMessage`/`CMasternodePing`/`CMasternode` use a weird copy-assignment that *swaps* with the argument (which, of course, cannot be "const" then). Here we remove all ::swap implementations, and provide actual copy assignment operators. - `CTransaction` has an explicit copy-assignment operator, but uses the implicit copy-ctor in `CMerkleTx` constructor. - `CFeeRate` and `CTxMemPoolEntry` have explicitly defined copy ctor, which can (and should, for the rule-of-three) be replaced by the default one (bitcoin#11161). **Note** Reason why these warnings pop up just now. Since Clang 10.0 and GCC 9.3, `-Wextra` enables `-Wdeprecated-copy` by default, and that is very spammy, especially when compiling with the QT GUI (bitcoin#15822 / bitcoin#18419). It is so spammy (also with `boost-1.72.0`) that Bitcoin decided to temporarily suppress this warning (bitcoin#18738) until QT fixes it upstream, and boost is definitely removed in 0.22 (bitcoin#18967) ACKs for top commit: furszy: utACK ae41ebe Tree-SHA512: 1f59f9f7426abbf4b7d4bb0d1ac50491eb52f776e2a018de3acc8ab381af3b69db6b9a5b60c04b48f0d495e560eaa1e3d19be03d133f230daca66ba66e766289
0c63f80 build: Suppress -Wdeprecated-copy warnings (Hennadii Stepanov) Pull request description: Tomorrow, on Apr 23 the Ubuntu 20.04 release is expected. It packaged with Qt 5.12 LTS that has a nasty peculiarity to cause modern compilers, including Clang 10.0 and GCC 9.3, to emit spammy `-Wdeprecated-copy` warnings (bitcoin#15822, bitcoin#18419). This PR suppress such warnings _temporarily_, until the [upstream is fixed](https://codereview.qt-project.org/c/qt/qtbase/+/272258). Here are some affected systems (with system packages): - Ubuntu 20.04 LTS + Qt 5.12.8 LTS + { Clang 10.0 | GCC 9.3 } - Fedora 32 + Qt 5.13.2 + Clang 10.0 Reference: [QTBUG-75210](https://bugreports.qt.io/browse/QTBUG-75210) Also see **fanquake**'s [comment](bitcoin#18738 (comment)). ACKs for top commit: MarcoFalke: ACK 0c63f80 seems fine to disable this warning for the 0.21.0 release temporarily and then enable it for 0.22.0, when boost is removed. fanquake: ACK 0c63f80 - I think it's ok to suppress these for now, given that `-Wdeprecated-copy` is enabled (via `-Wextra`) in GCC 9 and Clang 10. The Qt output is pretty noisy, and there's a few warnings from Boost as well. Tree-SHA512: 7064a3272bc9eae00b73a16c421ac58be148f374cbef87320e8f092f52761f6e98166eff60346b70867f8a69a9698a79455dc16b42d92f8fbe7c56519571ac08
Should have been fixed with gridcoin-community#1702 Ref: bitcoin/bitcoin#18738
0c63f80 build: Suppress -Wdeprecated-copy warnings (Hennadii Stepanov) Pull request description: Tomorrow, on Apr 23 the Ubuntu 20.04 release is expected. It packaged with Qt 5.12 LTS that has a nasty peculiarity to cause modern compilers, including Clang 10.0 and GCC 9.3, to emit spammy `-Wdeprecated-copy` warnings (bitcoin#15822, bitcoin#18419). This PR suppress such warnings _temporarily_, until the [upstream is fixed](https://codereview.qt-project.org/c/qt/qtbase/+/272258). Here are some affected systems (with system packages): - Ubuntu 20.04 LTS + Qt 5.12.8 LTS + { Clang 10.0 | GCC 9.3 } - Fedora 32 + Qt 5.13.2 + Clang 10.0 Reference: [QTBUG-75210](https://bugreports.qt.io/browse/QTBUG-75210) Also see **fanquake**'s [comment](bitcoin#18738 (comment)). ACKs for top commit: MarcoFalke: ACK 0c63f80 seems fine to disable this warning for the 0.21.0 release temporarily and then enable it for 0.22.0, when boost is removed. fanquake: ACK 0c63f80 - I think it's ok to suppress these for now, given that `-Wdeprecated-copy` is enabled (via `-Wextra`) in GCC 9 and Clang 10. The Qt output is pretty noisy, and there's a few warnings from Boost as well. Tree-SHA512: 7064a3272bc9eae00b73a16c421ac58be148f374cbef87320e8f092f52761f6e98166eff60346b70867f8a69a9698a79455dc16b42d92f8fbe7c56519571ac08
Tomorrow, on Apr 23 the Ubuntu 20.04 release is expected. It packaged with Qt 5.12 LTS that has a nasty peculiarity to cause modern compilers, including Clang 10.0 and GCC 9.3, to emit spammy
-Wdeprecated-copywarnings (#15822, #18419).This PR suppress such warnings temporarily, until the upstream is fixed.
Here are some affected systems (with system packages):
Reference: QTBUG-75210
Also see fanquake's comment.