summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/global/qcompilerdetection.h6
-rw-r--r--tests/auto/corelib/global/qglobal/qglobal.c3
2 files changed, 7 insertions, 2 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index fb9e65b194..2cbe9ee559 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -911,10 +911,14 @@
#else
# define Q_CONSTEXPR const
# define Q_DECL_CONSTEXPR
-# define Q_DECL_NOEXCEPT
# define Q_DECL_RELAXED_CONSTEXPR
# define Q_NULLPTR NULL
# define Q_RELAXED_CONSTEXPR const
+# ifdef Q_CC_GNU
+# define Q_DECL_NOEXCEPT __attribute__((__nothrow__))
+# else
+# define Q_DECL_NOEXCEPT
+# endif
#endif
#if __has_cpp_attribute(nodiscard) && (!defined(Q_CC_CLANG) || __cplusplus > 201402L) // P0188R1
diff --git a/tests/auto/corelib/global/qglobal/qglobal.c b/tests/auto/corelib/global/qglobal/qglobal.c
index 4d4f4475ea..3b898de39f 100644
--- a/tests/auto/corelib/global/qglobal/qglobal.c
+++ b/tests/auto/corelib/global/qglobal/qglobal.c
@@ -51,7 +51,8 @@ int tst_QtVersion()
return QT_VERSION;
}
-const char *tst_qVersion() Q_DECL_NOEXCEPT
+const char *tst_qVersion() Q_DECL_NOEXCEPT;
+const char *tst_qVersion()
{
#if !defined(QT_NAMESPACE)
return qVersion();