[Development] clang warning
Thiago Macieira
thiago.macieira at intel.com
Sat Mar 22 19:53:04 CET 2014
Em sáb 22 mar 2014, às 12:39:40, Kurt Pattyn escreveu:
> Hi,
>
> when compiling an application, I get a lot of these warnings:
>
> Qt5.3.0/5.3/clang_64/lib/QtGui.framework/Headers/qquaternion.h:145:12:
> warning: 'qIsNull' was marked unused but was used
> [-Wused-but-marked-unused]
> return qIsNull(xp) && qIsNull(yp) && qIsNull(zp) && qIsNull(wp);
>
> Qt5.3.0/5.3/clang_64/lib/QtGui.framework/Headers/qquaternion.h:268:12:
> warning: 'qFuzzyCompare' was marked unused but was used
> [-Wused-but-marked-unused]
> return qFuzzyCompare(q1.xp, q2.xp) &&
>
> Does anybody has an idea what this means?
It means the meaning of __attribute__((unused)) changed. The documentation I
have for GCC 4.8 says:
This attribute, attached to a function, means that the function is
meant to be possibly unused. GCC does not produce a warning for
this function.
Note the "possibly" part in "possibly unused". It means the function may still
be used, but in most cases it won't be. We added the Q_DECL_UNUSED to the
static inline functions of qglobal.h so the compiler wouldn't complain that we
declared them static and did not use.
I don't see a point in implementing Clang's behaviour. If we know a static
function is never used, we can remove it. The usefulness of the attribute is
when we can't be certain, such as depending on ifdefs or functions declared in
headers.
Please file a bug report against Clang.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Development
mailing list