summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <[email protected]>2022-09-07 10:51:15 -0700
committerThiago Macieira <[email protected]>2025-03-12 20:38:22 -0700
commit7df128675a22391bc3ade2a45b558bc38eee1c67 (patch)
tree77a0cbe9053057a97a2d8f49dcdf8b2558f3ec07
parent8786a930d1fee3ad330166a056c87684802733b6 (diff)
3rdparty: update TinyCBOR to v0.6.1
[ChangeLog][Third-Party Code] The copy of TinyCBOR in Qt was updated to 0.6.1. Pick-to: 6.9 6.9.0 6.8 6.8.3 6.5 5.15 Change-Id: If5d5ef6220874ae8858efffd1712a567597b6317 Reviewed-by: Marc Mutz <[email protected]>
-rw-r--r--src/3rdparty/tinycbor/0001-tst_Encoder-port-away-from-Q_FOREACH.patch79
-rw-r--r--src/3rdparty/tinycbor/qt_attribution.json4
-rw-r--r--src/3rdparty/tinycbor/src/cbor.h4
-rw-r--r--src/3rdparty/tinycbor/src/cborencoder.c6
-rw-r--r--src/3rdparty/tinycbor/src/cborinternal_p.h29
-rw-r--r--src/3rdparty/tinycbor/src/cborparser.c45
-rw-r--r--src/3rdparty/tinycbor/src/compilersupport_p.h47
-rw-r--r--src/3rdparty/tinycbor/tests/parser/tst_parser.cpp19
-rw-r--r--src/corelib/serialization/qcborcommon_p.h1
-rw-r--r--src/tools/moc/generator.cpp1
10 files changed, 124 insertions, 111 deletions
diff --git a/src/3rdparty/tinycbor/0001-tst_Encoder-port-away-from-Q_FOREACH.patch b/src/3rdparty/tinycbor/0001-tst_Encoder-port-away-from-Q_FOREACH.patch
deleted file mode 100644
index 43c8b1a452b..00000000000
--- a/src/3rdparty/tinycbor/0001-tst_Encoder-port-away-from-Q_FOREACH.patch
+++ /dev/null
@@ -1,79 +0,0 @@
-From b6e2caf7452bf2b695583196fd7b346c1663d798 Mon Sep 17 00:00:00 2001
-From: Marc Mutz <[email protected]>
-Date: Mon, 7 Aug 2023 16:24:13 +0200
-Subject: [PATCH] tst_Encoder: port away from Q_FOREACH
-
-Qt is defaulting to QT_NO_FOREACH these days, so make sure we
-integrate nicely with downstream and fix the single Q_FOREACH/foreach
-user, in tst_encoder.cpp.
-
-Unfortunately, the container's initialization code doesn't exactly
-lend itself to making the container const (not even IILE
-(Immediately-Invoked Lambda Expression) would help here, due to the
-interdependency with `len`), so the idiomatic solution would be to use
-std::as_const()/qAsConst().
-
-The former is available from C++17, which we don't require, yet, and
-the latter is not available under QT_NO_AS_CONST (the default for Qt
-these days), so grab the nettle and implement a t17::as_const() that
-switches between a manual implementation of std::as_const and the real
-thing, depending on __cpp_lib_as_const. The `t17` here mimicks the qNN
-(q20::remove_cvref_t/q23::forward_like/etc) mechanism used in Qt
-itself for backports, with s/q/t/ because ... _T_inyCbor.
-
-The t17 implementation is local to tst_encoder.cpp, but can easily be
-extracted into a separate header once more users emerge.
----
- tests/encoder/encoder.pro | 2 ++
- tests/encoder/tst_encoder.cpp | 15 ++++++++++++++-
- 2 files changed, 16 insertions(+), 1 deletion(-)
-
-diff --git a/tests/encoder/encoder.pro b/tests/encoder/encoder.pro
-index 62d9b7e..180f0d7 100644
---- a/tests/encoder/encoder.pro
-+++ b/tests/encoder/encoder.pro
-@@ -3,6 +3,8 @@ SOURCES += tst_encoder.cpp
- CONFIG += testcase parallel_test c++11
- QT = core testlib
-
-+DEFINES += QT_NO_FOREACH QT_NO_AS_CONST
-+
- INCLUDEPATH += ../../src
- msvc: POST_TARGETDEPS = ../../lib/tinycbor.lib
- else: POST_TARGETDEPS += ../../lib/libtinycbor.a
-diff --git a/tests/encoder/tst_encoder.cpp b/tests/encoder/tst_encoder.cpp
-index 31c2915..61ce9c9 100644
---- a/tests/encoder/tst_encoder.cpp
-+++ b/tests/encoder/tst_encoder.cpp
-@@ -29,6 +29,19 @@
- #include <qfloat16.h>
- #endif
-
-+#include <utility>
-+namespace t17 {
-+#ifdef __cpp_lib_as_const
-+ using std::as_const;
-+#else
-+ template <typename T>
-+ constexpr typename std::add_const<T>::type &as_const(T &t) noexcept { return t; }
-+ // prevent rvalue arguments:
-+ template <typename T>
-+ void as_const(const T &&) = delete;
-+#endif // __cpp_lib_as_const
-+} // namespace t17
-+
- Q_DECLARE_METATYPE(CborError)
- namespace QTest {
- template<> char *toString<CborError>(const CborError &err)
-@@ -153,7 +166,7 @@ CborError encodeVariant(CborEncoder *encoder, const QVariant &v)
- CborError err = cbor_encoder_create_array(encoder, &sub, len);
- if (err && !isOomError(err))
- return err;
-- foreach (const QVariant &v2, list) {
-+ for (const QVariant &v2 : t17::as_const(list)) {
- err = static_cast<CborError>(err | encodeVariant(&sub, v2));
- if (err && !isOomError(err))
- return err;
---
-2.25.1
-
diff --git a/src/3rdparty/tinycbor/qt_attribution.json b/src/3rdparty/tinycbor/qt_attribution.json
index 8458eefd513..0249de1b885 100644
--- a/src/3rdparty/tinycbor/qt_attribution.json
+++ b/src/3rdparty/tinycbor/qt_attribution.json
@@ -10,9 +10,9 @@
"License": "MIT License",
"LicenseId": "MIT",
"LicenseFile": "LICENSE",
- "DownloadLocation": "https://github.com/intel/tinycbor/archive/v0.6.0/tinycbor-0.6.0.tar.gz",
+ "DownloadLocation": "https://github.com/intel/tinycbor/archive/v0.6.1/tinycbor-0.6.1.tar.gz",
"PURL": "pkg:github/intel/tinycbor@v$<VERSION>",
"CPE": "cpe:2.3:a:tinycbor:tinycbor:$<VERSION>:*:*:*:*:*:*:*",
- "Version": "0.6.0",
+ "Version": "0.6.1",
"Copyright": "Copyright (C) 2015-2021 Intel Corporation"
}
diff --git a/src/3rdparty/tinycbor/src/cbor.h b/src/3rdparty/tinycbor/src/cbor.h
index be5bbc77a34..31b1036e2cb 100644
--- a/src/3rdparty/tinycbor/src/cbor.h
+++ b/src/3rdparty/tinycbor/src/cbor.h
@@ -34,6 +34,10 @@
#include <string.h>
#include <stdio.h>
+#ifdef CBOR_EXTERNAL_CFG
+#include "cbor_cfg.h"
+#endif
+
#include "tinycbor-version.h"
#define TINYCBOR_VERSION ((TINYCBOR_VERSION_MAJOR << 16) | (TINYCBOR_VERSION_MINOR << 8) | TINYCBOR_VERSION_PATCH)
diff --git a/src/3rdparty/tinycbor/src/cborencoder.c b/src/3rdparty/tinycbor/src/cborencoder.c
index a51f4451596..eed3d5b44c7 100644
--- a/src/3rdparty/tinycbor/src/cborencoder.c
+++ b/src/3rdparty/tinycbor/src/cborencoder.c
@@ -31,6 +31,7 @@
#ifndef __STDC_LIMIT_MACROS
# define __STDC_LIMIT_MACROS 1
#endif
+#define __STDC_WANT_IEC_60559_TYPES_EXT__
#include "cbor.h"
#include "cborinternal_p.h"
@@ -101,7 +102,7 @@
* complete the encoding. At the end, you can obtain that count by calling
* cbor_encoder_get_extra_bytes_needed().
*
- * \section1 Finalizing the encoding
+ * \section Finalizing the encoding
*
* Once all items have been appended and the containers have all been properly
* closed, the user-supplied buffer will contain the CBOR stream and may be
@@ -212,6 +213,7 @@ void cbor_encoder_init_writer(CborEncoder *encoder, CborEncoderWriteFunction wri
{
#ifdef CBOR_ENCODER_WRITE_FUNCTION
(void) writer;
+ encoder->data.writer = CBOR_NULLPTR;
#else
encoder->data.writer = writer;
#endif
@@ -544,7 +546,7 @@ CborError cbor_encoder_create_array(CborEncoder *parentEncoder, CborEncoder *arr
* when creating the map, the constant \ref CborIndefiniteLength may be passed as
* length instead, and an indefinite length map is created.
*
- * \b{Implementation limitation:} TinyCBOR cannot encode more than SIZE_MAX/2
+ * <b>Implementation limitation:</b> TinyCBOR cannot encode more than SIZE_MAX/2
* key-value pairs in the stream. If the length \a length is larger than this
* value (and is not \ref CborIndefiniteLength), this function returns error
* CborErrorDataTooLarge.
diff --git a/src/3rdparty/tinycbor/src/cborinternal_p.h b/src/3rdparty/tinycbor/src/cborinternal_p.h
index 16269e6301a..19273acd7d6 100644
--- a/src/3rdparty/tinycbor/src/cborinternal_p.h
+++ b/src/3rdparty/tinycbor/src/cborinternal_p.h
@@ -25,11 +25,19 @@
#ifndef CBORINTERNAL_P_H
#define CBORINTERNAL_P_H
+/* Dependent source files (*.c) must define __STDC_WANT_IEC_60559_TYPES_EXT__
+ * before <float.h> is (transitively) first included.
+ */
+#if !defined(__STDC_WANT_IEC_60559_TYPES_EXT__)
+# error __STDC_WANT_IEC_60559_TYPES_EXT__ not defined
+#endif
+
#include "compilersupport_p.h"
#ifndef CBOR_NO_FLOATING_POINT
# include <float.h>
# include <math.h>
+# include <string.h>
#else
# ifndef CBOR_NO_HALF_FLOAT_TYPE
# define CBOR_NO_HALF_FLOAT_TYPE 1
@@ -37,7 +45,26 @@
#endif
#ifndef CBOR_NO_HALF_FLOAT_TYPE
-# if defined(__F16C__) || defined(__AVX2__)
+/* Check for FLT16_MANT_DIG using integer comparison. Clang headers incorrectly
+ * define this macro unconditionally when __STDC_WANT_IEC_60559_TYPES_EXT__
+ * is defined (regardless of actual support for _Float16).
+ */
+# if FLT16_MANT_DIG > 0 || __FLT16_MANT_DIG__ > 0
+static inline unsigned short encode_half(float x)
+{
+ unsigned short h;
+ _Float16 f = (_Float16)x;
+ memcpy(&h, &f, 2);
+ return h;
+}
+
+static inline float decode_half(unsigned short x)
+{
+ _Float16 f;
+ memcpy(&f, &x, 2);
+ return (float)f;
+}
+# elif defined(__F16C__) || defined(__AVX2__)
# include <immintrin.h>
static inline unsigned short encode_half(float val)
{
diff --git a/src/3rdparty/tinycbor/src/cborparser.c b/src/3rdparty/tinycbor/src/cborparser.c
index 80c44c7e13b..449e7f87782 100644
--- a/src/3rdparty/tinycbor/src/cborparser.c
+++ b/src/3rdparty/tinycbor/src/cborparser.c
@@ -31,6 +31,7 @@
#ifndef __STDC_LIMIT_MACROS
# define __STDC_LIMIT_MACROS 1
#endif
+#define __STDC_WANT_IEC_60559_TYPES_EXT__
#include "cbor.h"
#include "cborinternal_p.h"
@@ -93,7 +94,7 @@
*
* The code above does not execute a range-check either: it is possible that
* the value decoded from the CBOR stream encodes a number larger than what can
- * be represented in a variable of type \c{int}. If detecting that case is
+ * be represented in a variable of type \c int. If detecting that case is
* important, the code should call cbor_value_get_int_checked() instead.
*
* <h3 class="groupheader">Memory and parsing constraints</h3>
@@ -133,12 +134,10 @@
*
* \if privatedocs
* Implementation details: the CborValue contains these fields:
- * \list
- * \li ptr: pointer to the actual data
- * \li flags: flags from the decoder
- * \li extra: partially decoded integer value (0, 1 or 2 bytes)
- * \li remaining: remaining items in this collection after this item or UINT32_MAX if length is unknown
- * \endlist
+ * - ptr: pointer to the actual data
+ * - flags: flags from the decoder
+ * - extra: partially decoded integer value (0, 1 or 2 bytes)
+ * - remaining: remaining items in this collection after this item or UINT32_MAX if length is unknown
* \endif
*/
@@ -232,7 +231,7 @@ static CborError preparse_value(CborValue *it)
case SinglePrecisionFloat:
case DoublePrecisionFloat:
it->flags |= CborIteratorFlag_IntegerValueTooLarge;
- Q_FALLTHROUGH();
+ CBOR_FALLTHROUGH;
case TrueValue:
case NullValue:
case UndefinedValue:
@@ -428,12 +427,10 @@ CborError cbor_value_reparse(CborValue *it)
* will appear during parsing.
*
* A basic validation checks for:
- * \list
- * \li absence of undefined additional information bytes;
- * \li well-formedness of all numbers, lengths, and simple values;
- * \li string contents match reported sizes;
- * \li arrays and maps contain the number of elements they are reported to have;
- * \endlist
+ * - absence of undefined additional information bytes;
+ * - well-formedness of all numbers, lengths, and simple values;
+ * - string contents match reported sizes;
+ * - arrays and maps contain the number of elements they are reported to have;
*
* For further checks, see cbor_value_validate().
*
@@ -744,7 +741,7 @@ CborError cbor_value_leave_container(CborValue *it, const CborValue *recursed)
* \ref cbor_value_is_integer is recommended.
*
* Note that this function does not do range-checking: integral values that do
- * not fit in a variable of type \c{int} are silently truncated to fit. Use
+ * not fit in a variable of type \c int are silently truncated to fit. Use
* cbor_value_get_int_checked() if that is not acceptable.
*
* \sa cbor_value_get_type(), cbor_value_is_valid(), cbor_value_is_integer()
@@ -759,7 +756,7 @@ CborError cbor_value_leave_container(CborValue *it, const CborValue *recursed)
* \ref cbor_value_is_integer is recommended.
*
* Note that this function does not do range-checking: integral values that do
- * not fit in a variable of type \c{int64_t} are silently truncated to fit. Use
+ * not fit in a variable of type \c int64_t are silently truncated to fit. Use
* cbor_value_get_int64_checked() that is not acceptable.
*
* \sa cbor_value_get_type(), cbor_value_is_valid(), cbor_value_is_integer()
@@ -790,7 +787,7 @@ CborError cbor_value_leave_container(CborValue *it, const CborValue *recursed)
* If the integer is unsigned (that is, if cbor_value_is_unsigned_integer()
* returns true), then \a result will contain the actual value. If the integer
* is negative, then \a result will contain the absolute value of that integer,
- * minus one. That is, \c {actual = -result - 1}. On architectures using two's
+ * minus one. That is, <tt>actual = -result - 1</tt>. On architectures using two's
* complement for representation of negative integers, it is equivalent to say
* that \a result will contain the bitwise negation of the actual value.
*
@@ -1211,7 +1208,7 @@ static CborError iterate_string_chunks(const CborValue *value, char *buffer, siz
return CborErrorDataTooLarge;
if (*result && *buflen >= newTotal)
- *result = !!func(buffer + total, (const uint8_t *)ptr, chunkLen);
+ *result = !!func(buffer == NULL ? buffer : buffer + total, (const uint8_t *)ptr, chunkLen);
else
*result = false;
@@ -1221,7 +1218,7 @@ static CborError iterate_string_chunks(const CborValue *value, char *buffer, siz
/* is there enough room for the ending NUL byte? */
if (*result && *buflen > total) {
uint8_t nul[] = { 0 };
- *result = !!func(buffer + total, nul, 1);
+ *result = !!func(buffer == NULL ? buffer : buffer + total, nul, 1);
}
*buflen = total;
return _cbor_value_finish_string_iteration(next);
@@ -1243,10 +1240,10 @@ static CborError iterate_string_chunks(const CborValue *value, char *buffer, siz
* of the string in order to preallocate a buffer, use
* cbor_value_calculate_string_length().
*
- * On success, this function sets the number of bytes copied to \c{*buflen}. If
+ * On success, this function sets the number of bytes copied to \c *buflen. If
* the buffer is large enough, this function will insert a null byte after the
* last copied byte, to facilitate manipulation of text strings. That byte is
- * not included in the returned value of \c{*buflen}. If there was no space for
+ * not included in the returned value of \c *buflen. If there was no space for
* the terminating null, no error is returned, so callers must check the value
* of *buflen after the call, before relying on the '\0'; if it has not been
* changed by the call, there is no '\0'-termination on the buffer's contents.
@@ -1280,10 +1277,10 @@ static CborError iterate_string_chunks(const CborValue *value, char *buffer, siz
* of the string in order to preallocate a buffer, use
* cbor_value_calculate_string_length().
*
- * On success, this function sets the number of bytes copied to \c{*buflen}. If
+ * On success, this function sets the number of bytes copied to \c *buflen. If
* the buffer is large enough, this function will insert a null byte after the
* last copied byte, to facilitate manipulation of null-terminated strings.
- * That byte is not included in the returned value of \c{*buflen}.
+ * That byte is not included in the returned value of \c *buflen.
*
* The \a next pointer, if not null, will be updated to point to the next item
* after this string. If \a value points to the last item, then \a next will be
@@ -1520,7 +1517,7 @@ error:
* cbor_value_is_half_float is recommended.
*
* Note: since the C language does not have a standard type for half-precision
- * floating point, this function takes a \c{void *} as a parameter for the
+ * floating point, this function takes a <tt>void *</tt> as a parameter for the
* storage area, which must be at least 16 bits wide.
*
* \sa cbor_value_get_type(), cbor_value_is_valid(), cbor_value_is_half_float(), cbor_value_get_half_float_as_float(), cbor_value_get_float()
diff --git a/src/3rdparty/tinycbor/src/compilersupport_p.h b/src/3rdparty/tinycbor/src/compilersupport_p.h
index 4e5c38a9ad7..c91ea933f13 100644
--- a/src/3rdparty/tinycbor/src/compilersupport_p.h
+++ b/src/3rdparty/tinycbor/src/compilersupport_p.h
@@ -51,6 +51,20 @@
#else
# define cbor_static_assert(x) ((void)sizeof(char[2*!!(x) - 1]))
#endif
+
+#if defined(__has_cpp_attribute) // C23 and C++17
+# if __has_cpp_attribute(fallthrough)
+# define CBOR_FALLTHROUGH [[fallthrough]]
+# endif
+#endif
+#ifndef CBOR_FALLTHROUGH
+# ifdef __GNUC__
+# define CBOR_FALLTHROUGH __attribute__((fallthrough))
+# else
+# define CBOR_FALLTHROUGH do { } while (0)
+# endif
+#endif
+
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus)
/* inline is a keyword */
#else
@@ -128,6 +142,23 @@
# define cbor_htonl _byteswap_ulong
# define cbor_ntohs _byteswap_ushort
# define cbor_htons _byteswap_ushort
+#elif defined(__ICCARM__)
+# if __LITTLE_ENDIAN__ == 1
+# include <intrinsics.h>
+# define ntohll(x) ((__REV((uint32_t)(x)) * UINT64_C(0x100000000)) + (__REV((x) >> 32)))
+# define htonll ntohll
+# define cbor_ntohl __REV
+# define cbor_htonl __REV
+# define cbor_ntohs __REVSH
+# define cbor_htons __REVSH
+# else
+# define cbor_ntohll
+# define cbor_htonll
+# define cbor_ntohl
+# define cbor_htonl
+# define cbor_ntohs
+# define cbor_htons
+# endif
#endif
#ifndef cbor_ntohs
# include <arpa/inet.h>
@@ -156,7 +187,7 @@
(defined(BYTE_ORDER) && defined(LITTLE_ENDIAN) && BYTE_ORDER == LITTLE_ENDIAN) || \
defined(_LITTLE_ENDIAN) || defined(__LITTLE_ENDIAN__) || defined(__ARMEL__) || defined(__MIPSEL__) || \
defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__) || defined(__amd64)
-# define ntohll(x) ((ntohl((uint32_t)(x)) * UINT64_C(0x100000000)) + (ntohl((x) >> 32)))
+# define ntohll(x) ((cbor_ntohl((uint32_t)(x)) * UINT64_C(0x100000000)) + (cbor_ntohl((x) >> 32)))
# define htonll ntohll
# else
# error "Unable to determine byte order!"
@@ -167,9 +198,11 @@
#ifdef __cplusplus
# define CONST_CAST(t, v) const_cast<t>(v)
+# define CBOR_NULLPTR nullptr
#else
/* C-style const_cast without triggering a warning with -Wcast-qual */
# define CONST_CAST(t, v) (t)(uintptr_t)(v)
+# define CBOR_NULLPTR NULL
#endif
#ifdef __GNUC__
@@ -201,5 +234,15 @@ static inline bool add_check_overflow(size_t v1, size_t v2, size_t *r)
#endif
}
-#endif /* COMPILERSUPPORT_H */
+static inline bool mul_check_overflow(size_t v1, size_t v2, size_t *r)
+{
+#if ((defined(__GNUC__) && (__GNUC__ >= 5)) && !defined(__INTEL_COMPILER)) || __has_builtin(__builtin_add_overflow)
+ return __builtin_mul_overflow(v1, v2, r);
+#else
+ /* unsigned multiplications are well-defined */
+ *r = v1 * v2;
+ return *r > v1 && *r > v2;
+#endif
+}
+#endif /* COMPILERSUPPORT_H */
diff --git a/src/3rdparty/tinycbor/tests/parser/tst_parser.cpp b/src/3rdparty/tinycbor/tests/parser/tst_parser.cpp
index 91a65a00ba9..0868b8a007e 100644
--- a/src/3rdparty/tinycbor/tests/parser/tst_parser.cpp
+++ b/src/3rdparty/tinycbor/tests/parser/tst_parser.cpp
@@ -106,6 +106,8 @@ private slots:
// validation & errors
void checkedIntegers_data();
void checkedIntegers();
+ void validationValid_data() { arrays_data(); }
+ void validationValid();
void validation_data();
void validation();
void strictValidation_data();
@@ -256,7 +258,7 @@ CborError parseOneChunk(CborValue *it, QString *parsed)
if (text)
*parsed = '"' + QString::fromUtf8(text, len) + '"';
} else {
- Q_ASSERT(false);
+ Q_UNREACHABLE();
}
return err;
}
@@ -1337,6 +1339,21 @@ void tst_Parser::checkedIntegers()
}
}
+void tst_Parser::validationValid()
+{
+ // verify that all valid data validate properly
+ QFETCH(QByteArray, data);
+
+ QString decoded;
+ ParserWrapper w;
+ CborError err = w.init(data);
+ QVERIFY2(!err, QByteArray("Got error \"") + cbor_error_string(err) + "\"");
+
+ QCOMPARE(cbor_value_validate_basic(&w.first), CborNoError);
+ QCOMPARE(cbor_value_validate(&w.first, CborValidateBasic), CborNoError);
+ QCOMPARE(cbor_value_validate(&w.first, CborValidateCompleteData), CborNoError);
+}
+
void tst_Parser::validation_data()
{
addValidationColumns();
diff --git a/src/corelib/serialization/qcborcommon_p.h b/src/corelib/serialization/qcborcommon_p.h
index 69e80cb9d6b..b80451be4bc 100644
--- a/src/corelib/serialization/qcborcommon_p.h
+++ b/src/corelib/serialization/qcborcommon_p.h
@@ -32,6 +32,7 @@ QT_WARNING_DISABLE_GCC("-Wunused-function")
QT_WARNING_DISABLE_CLANG("-Wunused-function")
QT_WARNING_DISABLE_CLANG("-Wundefined-internal")
+#define CBOR_NO_HALF_FLOAT_TYPE 1
#define CBOR_NO_VALIDATION_API 1
#define CBOR_NO_PRETTY_API 1
#define CBOR_API static inline
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index cf4679b2156..6d43a5d9eb3 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -1487,6 +1487,7 @@ QT_WARNING_DISABLE_CLANG("-Wunused-function")
QT_WARNING_DISABLE_CLANG("-Wundefined-internal")
QT_WARNING_DISABLE_MSVC(4334) // '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
+#define CBOR_NO_HALF_FLOAT_TYPE 1
#define CBOR_ENCODER_WRITER_CONTROL 1
#define CBOR_ENCODER_WRITE_FUNCTION CborDevice::callback