[Interest] clang 3.2, -Wunused-private-field and qtestspontaneevent.h

Konstantin Tokarev annulen at yandex.ru
Thu Jan 17 12:15:45 CET 2013



17.01.2013, 14:24, "Jan Kundrát" <jkt at flaska.net>:
> Hi,
> I've upgraded to clang 3.2 from 3.0 and am getting these build warnings when using -Wall -Wextra:
>
> In file included from /usr/include/qt4/QtTest/QTest:1:
> In file included from /usr/include/qt4/QtTest/qtest.h:252:
> In file included from /usr/include/qt4/QtTest/qtest_gui.h:55:
> In file included from /usr/include/qt4/QtTest/qtestevent.h:52:
> In file included from /usr/include/qt4/QtTest/qtestkeyboard.h:53:
> /usr/include/qt4/QtTest/qtestspontaneevent.h:108:12: warning: private field 'posted' is not used [-Wunused-private-field]
>     ushort posted : 1;
>            ^
> /usr/include/qt4/QtTest/qtestspontaneevent.h:110:12: warning: private field 'm_accept' is not used [-Wunused-private-field]
>     ushort m_accept : 1;
>            ^
> /usr/include/qt4/QtTest/qtestspontaneevent.h:111:12: warning: private field 'reserved' is not used [-Wunused-private-field]
>     ushort reserved : 13;
>            ^
>
> I understand that these fields are needed for ABI compatibility. Still, they are causing three warnings for each unit test that I compile. What would be the easiest way out of there, preferably without disabling that warning globally?
>
> A few "fixes" come to my mind:
>
> - blame clang,

Clang is right here.

> - make these protected,

or just add Q_UNUSED(posted), Q_UNUSED(m_accept), Q_UNUSED(reserved) to the implementation of some method.

> - Somehow tell clang that /usr/include/qt4/ is part of "the system" and there is no point in issuing warning for that. I haven't had luck in achieving this under GCC, not sure if clang is any better.

Use -isystem instead of -I for Qt headers.

-- 
Regards,
Konstantin



More information about the Interest mailing list