[Development] Two source incompatibilities in Qt 5.5 with Clang
Thiago Macieira
thiago.macieira at intel.com
Thu Mar 5 18:17:57 CET 2015
On Thursday 05 March 2015 13:59:01 Stephen Kelly wrote:
> Hello,
>
> After commit ebef2ad1 (Make the empty Q_ASSERT still check its
> argument for validity, 2014-09-11), there are two source
> incompatibilities compared to Qt 5.4. I understand the message in the
> commit.
>
> The following code fails to compile with -DQT_NO_DEBUG:
>
> sic.cpp:10:14: error: use of undeclared identifier 'checkInvariant'
> Q_ASSERT(checkInvariant());
> ^
This is not specific to Clang, it should happen with every compiler.
This was intentional and the minor SIC was expected. It only happens if you're
calling a static function that only exists for Q_ASSERT -- not many people do
that.
> If compiled with ccache, there is a second problem if used with
> -Werror=unreachable-code:
>
> sic.cpp:10:29: error: code will never be executed
> [-Werror,-Wunreachable-code]
> do { } while (false && (checkInvariant()));
> ^~~~~~~~~~~~~~
> sic.cpp:10:19: note: silence by adding parentheses to mark code as
> explicitly dead
> do { } while (false && (checkInvariant()));
> ^
> /* DISABLES CODE */ ( )
Interesting, will implement this.
> If we want this source compatibility, both of these issues should be
> mentioned in the release notes.
I'll add the note to the Q_ASSERT and will add the parentheses.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Development
mailing list