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

QT_WARNING_DISABLE_* macros do not work under MinGW 8.1

    XMLWordPrintable

Details

    • Windows
    • 293b7fab55309b59e301c576266d9dabe366b56b (qt/qtbase/dev)

    Description

      New QProperty system uses offsetof macro in macros like Q_OBJECT_COMPUTED_PROPERTY or Q_OBJECT_BINDABLE_PROPERTY.

      This macro itself produces a warning like: offsetof within non-standard-layout type 'QTimerPrivate' is conditionally-supported

      To suppress this warning we are using QT_WARNING_DISABLE_INVALID_OFFSETOF macro, which unwraps into smth like

      _Pragma(" GCC diagnostics ignored \"-Winvalid-offsetof\"")
      

      on gcc-like compilers.

      However this does not work on Windows with MinGW 8.1. See this integrations, for example: https://testresults.qt.io/coin/integration/qt/qtbase/tasks/1610705839

      A bit of googling lead me to this long-lasting bug, which seems to be still valid for 8.1: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431

      I also found the possible solution here: https://stackoverflow.com/questions/43063596/g-ignores-pragma-diagnostic-ignored

      One of the original 2012 reports for this issue at GNU's bugzilla included an offhand mention from the reporter, that _Pragma() would be processed as expected if they added either -save-temps or -no-integrated-cpp to the compile command.

      Looks like adding -no-integrated-cpp flag for gcc < 9.0.0 should fix the issue.

      However I have no idea, how to do it in our build system correctly.

      Attachments

        Issue Links

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

          Activity

            People

              fabiankosmale Fabian Kosmale
              ivan.solovev Ivan Solovev
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There is 1 open Gerrit change