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());
^
qglobal.h:663:52: note: expanded from macro 'Q_ASSERT'
# define Q_ASSERT(cond) do { } while (false && (cond))
^
1 error generated.
$ cat sic.cpp
#include <QtCore/QObject>
#ifndef QT_NO_DEBUG
static bool checkInvariant() { return true; }
#endif
void foo()
{
Q_ASSERT(checkInvariant());
}
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 */ ( )
1 error generated.
In this case, adding
run_second_cpp = true
to
~/.ccache/ccache.conf
makes it compile without changing the macro.
If we want this source compatibility, both of these issues should be
mentioned in the release notes.
Thanks,
Steve.
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development