Do a static_cast in bit-blasts that are UB
Without this, building Qt and Qt applications fails with GCC 8. The errors look like this: writing to an object of type ‘class QPointer<QQuickPointerHandler>’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess] Task-number: QTBUG-65691 Change-Id: Ie5a30814125deca7a160b9a61f5aa3f944ee1ac9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
a87b549edf
commit
342bb5b03a
@ -65,10 +65,10 @@ public:
|
|||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
// ### Qt 6: remove; the compiler-generated ones are fine!
|
// ### Qt 6: remove; the compiler-generated ones are fine!
|
||||||
QMatrix &operator=(QMatrix &&other) Q_DECL_NOTHROW // = default
|
QMatrix &operator=(QMatrix &&other) Q_DECL_NOTHROW // = default
|
||||||
{ memcpy(this, &other, sizeof(QMatrix)); return *this; }
|
{ memcpy(static_cast<void *>(this), static_cast<void *>(&other), sizeof(QMatrix)); return *this; }
|
||||||
QMatrix &operator=(const QMatrix &) Q_DECL_NOTHROW; // = default
|
QMatrix &operator=(const QMatrix &) Q_DECL_NOTHROW; // = default
|
||||||
QMatrix(QMatrix &&other) Q_DECL_NOTHROW // = default
|
QMatrix(QMatrix &&other) Q_DECL_NOTHROW // = default
|
||||||
{ memcpy(this, &other, sizeof(QMatrix)); }
|
{ memcpy(static_cast<void *>(this), static_cast<void *>(&other), sizeof(QMatrix)); }
|
||||||
QMatrix(const QMatrix &other) Q_DECL_NOTHROW; // = default
|
QMatrix(const QMatrix &other) Q_DECL_NOTHROW; // = default
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -78,14 +78,14 @@ public:
|
|||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
// ### Qt 6: remove; the compiler-generated ones are fine!
|
// ### Qt 6: remove; the compiler-generated ones are fine!
|
||||||
QTransform &operator=(QTransform &&other) Q_DECL_NOTHROW // = default
|
QTransform &operator=(QTransform &&other) Q_DECL_NOTHROW // = default
|
||||||
{ memcpy(this, &other, sizeof(QTransform)); return *this; }
|
{ memcpy(static_cast<void *>(this), static_cast<void *>(&other), sizeof(QTransform)); return *this; }
|
||||||
QTransform &operator=(const QTransform &) Q_DECL_NOTHROW; // = default
|
QTransform &operator=(const QTransform &) Q_DECL_NOTHROW; // = default
|
||||||
QTransform(QTransform &&other) Q_DECL_NOTHROW // = default
|
QTransform(QTransform &&other) Q_DECL_NOTHROW // = default
|
||||||
: affine(Qt::Uninitialized)
|
: affine(Qt::Uninitialized)
|
||||||
{ memcpy(this, &other, sizeof(QTransform)); }
|
{ memcpy(static_cast<void *>(this), static_cast<void *>(&other), sizeof(QTransform)); }
|
||||||
QTransform(const QTransform &other) Q_DECL_NOTHROW // = default
|
QTransform(const QTransform &other) Q_DECL_NOTHROW // = default
|
||||||
: affine(Qt::Uninitialized)
|
: affine(Qt::Uninitialized)
|
||||||
{ memcpy(this, &other, sizeof(QTransform)); }
|
{ memcpy(static_cast<void *>(this), static_cast<const void *>(&other), sizeof(QTransform)); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool isAffine() const;
|
bool isAffine() const;
|
||||||
|
@ -236,13 +236,13 @@ struct QGlyphLayout
|
|||||||
last = numGlyphs;
|
last = numGlyphs;
|
||||||
if (first == 0 && last == numGlyphs
|
if (first == 0 && last == numGlyphs
|
||||||
&& reinterpret_cast<char *>(offsets + numGlyphs) == reinterpret_cast<char *>(glyphs)) {
|
&& reinterpret_cast<char *>(offsets + numGlyphs) == reinterpret_cast<char *>(glyphs)) {
|
||||||
memset(offsets, 0, (numGlyphs * SpaceNeeded));
|
memset(static_cast<void *>(offsets), 0, (numGlyphs * SpaceNeeded));
|
||||||
} else {
|
} else {
|
||||||
const int num = last - first;
|
const int num = last - first;
|
||||||
memset(offsets + first, 0, num * sizeof(QFixedPoint));
|
memset(static_cast<void *>(offsets + first), 0, num * sizeof(QFixedPoint));
|
||||||
memset(glyphs + first, 0, num * sizeof(glyph_t));
|
memset(glyphs + first, 0, num * sizeof(glyph_t));
|
||||||
memset(advances + first, 0, num * sizeof(QFixed));
|
memset(static_cast<void *>(advances + first), 0, num * sizeof(QFixed));
|
||||||
memset(justifications + first, 0, num * sizeof(QGlyphJustification));
|
memset(static_cast<void *>(justifications + first), 0, num * sizeof(QGlyphJustification));
|
||||||
memset(attributes + first, 0, num * sizeof(QGlyphAttributes));
|
memset(attributes + first, 0, num * sizeof(QGlyphAttributes));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,9 +154,9 @@ public:
|
|||||||
iterator(const iterator &o) Q_DECL_NOTHROW; // = default
|
iterator(const iterator &o) Q_DECL_NOTHROW; // = default
|
||||||
iterator &operator=(const iterator &o) Q_DECL_NOTHROW; // = default
|
iterator &operator=(const iterator &o) Q_DECL_NOTHROW; // = default
|
||||||
iterator(iterator &&other) Q_DECL_NOTHROW // = default
|
iterator(iterator &&other) Q_DECL_NOTHROW // = default
|
||||||
{ memcpy(this, &other, sizeof(iterator)); }
|
{ memcpy(static_cast<void *>(this), static_cast<void *>(&other), sizeof(iterator)); }
|
||||||
iterator &operator=(iterator &&other) Q_DECL_NOTHROW // = default
|
iterator &operator=(iterator &&other) Q_DECL_NOTHROW // = default
|
||||||
{ memcpy(this, &other, sizeof(iterator)); return *this; }
|
{ memcpy(static_cast<void *>(this), static_cast<void *>(&other), sizeof(iterator)); return *this; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QTextFrame *parentFrame() const { return f; }
|
QTextFrame *parentFrame() const { return f; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user