[Development] Two source incompatibilities in Qt 5.5 with Clang

Olivier Goffart olivier at woboq.com
Fri Mar 13 18:02:51 CET 2015

On Friday 13 March 2015 09:08:35 Thiago Macieira wrote:
> It's a minor SIC and I still call it justified. Anyone who was using #ifndef
> was making assumptions about Q_ASSERT's internals and how it is declared.
> We should all agree that making assumptions is a bad idea.

It was documented:

"It does nothing if QT_NO_DEBUG was defined during compilation."

And judging from the unused warning compiler gives, they were in their rights 
to do it, I'd say.

> With this change, there's no longer the need to make any assumptions.
> And it saves us from ugly:
> 	int x = someFunction();
> 	Q_ASSERT(x);
> 	Q_UNUSED(x);
> As for adding a new macro... I don't want to replace every one of them in
> Qt.
> $ git submodule --quiet foreach "git grep Q_ASSERT -- '*.cpp' '*.mm' '*.h'
> || true" | wc -l
> 9390

Which can still be done in one line.
But we don't even need to do it. We can leave the old one as it, and use 
Q_ASSERT_UNUSED for the new asserts


Woboq - Qt services and support - http://woboq.com - http://code.woboq.org

More information about the Development mailing list