Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-93011

QT_WARNING_DISABLE_* macros do not work for GCC 11

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P1: Critical
    • 6.2.0
    • 6.1.0 Beta3
    • Core: I/O
    • None
    • Fedora 34 Beta x64, GCC 11.0.1
    • Linux/X11

    Description

      A problem similar to QTBUG-90353, but this time it occurred on GCC 11.0.1.
      I just did as https://wiki.qt.io/Building_Qt_6_from_Git told.

      1. git clone
      2. git checkout 6.1
      3. init-repository
      4. make and enter the build dir
      5. ../qt5/configure -developer-build – -D QT_BUILD_TESTS_BY_DEFAULT=OFF
      6. cmake --build . --parallel

      But those macros did not work. I still got "all warnings being treated as errors":

      In file included from /home/gbcat/cpp/qt6-build/qtbase/include/QtCore/qglobal.h:1,
                       from /home/gbcat/cpp/qt5/qtbase/src/corelib/global/qt_pch.h:56,
                       from /home/gbcat/cpp/qt6-build/qtbase/src/corelib/CMakeFiles/Core.dir/cmake_pch.hxx:5,
                       from <command-line>:
      /home/gbcat/cpp/qt5/qtbase/src/corelib/kernel/qtimer.cpp: In static member function ‘static constexpr size_t QTimerPrivate::_qt_property_inter_offset()’:
      /home/gbcat/cpp/qt5/qtbase/src/corelib/kernel/qtimer.cpp:61:40: error: ‘offsetof’ within non-standard-layout type ‘QTimerPrivate’ is conditionally-supported [-Werror=invalid-offsetof]
         61 |     Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS(QTimerPrivate, int, inter, &QTimerPrivate::setInterval, 0)
      /home/gbcat/cpp/qt5/qtbase/src/corelib/global/qglobal.h:1343:49: note: in expansion of macro ‘Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS5’
       1343 | #define QT_OVERLOADED_MACRO_EXPAND(MACRO, ARGC) MACRO##ARGC
            |                                                 ^~~~~
      /home/gbcat/cpp/qt5/qtbase/src/corelib/kernel/qtimer.cpp:61:5: note: in expansion of macro ‘Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS’
         61 |     Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS(QTimerPrivate, int, inter, &QTimerPrivate::setInterval, 0)
            |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /home/gbcat/cpp/qt5/qtbase/src/corelib/kernel/qtimer.cpp: In static member function ‘static constexpr size_t QTimerPrivate::_qt_property_single_offset()’:
      /home/gbcat/cpp/qt5/qtbase/src/corelib/kernel/qtimer.cpp:62:42: error: ‘offsetof’ within non-standard-layout type ‘QTimerPrivate’ is conditionally-supported [-Werror=invalid-offsetof]
         62 |     Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS(QTimerPrivate, bool, single, false)
            |                                          ^
      /home/gbcat/cpp/qt5/qtbase/src/corelib/kernel/qtimer.cpp: In static member function ‘static constexpr size_t QTimerPrivate::_qt_property_type_offset()’:
      /home/gbcat/cpp/qt5/qtbase/src/corelib/kernel/qtimer.cpp:64:42: error: ‘offsetof’ within non-standard-layout type ‘QTimerPrivate’ is conditionally-supported [-Werror=invalid-offsetof]
         64 |     Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS(QTimerPrivate, Qt::TimerType, type, Qt::CoarseTimer)
            |                                
      

      BTW, the dev branch has the same problem too.

      Attachments

        1. error.log
          4 kB
        2. gcc_version
          2 kB

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              cnn Qt Core & Network
              zxfksie Xiang Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes