Use [[nodiscard]] with clang in C++17 mode
It is only broken in C++11/c++14 mode. We do need to fix the order of visibility-attributes and this C++ attribute. Change-Id: I41e4367f1aaa9241fec4e336c39e58b798336b2c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
579a11590d
commit
041f655c01
|
|
@ -1129,8 +1129,8 @@
|
|||
# define Q_DECL_ALIGN(n) alignas(n)
|
||||
#endif
|
||||
|
||||
#if __has_cpp_attribute(nodiscard) && !defined(Q_CC_CLANG) // P0188R1
|
||||
// Can't use [[nodiscard]] with Clang, see https://bugs.llvm.org/show_bug.cgi?id=33518
|
||||
#if __has_cpp_attribute(nodiscard) && (!defined(Q_CC_CLANG) || __cplusplus > 201402L) // P0188R1
|
||||
// Can't use [[nodiscard]] with Clang and C++11/14, see https://bugs.llvm.org/show_bug.cgi?id=33518
|
||||
# undef Q_REQUIRED_RESULT
|
||||
# define Q_REQUIRED_RESULT [[nodiscard]]
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ QT_BEGIN_NAMESPACE
|
|||
class QWindow;
|
||||
|
||||
namespace QTest {
|
||||
Q_GUI_EXPORT Q_REQUIRED_RESULT bool qWaitForWindowActive(QWindow *window, int timeout = 5000);
|
||||
Q_GUI_EXPORT Q_REQUIRED_RESULT bool qWaitForWindowExposed(QWindow *window, int timeout = 5000);
|
||||
Q_REQUIRED_RESULT Q_GUI_EXPORT bool qWaitForWindowActive(QWindow *window, int timeout = 5000);
|
||||
Q_REQUIRED_RESULT Q_GUI_EXPORT bool qWaitForWindowExposed(QWindow *window, int timeout = 5000);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE
|
|||
|
||||
\sa qWaitForWindowExposed(), QWidget::isActiveWindow()
|
||||
*/
|
||||
Q_WIDGETS_EXPORT Q_REQUIRED_RESULT bool QTest::qWaitForWindowActive(QWidget *widget, int timeout)
|
||||
Q_WIDGETS_EXPORT bool QTest::qWaitForWindowActive(QWidget *widget, int timeout)
|
||||
{
|
||||
if (QWindow *window = widget->window()->windowHandle())
|
||||
return QTest::qWaitForWindowActive(window, timeout);
|
||||
|
|
@ -80,7 +80,7 @@ Q_WIDGETS_EXPORT Q_REQUIRED_RESULT bool QTest::qWaitForWindowActive(QWidget *wid
|
|||
|
||||
\sa qWaitForWindowActive()
|
||||
*/
|
||||
Q_WIDGETS_EXPORT Q_REQUIRED_RESULT bool QTest::qWaitForWindowExposed(QWidget *widget, int timeout)
|
||||
Q_WIDGETS_EXPORT bool QTest::qWaitForWindowExposed(QWidget *widget, int timeout)
|
||||
{
|
||||
if (QWindow *window = widget->window()->windowHandle())
|
||||
return QTest::qWaitForWindowExposed(window, timeout);
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ QT_BEGIN_NAMESPACE
|
|||
class QWidget;
|
||||
|
||||
namespace QTest {
|
||||
Q_WIDGETS_EXPORT Q_REQUIRED_RESULT bool qWaitForWindowActive(QWidget *widget, int timeout = 5000);
|
||||
Q_WIDGETS_EXPORT Q_REQUIRED_RESULT bool qWaitForWindowExposed(QWidget *widget, int timeout = 5000);
|
||||
Q_REQUIRED_RESULT Q_WIDGETS_EXPORT bool qWaitForWindowActive(QWidget *widget, int timeout = 5000);
|
||||
Q_REQUIRED_RESULT Q_WIDGETS_EXPORT bool qWaitForWindowExposed(QWidget *widget, int timeout = 5000);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
|||
Loading…
Reference in New Issue