Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.0.0, 5.0.1
-
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.