gui: Building with gcc 9 prints a trillion warnings (-Wdeprecated-copy) #15822

issue MarcoFalke openend this issue on April 15, 2019
  1. MarcoFalke commented at 7:03 pm on April 15, 2019: member

    Some of them are legitimate, but others are in upstream library headers from qt (5.12.1-1.fc30)

    The version of gcc I was using:

    0$ gcc --version
    1gcc (GCC) 9.0.1 20190312 (Red Hat 9.0.1-0.10)
    2Copyright (C) 2019 Free Software Foundation, Inc.
    

    There has been a recent fixup (https://github.com/gcc-mirror/gcc/commit/482bd38ed8984aad9b1560405e7b3d775c194ccd). The date suggests that this was fixed in the version of gcc I was using, but the warnings are still printed.

    Some example warnings:

     0/usr/include/qt5/QtWidgets/qstyleoption.h: In member function QStyleOptionGroupBox& QStyleOptionGroupBox::operator=(const QStyleOptionGroupBox&):
     1/usr/include/qt5/QtWidgets/qstyleoption.h:626:24: warning: implicitly-declared QStyleOptionComplex& QStyleOptionComplex::operator=(const QStyleOptionComplex&) is deprecated [-Wdeprecated-copy]
     2  626 | class Q_WIDGETS_EXPORT QStyleOptionGroupBox : public QStyleOptionComplex
     3      |                        ^~~~~~~~~~~~~~~~~~~~
     4/usr/include/qt5/QtWidgets/qstyleoption.h:510:5: note: because QStyleOptionComplex has user-provided QStyleOptionComplex::QStyleOptionComplex(const QStyleOptionComplex&)
     5  510 |     QStyleOptionComplex(const QStyleOptionComplex &other) : QStyleOption(Version, Type) { *this = other; }
     6      |     ^~~~~~~~~~~~~~~~~~~
     7/usr/include/qt5/QtWidgets/qstyleoption.h: In copy constructor QStyleOptionGroupBox::QStyleOptionGroupBox(const QStyleOptionGroupBox&):
     8/usr/include/qt5/QtWidgets/qstyleoption.h:640:108: note: synthesized method QStyleOptionGroupBox& QStyleOptionGroupBox::operator=(const QStyleOptionGroupBox&) first required here
     9  640 |     QStyleOptionGroupBox(const QStyleOptionGroupBox &other) : QStyleOptionComplex(Version, Type) { *this = other; }
    10      |                                                                                                            ^~~~~
    11/usr/include/qt5/QtWidgets/qstyleoption.h: In copy constructor QStyleOptionSizeGrip::QStyleOptionSizeGrip(const QStyleOptionSizeGrip&):
    12/usr/include/qt5/QtWidgets/qstyleoption.h:654:108: warning: implicitly-declared QStyleOptionSizeGrip& QStyleOptionSizeGrip::operator=(const QStyleOptionSizeGrip&) is deprecated [-Wdeprecated-copy]
    13  654 |     QStyleOptionSizeGrip(const QStyleOptionSizeGrip &other) : QStyleOptionComplex(Version, Type) { *this = other; }
    14      |                                                                                                            ^~~~~
    15/usr/include/qt5/QtWidgets/qstyleoption.h:654:5: note: because QStyleOptionSizeGrip has user-provided QStyleOptionSizeGrip::QStyleOptionSizeGrip(const QStyleOptionSizeGrip&)
    16  654 |     QStyleOptionSizeGrip(const QStyleOptionSizeGrip &other) : QStyleOptionComplex(Version, Type) { *this = other; }
    17      |     ^~~~~~~~~~~~~~~~~~~~
    18/usr/include/qt5/QtWidgets/qstyleoption.h: In member function QStyleOptionSizeGrip& QStyleOptionSizeGrip::operator=(const QStyleOptionSizeGrip&):
    19/usr/include/qt5/QtWidgets/qstyleoption.h:645:24: warning: implicitly-declared QStyleOptionComplex& QStyleOptionComplex::operator=(const QStyleOptionComplex&) is deprecated [-Wdeprecated-copy]
    20  645 | class Q_WIDGETS_EXPORT QStyleOptionSizeGrip : public QStyleOptionComplex
    21      |                        ^~~~~~~~~~~~~~~~~~~~
    22...
    
  2. MarcoFalke added the label Build system on Apr 15, 2019
  3. MarcoFalke added the label good first issue on Apr 15, 2019
  4. practicalswift commented at 2:01 pm on April 17, 2019: contributor

    FWIW: Warnings from gcc compiled from trunk –

     0$ gcc (GCC) 9.0.1 20190417 (experimental)
     1Copyright (C) 2019 Free Software Foundation, Inc.
     2This is free software; see the source for copying conditions.  There is NO
     3warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     4
     5$ make 2>&1 | grep "warning: " | grep -vE '(^/usr|leveldb)'
     6interfaces/chain.cpp:263:25: warning: redundant move in return statement [-Wredundant-move]
     7interfaces/wallet.cpp:251:25: warning: redundant move in return statement [-Wredundant-move]
     8psbt.cpp:319:19: warning: implicitly-declared PartiallySignedTransaction& PartiallySignedTransaction::operator=(const PartiallySignedTransaction&) is deprecated [-Wdeprecated-copy]
     9psbt.cpp:341:1: warning: control reaches end of non-void function [-Wreturn-type]
    10wallet/wallettool.cpp:62:25: warning: catching polymorphic type const class std::runtime_error by value [-Wcatch-value=]
    
  5. MarcoFalke commented at 2:02 pm on April 17, 2019: member
    @practicalswift So, fedora has an old gcc-9, it seems. Albeit the version claims otherwise.
  6. MarcoFalke commented at 2:09 pm on April 17, 2019: member

    No, this can be reproduced on fedora:30 and debian:experimental

    Debian gcc version:

    0# g++-9 --version
    1g++-9 (Debian 9-20190402-1) 9.0.1 20190402 (experimental) [trunk revision 270074]
    2Copyright (C) 2019 Free Software Foundation, Inc.
    
     0# make -j 9 src/qt/bitcoin-qt
     1make -C src qt/bitcoin-qt
     2make[1]: Entering directory '/root/bitcoin/src'
     3make[2]: Entering directory '/root/bitcoin'
     4make[2]: Leaving directory '/root/bitcoin'
     5  CXX      qt/libbitcoinqt_a-moc_walletmodel.o
     6In file included from /usr/include/x86_64-linux-gnu/qt5/QtGui/qevent.h:50,
     7                 from /usr/include/x86_64-linux-gnu/qt5/QtGui/QList:1,
     8                 from ./qt/paymentrequestplus.h:19,
     9                 from ./qt/walletmodel.h:18,
    10                 from qt/moc_walletmodel.cpp:8:
    11/usr/include/x86_64-linux-gnu/qt5/QtCore/qvariant.h: In constructor 'QVariant::QVariant(QVariant&&)':
    12/usr/include/x86_64-linux-gnu/qt5/QtCore/qvariant.h:273:25: warning: implicitly-declared 'QVariant::Private& QVariant::Private::operator=(const QVariant::Private&)' is deprecated [-Wdeprecated-copy]
    13  273 |     { other.d = Private(); }
    14      |                         ^
    15/usr/include/x86_64-linux-gnu/qt5/QtCore/qvariant.h:399:16: note: because 'QVariant::Private' has user-provided 'QVariant::Private::Private(const QVariant::Private&)'
    16  399 |         inline Private(const Private &other) Q_DECL_NOTHROW
    17      |                ^~~~~~~
    18  AR       qt/libbitcoinqt.a
    19  CXXLD    qt/bitcoin-qt
    20make[1]: Leaving directory '/root/bitcoin/src'
    
  7. MarcoFalke commented at 2:15 pm on April 17, 2019: member
    @practicalswift Are you sure you are compiling the gui?
  8. MarcoFalke removed the label good first issue on Apr 17, 2019
  9. MarcoFalke added the label Upstream on Apr 17, 2019
  10. practicalswift commented at 3:07 pm on April 17, 2019: contributor

    @MarcoFalke Please note that I excluded warnings for /usr and leveldb to show only the project local warnings of which one is -Wdeprecated-copy:

    0$ make 2>&1 | grep "warning: " | grep -vE '(^/usr|leveldb)'
    1interfaces/chain.cpp:263:25: warning: redundant move in return statement [-Wredundant-move]
    2interfaces/wallet.cpp:251:25: warning: redundant move in return statement [-Wredundant-move]
    3psbt.cpp:319:19: warning: implicitly-declared PartiallySignedTransaction& PartiallySignedTransaction::operator=(const PartiallySignedTransaction&) is deprecated [-Wdeprecated-copy]
    4psbt.cpp:341:1: warning: control reaches end of non-void function [-Wreturn-type]
    5wallet/wallettool.cpp:62:25: warning: catching polymorphic type const class std::runtime_error by value [-Wcatch-value=]
    

    This is the result without the exclusion:

     0$ make 2>&1 | grep "warning: " | head
     1/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:34: warning: char* __builtin_strncpy(char*, const char*, long unsigned int) specified bound 12 equals destination size [-Wstringop-truncation]
     2leveldb/util/logging.cc:58:40: warning: comparison of integer expressions of different signedness: const int and long unsigned int [-Wsign-compare]
     3leveldb/port/port_posix.cc:60:15: warning: ecx may be used uninitialized in this function [-Wmaybe-uninitialized]
     4/usr/include/x86_64-linux-gnu/qt5/QtCore/qvariant.h:265:25: warning: implicitly-declared QVariant::Private& QVariant::Private::operator=(const QVariant::Private&) is deprecated [-Wdeprecated-copy]
     5/usr/include/x86_64-linux-gnu/qt5/QtCore/qvariant.h:265:25: warning: implicitly-declared QVariant::Private& QVariant::Private::operator=(const QVariant::Private&) is deprecated [-Wdeprecated-copy]
     6/usr/include/x86_64-linux-gnu/qt5/QtCore/qvariant.h:265:25: warning: implicitly-declared QVariant::Private& QVariant::Private::operator=(const QVariant::Private&) is deprecated [-Wdeprecated-copy]
     7/usr/include/x86_64-linux-gnu/qt5/QtCore/qvariant.h:265:25: warning: implicitly-declared QVariant::Private& QVariant::Private::operator=(const QVariant::Private&) is deprecated [-Wdeprecated-copy]
     8/usr/include/x86_64-linux-gnu/qt5/QtWidgets/qstyleoption.h:120:103: warning: implicitly-declared QStyleOptionFocusRect& QStyleOptionFocusRect::operator=(const QStyleOptionFocusRect&) is deprecated [-Wdeprecated-copy]
     9/usr/include/x86_64-linux-gnu/qt5/QtWidgets/qstyleoption.h:144:95: warning: implicitly-declared QStyleOptionFrame& QStyleOptionFrame::operator=(const QStyleOptionFrame&) is deprecated [-Wdeprecated-copy]
    10/usr/include/x86_64-linux-gnu/qt5/QtWidgets/qstyleoption.h:173:49: warning: implicitly-declared QStyleOptionTabWidgetFrame& QStyleOptionTabWidgetFrame::operator=(const QStyleOptionTabWidgetFrame&) is deprecated [-Wdeprecated-copy]
    
  11. MarcoFalke commented at 9:37 pm on May 10, 2019: member
    This will probably be fixed in qt 5.13
  12. MarcoFalke added the label GUI on May 14, 2019
  13. MarcoFalke commented at 1:28 pm on May 14, 2019: member
  14. MarcoFalke referenced this in commit 76e2cded47 on May 27, 2019
  15. MarcoFalke commented at 8:15 pm on May 28, 2019: member
    :clock1130: Target for Qt 5.13.0 Final is 13th June. Source: https://lists.qt-project.org/pipermail/releasing/2019-May/002649.html
  16. fanquake commented at 1:38 pm on June 3, 2019: member
    @MarcoFalke Do you want to move to a newer Qt in depends, or is this issue just to keep track of the warnings until 5.13 is released?
  17. MarcoFalke commented at 8:54 am on June 5, 2019: member
    I think developers don’t build from depends, usually, so there is no pressing need to bump it in depends.
  18. Sjors commented at 1:21 pm on July 11, 2019: member

    I get flooded by warnings along the lines of:

    0ld: warning: direct access in function 'boost::system::detail::system_error_category::default_error_condition(int) const' from file '[...]/bitcoin/depends/x86_64-apple-darwin18.6.0/lib/libboost_filesystem-mt-x64.a(operations.o)' to global weak symbol 'guard variable for boost::system::generic_category()::generic_category_instance' from file 'libbitcoin_util.a(libbitcoin_util_a-time.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
    

    That’s not just QT though, so maybe a different issue?

  19. MarcoFalke commented at 1:32 pm on September 30, 2019: member
    Apparently this is planned to be backported to 5.12: https://codereview.qt-project.org/c/qt/qtbase/+/272258
  20. hebasto commented at 1:43 pm on November 20, 2019: member
    Fedora 31, Qt 5.12.5 - the same…
  21. MarcoFalke commented at 7:43 pm on March 2, 2020: member
    This is an upstream issue. There is not much we can do here.
  22. MarcoFalke closed this on Mar 2, 2020

  23. fanquake referenced this in commit 6c647c89db on May 13, 2020
  24. sidhujag referenced this in commit 700181dce0 on May 14, 2020
  25. ComputerCraftr referenced this in commit f89a3d5ca9 on Jun 10, 2020
  26. furszy referenced this in commit f6b14ca9ef on Jan 21, 2021
  27. PastaPastaPasta referenced this in commit cf15c83b5e on Jun 27, 2021
  28. PastaPastaPasta referenced this in commit 1e0ea2bb58 on Jun 28, 2021
  29. PastaPastaPasta referenced this in commit 891a0f9099 on Jun 29, 2021
  30. PastaPastaPasta referenced this in commit 60ea1e2615 on Jul 1, 2021
  31. PastaPastaPasta referenced this in commit b29af0747b on Jul 1, 2021
  32. PastaPastaPasta referenced this in commit eae83b57e2 on Jul 14, 2021
  33. PastaPastaPasta referenced this in commit ceeea4c0fa on Jul 15, 2021
  34. Rolloke commented at 6:08 pm on September 25, 2021: none
    to suppress these warnings: warning: implicitly-declared ‘constexpr QVariant::Private& QVariant::Private::operator=(const QVariant::Private&)’ is deprecated [-Wdeprecated-copy] just define unix:QMAKE_CFLAGS_WARN_ON += -Wno-deprecated-copy unix:QMAKE_CXXFLAGS_WARN_ON += -Wno-deprecated-copy in your projects .pro file.
  35. MarcoFalke commented at 7:17 am on September 26, 2021: member
    There is also --enable-suppress-external-warnings in our configure, which suppresses them.
  36. GoodTekken referenced this in commit a4a4b0f926 on Aug 19, 2022
  37. DrahtBot locked this on Oct 30, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-18 21:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me