diff options
Diffstat (limited to 'src/corelib/global/qglobal.h')
-rw-r--r-- | src/corelib/global/qglobal.h | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 79053329a1..cfc6ef8b16 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -355,7 +355,7 @@ typedef double qreal; #if !defined(QT_NAMESPACE) && defined(__cplusplus) && !defined(Q_QDOC) extern "C" #endif -Q_CORE_EXPORT const char *qVersion() Q_DECL_NOTHROW; +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION const char *qVersion() Q_DECL_NOTHROW; #if defined(__cplusplus) @@ -436,6 +436,9 @@ namespace QtPrivate { sizeof(void *) == sizeof(quintptr) && sizeof(void *) == sizeof(qptrdiff) + + size_t and qssize_t are not guaranteed to be the same size as a pointer, but + they usually are. */ template <int> struct QIntegerForSize; template <> struct QIntegerForSize<1> { typedef quint8 Unsigned; typedef qint8 Signed; }; @@ -451,6 +454,7 @@ typedef QIntegerForSize<Q_PROCESSOR_WORDSIZE>::Unsigned qregisteruint; typedef QIntegerForSizeof<void*>::Unsigned quintptr; typedef QIntegerForSizeof<void*>::Signed qptrdiff; typedef qptrdiff qintptr; +using qssize_t = QIntegerForSizeof<std::size_t>::Signed; /* moc compats (signals/slots) */ #ifndef QT_MOC_COMPAT @@ -612,6 +616,18 @@ private: void *pool; }; +#else + +#define QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, ios, tvos, watchos) (0) +#define QT_MACOS_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, ios) (0) +#define QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(macos) (0) +#define QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(ios) (0) +#define QT_TVOS_PLATFORM_SDK_EQUAL_OR_ABOVE(tvos) (0) +#define QT_WATCHOS_PLATFORM_SDK_EQUAL_OR_ABOVE(watchos) (0) + +#define QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(osx, ios) (0) +#define QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(osx) (0) + #endif // Q_OS_DARWIN /* @@ -655,7 +671,7 @@ Q_NORETURN Q_CORE_EXPORT void qTerminate() Q_DECL_NOTHROW; # endif #endif -Q_CORE_EXPORT bool qSharedBuild() Q_DECL_NOTHROW; +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qSharedBuild() Q_DECL_NOTHROW; #ifndef Q_OUTOFLINE_TEMPLATE # define Q_OUTOFLINE_TEMPLATE @@ -704,9 +720,9 @@ Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line) #if !defined(Q_ASSERT) # if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) -# define Q_ASSERT(cond) do { } while ((false) && (cond)) +# define Q_ASSERT(cond) static_cast<void>(false && (cond)) # else -# define Q_ASSERT(cond) ((!(cond)) ? qt_assert(#cond,__FILE__,__LINE__) : qt_noop()) +# define Q_ASSERT(cond) ((cond) ? static_cast<void>(0) : qt_assert(#cond, __FILE__, __LINE__)) # endif #endif @@ -721,9 +737,9 @@ Q_CORE_EXPORT void qt_assert_x(const char *where, const char *what, const char * #if !defined(Q_ASSERT_X) # if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) -# define Q_ASSERT_X(cond, where, what) do { } while ((false) && (cond)) +# define Q_ASSERT_X(cond, where, what) static_cast<void>(false && (cond)) # else -# define Q_ASSERT_X(cond, where, what) ((!(cond)) ? qt_assert_x(where, what,__FILE__,__LINE__) : qt_noop()) +# define Q_ASSERT_X(cond, where, what) ((cond) ? static_cast<void>(0) : qt_assert_x(where, what, __FILE__, __LINE__)) # endif #endif @@ -910,13 +926,9 @@ QT_WARNING_DISABLE_MSVC(4530) /* C++ exception handler used, but unwind semantic # endif #endif -namespace QtPrivate { -template <typename T> struct QAddConst { typedef const T Type; }; -} - // this adds const to non-const objects (like std::as_const) template <typename T> -Q_DECL_CONSTEXPR typename QtPrivate::QAddConst<T>::Type &qAsConst(T &t) Q_DECL_NOTHROW { return t; } +Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) Q_DECL_NOTHROW { return t; } // prevent rvalue arguments: template <typename T> void qAsConst(const T &&) Q_DECL_EQ_DELETE; |