From 21950e3085bd45dbd4b55fb76e3d47319cbb11d7 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 4 Nov 2022 14:13:45 -0700 Subject: [PATCH] qfloat16: remove the metatype dependency This macro usage is not correct. I don't know what it is for because the documentation next to it describes how to use it, not why one should use it. Anyway, it's most definitely the incorrect solution for whatever problem there may have been, so remove. I also couldn't move it to removed_api.cpp. If I do, then the QMetaTypeInterface created for qfloat16 misses the pointers to QDataStream. I'm not sure why... I think it's because the operator>> and operator<< become ambiguous, so the SFINAE to check if they exist gives up. Change-Id: I3d74c753055744deb8acfffd17247e1d2317f11c Reviewed-by: Allan Sandfeld Jensen --- src/corelib/compat/removed_api.cpp | 1 + src/corelib/global/qfloat16.cpp | 3 +++ src/corelib/global/qfloat16.h | 4 +--- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/corelib/compat/removed_api.cpp b/src/corelib/compat/removed_api.cpp index 795fa5f5c0..aad7b58b36 100644 --- a/src/corelib/compat/removed_api.cpp +++ b/src/corelib/compat/removed_api.cpp @@ -369,6 +369,7 @@ void QXmlStreamReader::addData(const char *data) #endif // QT_CONFIG(xmlstreamreader) // inlined API +#include "qfloat16.h" #include "qstring.h" #endif // QT_CORE_REMOVED_SINCE(6, 5) diff --git a/src/corelib/global/qfloat16.cpp b/src/corelib/global/qfloat16.cpp index b7f1a559b1..38ac763519 100644 --- a/src/corelib/global/qfloat16.cpp +++ b/src/corelib/global/qfloat16.cpp @@ -7,7 +7,10 @@ #include // for fpclassify()'s return values #include +#include +#include +QT_DECL_METATYPE_EXTERN(qfloat16, Q_CORE_EXPORT) QT_BEGIN_NAMESPACE QT_IMPL_METATYPE_EXTERN(qfloat16) diff --git a/src/corelib/global/qfloat16.h b/src/corelib/global/qfloat16.h index fc0d9e2702..f7e3df63aa 100644 --- a/src/corelib/global/qfloat16.h +++ b/src/corelib/global/qfloat16.h @@ -6,7 +6,7 @@ #define QFLOAT16_H #include -#include +#include #include #include #include @@ -345,8 +345,6 @@ inline auto qHypot(qfloat16 x, qfloat16 y, qfloat16 z) QT_END_NAMESPACE -QT_DECL_METATYPE_EXTERN(qfloat16, Q_CORE_EXPORT) - namespace std { template<> class numeric_limits : public numeric_limits