diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-08-12 14:53:21 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-08-18 22:32:20 +0200 |
commit | 041f655c019788f375eec5db95d66e154b1e877b (patch) | |
tree | 54df381d2576a19aa8bc4b7c9440219b23122e66 | |
parent | 579a11590d72d88ebe76f6af6c8d13a098468525 (diff) |
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>
-rw-r--r-- | src/corelib/global/qcompilerdetection.h | 4 | ||||
-rw-r--r-- | src/gui/kernel/qtestsupport_gui.h | 4 | ||||
-rw-r--r-- | src/widgets/kernel/qtestsupport_widgets.cpp | 4 | ||||
-rw-r--r-- | src/widgets/kernel/qtestsupport_widgets.h | 4 |
4 files changed, 8 insertions, 8 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index df68d5acf7..a287bebc26 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -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 diff --git a/src/gui/kernel/qtestsupport_gui.h b/src/gui/kernel/qtestsupport_gui.h index 1f0c4f0960..86ff956ef8 100644 --- a/src/gui/kernel/qtestsupport_gui.h +++ b/src/gui/kernel/qtestsupport_gui.h @@ -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 diff --git a/src/widgets/kernel/qtestsupport_widgets.cpp b/src/widgets/kernel/qtestsupport_widgets.cpp index 068917101e..c014579ea8 100644 --- a/src/widgets/kernel/qtestsupport_widgets.cpp +++ b/src/widgets/kernel/qtestsupport_widgets.cpp @@ -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); diff --git a/src/widgets/kernel/qtestsupport_widgets.h b/src/widgets/kernel/qtestsupport_widgets.h index 98b297b405..5b4f7e59ba 100644 --- a/src/widgets/kernel/qtestsupport_widgets.h +++ b/src/widgets/kernel/qtestsupport_widgets.h @@ -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 |