[Development] Q_OBJECT_CHECK / Q_OBJECT triggers warning in clang: explicitly assigning a variable of type 'int' to itself [-Wself-assign]

Milian Wolff mail at milianw.de
Sun Jul 21 23:44:41 CEST 2013


On Sunday 21 July 2013 23:43:03 Milian Wolff wrote:
> Hey all,
> 
> compiling with clang and ccache I get this warning for everytime it
> encounters a Q_OBJECT:
> 
>  warning: explicitly assigning a variable of type 'int' to itself [-Wself-
> assign]
> 
> This is due to the Q_OBJECT_CHECK definition of

sorry - hit sent too early.

The definition of said macro is:


#define Q_OBJECT_CHECK \
    template <typename T> inline void qt_check_for_QOBJECT_macro(const T 
&_q_argument) const \
    { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i; }

see the "i = i". Is that just to ensure it's not marked as unused? Could 
something be done about it? Maybe the (void) i "trick" that Q_UNUSED applies?

Cheers
-- 
Milian Wolff
mail at milianw.de
http://milianw.de



More information about the Development mailing list