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

To #include <QtTest/QtTest> generates warnings

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.1.0
    • 5.0.0, 5.0.1
    • Testing: qtestlib
    • None
    • OS X 10.8.2
    • cd035286c59f550ecc772eee7126679f9c065bb3

    Description

      If you #include <QtTest/QtTest> and try to compile on OS X 10.8.2, you will get the following warnings:

      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      In file included from /Applications/Qt5.0.1/5.0.1/clang_64/include/QtTest/QtTest:8:
      In file included from /Applications/Qt5.0.1/5.0.1/clang_64/include/QtTest/qtest.h:244:
      In file included from /Applications/Qt5.0.1/5.0.1/clang_64/include/QtTest/qtest_gui.h:55:
      In file included from /Applications/Qt5.0.1/5.0.1/clang_64/include/QtTest/qtestevent.h:52:
      In file included from /Applications/Qt5.0.1/5.0.1/clang_64/include/QtTest/qtestkeyboard.h:53:
      /Applications/Qt5.0.1/5.0.1/clang_64/include/QtTest/qtestspontaneevent.h:107:12: error: private field 'posted' is not used [-Werror,-Wunused-private-field]
      ushort posted : 1;
      ^
      /Applications/Qt5.0.1/5.0.1/clang_64/include/QtTest/qtestspontaneevent.h:109:12: error: private field 'm_accept' is not used [-Werror,-Wunused-private-field]
      ushort m_accept : 1;
      ^
      /Applications/Qt5.0.1/5.0.1/clang_64/include/QtTest/qtestspontaneevent.h:110:12: error: private field 'reserved' is not used [-Werror,-Wunused-private-field]
      ushort reserved : 13;
      ^
      3 errors generated.
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      Now, because my project considers warnings as errors, the above breaks things for me.

      There is, obviously, a very simple workaround, e.g.:

      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      #ifdef Q_OS_MAC
      #pragma GCC diagnostic ignored "-Wunused-private-field"
      #endif

      #include <QtTest/QtTest>

      #ifdef Q_OS_MAC
      #pragma GCC diagnostic warning "-Wunused-private-field"
      #endif
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      But, ideally, Qt would handle this without us having to 'protect' ourselves from those warnings.

      Attachments

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

        Activity

          People

            kleint Friedemann Kleint
            agarny Alan Garny
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes