summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2020-06-11 11:35:19 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2020-06-19 19:38:23 +0200
commit3e1d03b1eaf6a5e842bed4ae4f9bb8cca05e5b31 (patch)
tree74dd3478dce3bc96121238300fc0bbc6ef97fc3e /src/gui
parent5b686e208ffc68f9f660d36c468280d50a40e3ad (diff)
Port Q_STATIC_ASSERT(_X) to static_assert
There is no reason for keep using our macro now that we have C++17. The macro itself is left in for the moment being, as well as its detection logic, because it's needed for C code (not everything supports C11 yet). A few more cleanups will arrive in the next few patches. Note that this is a mere search/replace; some places were using double braces to work around the presence of commas in a macro, no attempt has been done to fix those. tst_qglobal had just some minor changes to keep testing the macro. Change-Id: I1c1c397d9f3e63db3338842bf350c9069ea57639 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/image/qimage.cpp2
-rw-r--r--src/gui/image/qimagereaderwriterhelpers_p.h2
-rw-r--r--src/gui/kernel/qkeysequence.cpp6
-rw-r--r--src/gui/kernel/qpalette.cpp2
-rw-r--r--src/gui/kernel/qpixelformat.cpp2
-rw-r--r--src/gui/kernel/qpixelformat.h6
-rw-r--r--src/gui/math3d/qvector2d.cpp14
-rw-r--r--src/gui/math3d/qvector3d.cpp16
-rw-r--r--src/gui/math3d/qvector4d.cpp18
-rw-r--r--src/gui/painting/qdrawhelper.cpp6
-rw-r--r--src/gui/painting/qpagesize.cpp2
-rw-r--r--src/gui/painting/qpixellayout.cpp4
-rw-r--r--src/gui/text/qfontdatabase.cpp4
-rw-r--r--src/gui/text/qharfbuzzng.cpp2
-rw-r--r--src/gui/text/qtextengine_p.h2
-rw-r--r--src/gui/text/qtexthtmlparser.cpp2
-rw-r--r--src/gui/text/qtextmarkdownimporter.cpp30
-rw-r--r--src/gui/text/unix/qfontconfigdatabase.cpp6
-rw-r--r--src/gui/util/qgridlayoutengine_p.h4
19 files changed, 65 insertions, 65 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 27969cabb6..bcb4288631 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -5265,7 +5265,7 @@ static Q_CONSTEXPR QPixelFormat pixelformats[] = {
/*INTERPRETATION*/ QPixelFormat::UnsignedByte,
/*BYTE ORDER*/ QPixelFormat::CurrentSystemEndian),
};
-Q_STATIC_ASSERT(sizeof(pixelformats) / sizeof(*pixelformats) == QImage::NImageFormats);
+static_assert(sizeof(pixelformats) / sizeof(*pixelformats) == QImage::NImageFormats);
/*!
Returns the QImage::Format as a QPixelFormat
diff --git a/src/gui/image/qimagereaderwriterhelpers_p.h b/src/gui/image/qimagereaderwriterhelpers_p.h
index 6fe418a8ab..ae1141b3ab 100644
--- a/src/gui/image/qimagereaderwriterhelpers_p.h
+++ b/src/gui/image/qimagereaderwriterhelpers_p.h
@@ -118,7 +118,7 @@ static const _qt_BuiltInFormatStruct _qt_BuiltInFormats[] = {
{"xpm", "x-xpixmap"},
#endif
};
-Q_STATIC_ASSERT(_qt_NumFormats == sizeof _qt_BuiltInFormats / sizeof *_qt_BuiltInFormats);
+static_assert(_qt_NumFormats == sizeof _qt_BuiltInFormats / sizeof *_qt_BuiltInFormats);
#ifndef QT_NO_IMAGEFORMATPLUGIN
QSharedPointer<QFactoryLoader> pluginLoader();
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index c54f10fd5e..92737db8d3 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -851,7 +851,7 @@ QKeySequence::QKeySequence(const QString &key, QKeySequence::SequenceFormat form
assign(key, format);
}
-Q_STATIC_ASSERT_X(QKeySequencePrivate::MaxKeyCount == 4, "Change docs and ctor impl below");
+static_assert(QKeySequencePrivate::MaxKeyCount == 4, "Change docs and ctor impl below");
/*!
Constructs a key sequence with up to 4 keys \a k1, \a k2,
\a k3 and \a k4.
@@ -915,7 +915,7 @@ void QKeySequence::setKey(int key, int index)
d->key[index] = key;
}
-Q_STATIC_ASSERT_X(QKeySequencePrivate::MaxKeyCount == 4, "Change docs below");
+static_assert(QKeySequencePrivate::MaxKeyCount == 4, "Change docs below");
/*!
Returns the number of keys in the key sequence.
The maximum is 4.
@@ -1609,7 +1609,7 @@ QString QKeySequence::listToString(const QList<QKeySequence> &list, SequenceForm
*/
QDataStream &operator<<(QDataStream &s, const QKeySequence &keysequence)
{
- Q_STATIC_ASSERT_X(QKeySequencePrivate::MaxKeyCount == 4, "Forgot to adapt QDataStream &operator<<(QDataStream &s, const QKeySequence &keysequence) to new QKeySequence::MaxKeyCount");
+ static_assert(QKeySequencePrivate::MaxKeyCount == 4, "Forgot to adapt QDataStream &operator<<(QDataStream &s, const QKeySequence &keysequence) to new QKeySequence::MaxKeyCount");
const bool extended = s.version() >= 5 && keysequence.count() > 1;
s << quint32(extended ? 4 : 1) << quint32(keysequence.d->key[0]);
if (extended) {
diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp
index 92c43688cc..2c636dc553 100644
--- a/src/gui/kernel/qpalette.cpp
+++ b/src/gui/kernel/qpalette.cpp
@@ -61,7 +61,7 @@ static constexpr QPalette::ResolveMask bitPosition(QPalette::ColorGroup colorGro
return colorRole + colorRoleOffset(colorGroup);
}
-Q_STATIC_ASSERT_X(bitPosition(QPalette::ColorGroup(QPalette::NColorGroups - 1),
+static_assert(bitPosition(QPalette::ColorGroup(QPalette::NColorGroups - 1),
QPalette::ColorRole(QPalette::NColorRoles - 1))
< sizeof(QPalette::ResolveMask) * CHAR_BIT,
"The resolve mask type is not wide enough to fit the entire bit mask.");
diff --git a/src/gui/kernel/qpixelformat.cpp b/src/gui/kernel/qpixelformat.cpp
index 3100d13398..7a47dd472c 100644
--- a/src/gui/kernel/qpixelformat.cpp
+++ b/src/gui/kernel/qpixelformat.cpp
@@ -521,7 +521,7 @@ QT_BEGIN_NAMESPACE
\internal
*/
-Q_STATIC_ASSERT(sizeof(QPixelFormat) == sizeof(quint64));
+static_assert(sizeof(QPixelFormat) == sizeof(quint64));
namespace QtPrivate {
diff --git a/src/gui/kernel/qpixelformat.h b/src/gui/kernel/qpixelformat.h
index a041a39fc1..a0bb300c12 100644
--- a/src/gui/kernel/qpixelformat.h
+++ b/src/gui/kernel/qpixelformat.h
@@ -92,8 +92,8 @@ class QPixelFormat
TotalFieldWidthByOffsets = UnusedField + UnusedFieldWidth
};
- Q_STATIC_ASSERT(uint(TotalFieldWidthByWidths) == uint(TotalFieldWidthByOffsets));
- Q_STATIC_ASSERT(uint(TotalFieldWidthByWidths) == 8 * sizeof(quint64));
+ static_assert(uint(TotalFieldWidthByWidths) == uint(TotalFieldWidthByOffsets));
+ static_assert(uint(TotalFieldWidthByWidths) == 8 * sizeof(quint64));
Q_DECL_CONSTEXPR inline uchar get(Field offset, FieldWidth width) const noexcept
{ return uchar((data >> uint(offset)) & ((Q_UINT64_C(1) << uint(width)) - Q_UINT64_C(1))); }
@@ -228,7 +228,7 @@ private:
friend Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline bool operator!=(QPixelFormat fmt1, QPixelFormat fmt2)
{ return !(fmt1 == fmt2); }
};
-Q_STATIC_ASSERT(sizeof(QPixelFormat) == sizeof(quint64));
+static_assert(sizeof(QPixelFormat) == sizeof(quint64));
Q_DECLARE_TYPEINFO(QPixelFormat, Q_PRIMITIVE_TYPE);
diff --git a/src/gui/math3d/qvector2d.cpp b/src/gui/math3d/qvector2d.cpp
index 5f651cf376..9cd4b5924a 100644
--- a/src/gui/math3d/qvector2d.cpp
+++ b/src/gui/math3d/qvector2d.cpp
@@ -49,8 +49,8 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_VECTOR2D
-Q_STATIC_ASSERT_X(std::is_standard_layout<QVector2D>::value, "QVector2D is supposed to be standard layout");
-Q_STATIC_ASSERT_X(sizeof(QVector2D) == sizeof(float) * 2, "QVector2D is not supposed to have padding at the end");
+static_assert(std::is_standard_layout<QVector2D>::value, "QVector2D is supposed to be standard layout");
+static_assert(sizeof(QVector2D) == sizeof(float) * 2, "QVector2D is not supposed to have padding at the end");
// QVector2D used to be defined as class QVector2D { float x, y; };,
// now instead it is defined as classs QVector2D { float v[2]; };.
@@ -69,15 +69,15 @@ struct QVector2DNew
float v[2];
};
-Q_STATIC_ASSERT_X(std::is_standard_layout<QVector2DOld>::value, "Binary compatibility break in QVector2D");
-Q_STATIC_ASSERT_X(std::is_standard_layout<QVector2DNew>::value, "Binary compatibility break in QVector2D");
+static_assert(std::is_standard_layout<QVector2DOld>::value, "Binary compatibility break in QVector2D");
+static_assert(std::is_standard_layout<QVector2DNew>::value, "Binary compatibility break in QVector2D");
-Q_STATIC_ASSERT_X(sizeof(QVector2DOld) == sizeof(QVector2DNew), "Binary compatibility break in QVector2D");
+static_assert(sizeof(QVector2DOld) == sizeof(QVector2DNew), "Binary compatibility break in QVector2D");
// requires a constexpr offsetof
#if !defined(Q_CC_MSVC) || (_MSC_VER >= 1910)
-Q_STATIC_ASSERT_X(offsetof(QVector2DOld, x) == offsetof(QVector2DNew, v) + sizeof(QVector2DNew::v[0]) * 0, "Binary compatibility break in QVector2D");
-Q_STATIC_ASSERT_X(offsetof(QVector2DOld, y) == offsetof(QVector2DNew, v) + sizeof(QVector2DNew::v[0]) * 1, "Binary compatibility break in QVector2D");
+static_assert(offsetof(QVector2DOld, x) == offsetof(QVector2DNew, v) + sizeof(QVector2DNew::v[0]) * 0, "Binary compatibility break in QVector2D");
+static_assert(offsetof(QVector2DOld, y) == offsetof(QVector2DNew, v) + sizeof(QVector2DNew::v[0]) * 1, "Binary compatibility break in QVector2D");
#endif
} // anonymous namespace
diff --git a/src/gui/math3d/qvector3d.cpp b/src/gui/math3d/qvector3d.cpp
index 08c3de99d2..afe1e4789a 100644
--- a/src/gui/math3d/qvector3d.cpp
+++ b/src/gui/math3d/qvector3d.cpp
@@ -51,8 +51,8 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_VECTOR3D
-Q_STATIC_ASSERT_X(std::is_standard_layout<QVector3D>::value, "QVector3D is supposed to be standard layout");
-Q_STATIC_ASSERT_X(sizeof(QVector3D) == sizeof(float) * 3, "QVector3D is not supposed to have padding at the end");
+static_assert(std::is_standard_layout<QVector3D>::value, "QVector3D is supposed to be standard layout");
+static_assert(sizeof(QVector3D) == sizeof(float) * 3, "QVector3D is not supposed to have padding at the end");
// QVector3D used to be defined as class QVector3D { float x, y, z; };,
// now instead it is defined as classs QVector3D { float v[3]; };.
@@ -71,16 +71,16 @@ struct QVector3DNew
float v[3];
};
-Q_STATIC_ASSERT_X(std::is_standard_layout<QVector3DOld>::value, "Binary compatibility break in QVector3D");
-Q_STATIC_ASSERT_X(std::is_standard_layout<QVector3DNew>::value, "Binary compatibility break in QVector3D");
+static_assert(std::is_standard_layout<QVector3DOld>::value, "Binary compatibility break in QVector3D");
+static_assert(std::is_standard_layout<QVector3DNew>::value, "Binary compatibility break in QVector3D");
-Q_STATIC_ASSERT_X(sizeof(QVector3DOld) == sizeof(QVector3DNew), "Binary compatibility break in QVector3D");
+static_assert(sizeof(QVector3DOld) == sizeof(QVector3DNew), "Binary compatibility break in QVector3D");
// requires a constexpr offsetof
#if !defined(Q_CC_MSVC) || (_MSC_VER >= 1910)
-Q_STATIC_ASSERT_X(offsetof(QVector3DOld, x) == offsetof(QVector3DNew, v) + sizeof(QVector3DNew::v[0]) * 0, "Binary compatibility break in QVector3D");
-Q_STATIC_ASSERT_X(offsetof(QVector3DOld, y) == offsetof(QVector3DNew, v) + sizeof(QVector3DNew::v[0]) * 1, "Binary compatibility break in QVector3D");
-Q_STATIC_ASSERT_X(offsetof(QVector3DOld, z) == offsetof(QVector3DNew, v) + sizeof(QVector3DNew::v[0]) * 2, "Binary compatibility break in QVector3D");
+static_assert(offsetof(QVector3DOld, x) == offsetof(QVector3DNew, v) + sizeof(QVector3DNew::v[0]) * 0, "Binary compatibility break in QVector3D");
+static_assert(offsetof(QVector3DOld, y) == offsetof(QVector3DNew, v) + sizeof(QVector3DNew::v[0]) * 1, "Binary compatibility break in QVector3D");
+static_assert(offsetof(QVector3DOld, z) == offsetof(QVector3DNew, v) + sizeof(QVector3DNew::v[0]) * 2, "Binary compatibility break in QVector3D");
#endif
diff --git a/src/gui/math3d/qvector4d.cpp b/src/gui/math3d/qvector4d.cpp
index 070ea7454e..43cfb0c61c 100644
--- a/src/gui/math3d/qvector4d.cpp
+++ b/src/gui/math3d/qvector4d.cpp
@@ -49,8 +49,8 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_VECTOR4D
-Q_STATIC_ASSERT_X(std::is_standard_layout<QVector4D>::value, "QVector4D is supposed to be standard layout");
-Q_STATIC_ASSERT_X(sizeof(QVector4D) == sizeof(float) * 4, "QVector4D is not supposed to have padding at the end");
+static_assert(std::is_standard_layout<QVector4D>::value, "QVector4D is supposed to be standard layout");
+static_assert(sizeof(QVector4D) == sizeof(float) * 4, "QVector4D is not supposed to have padding at the end");
// QVector4D used to be defined as class QVector4D { float x, y, z, w; };,
// now instead it is defined as classs QVector4D { float v[4]; };.
@@ -69,17 +69,17 @@ struct QVector4DNew
float v[4];
};
-Q_STATIC_ASSERT_X(std::is_standard_layout<QVector4DOld>::value, "Binary compatibility break in QVector4D");
-Q_STATIC_ASSERT_X(std::is_standard_layout<QVector4DNew>::value, "Binary compatibility break in QVector4D");
+static_assert(std::is_standard_layout<QVector4DOld>::value, "Binary compatibility break in QVector4D");
+static_assert(std::is_standard_layout<QVector4DNew>::value, "Binary compatibility break in QVector4D");
-Q_STATIC_ASSERT_X(sizeof(QVector4DOld) == sizeof(QVector4DNew), "Binary compatibility break in QVector4D");
+static_assert(sizeof(QVector4DOld) == sizeof(QVector4DNew), "Binary compatibility break in QVector4D");
// requires a constexpr offsetof
#if !defined(Q_CC_MSVC) || (_MSC_VER >= 1910)
-Q_STATIC_ASSERT_X(offsetof(QVector4DOld, x) == offsetof(QVector4DNew, v) + sizeof(QVector4DNew::v[0]) * 0, "Binary compatibility break in QVector4D");
-Q_STATIC_ASSERT_X(offsetof(QVector4DOld, y) == offsetof(QVector4DNew, v) + sizeof(QVector4DNew::v[0]) * 1, "Binary compatibility break in QVector4D");
-Q_STATIC_ASSERT_X(offsetof(QVector4DOld, z) == offsetof(QVector4DNew, v) + sizeof(QVector4DNew::v[0]) * 2, "Binary compatibility break in QVector4D");
-Q_STATIC_ASSERT_X(offsetof(QVector4DOld, w) == offsetof(QVector4DNew, v) + sizeof(QVector4DNew::v[0]) * 3, "Binary compatibility break in QVector4D");
+static_assert(offsetof(QVector4DOld, x) == offsetof(QVector4DNew, v) + sizeof(QVector4DNew::v[0]) * 0, "Binary compatibility break in QVector4D");
+static_assert(offsetof(QVector4DOld, y) == offsetof(QVector4DNew, v) + sizeof(QVector4DNew::v[0]) * 1, "Binary compatibility break in QVector4D");
+static_assert(offsetof(QVector4DOld, z) == offsetof(QVector4DNew, v) + sizeof(QVector4DNew::v[0]) * 2, "Binary compatibility break in QVector4D");
+static_assert(offsetof(QVector4DOld, w) == offsetof(QVector4DNew, v) + sizeof(QVector4DNew::v[0]) * 3, "Binary compatibility break in QVector4D");
#endif
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 3b76635b7a..10aa78ba22 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -487,7 +487,7 @@ static const QRgba64 *QT_FASTCALL fetchUntransformedRGBA64PM(QRgba64 *, const Op
template<TextureBlendType blendType>
inline void fetchTransformed_pixelBounds(int max, int l1, int l2, int &v)
{
- Q_STATIC_ASSERT(blendType == BlendTransformed || blendType == BlendTransformedTiled);
+ static_assert(blendType == BlendTransformed || blendType == BlendTransformedTiled);
if (blendType == BlendTransformedTiled) {
if (v < 0 || v >= max) {
v %= max;
@@ -519,7 +519,7 @@ template<TextureBlendType blendType, QPixelLayout::BPP bpp, typename T>
static void QT_FASTCALL fetchTransformed_fetcher(T *buffer, const QSpanData *data,
int y, int x, int length)
{
- Q_STATIC_ASSERT(blendType == BlendTransformed || blendType == BlendTransformedTiled);
+ static_assert(blendType == BlendTransformed || blendType == BlendTransformedTiled);
const QTextureData &image = data->texture;
const qreal cx = x + qreal(0.5);
@@ -683,7 +683,7 @@ template<TextureBlendType blendType, QPixelLayout::BPP bpp>
static const uint *QT_FASTCALL fetchTransformed(uint *buffer, const Operator *, const QSpanData *data,
int y, int x, int length)
{
- Q_STATIC_ASSERT(blendType == BlendTransformed || blendType == BlendTransformedTiled);
+ static_assert(blendType == BlendTransformed || blendType == BlendTransformedTiled);
const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
fetchTransformed_fetcher<blendType, bpp, uint>(buffer, data, y, x, length);
layout->convertToARGB32PM(buffer, length, data->texture.colorTable);
diff --git a/src/gui/painting/qpagesize.cpp b/src/gui/painting/qpagesize.cpp
index 944e35c69c..324881ec6b 100644
--- a/src/gui/painting/qpagesize.cpp
+++ b/src/gui/painting/qpagesize.cpp
@@ -385,7 +385,7 @@ static const StandardPageSize qt_pageSizes[] = {
};
static const int pageSizesCount = int(sizeof(qt_pageSizes) / sizeof(qt_pageSizes[0]));
-Q_STATIC_ASSERT(pageSizesCount == QPageSize::LastPageSize + 1);
+static_assert(pageSizesCount == QPageSize::LastPageSize + 1);
// Return key name for PageSize
static QString qt_keyForPageSizeId(QPageSize::PageSizeId id)
diff --git a/src/gui/painting/qpixellayout.cpp b/src/gui/painting/qpixellayout.cpp
index d0fb8f0bb4..42d14bb3b3 100644
--- a/src/gui/painting/qpixellayout.cpp
+++ b/src/gui/painting/qpixellayout.cpp
@@ -512,7 +512,7 @@ static void QT_FASTCALL rbSwap(uchar *dst, const uchar *src, int count)
Q_CONSTEXPR uchar bWidth = blueWidth<Format>();
Q_CONSTEXPR uchar bShift = blueShift<Format>();
#ifdef Q_COMPILER_CONSTEXPR
- Q_STATIC_ASSERT(rWidth == bWidth);
+ static_assert(rWidth == bWidth);
#endif
Q_CONSTEXPR uint redBlueMask = (1 << rWidth) - 1;
Q_CONSTEXPR uint alphaGreenMask = (((1 << aWidth) - 1) << aShift)
@@ -1426,7 +1426,7 @@ QPixelLayout qPixelLayouts[QImage::NImageFormats] = {
pixelLayoutRGB<QImage::Format_BGR888>(),
};
-Q_STATIC_ASSERT(sizeof(qPixelLayouts) / sizeof(*qPixelLayouts) == QImage::NImageFormats);
+static_assert(sizeof(qPixelLayouts) / sizeof(*qPixelLayouts) == QImage::NImageFormats);
static void QT_FASTCALL convertFromRgb64(uint *dest, const QRgba64 *src, int length)
{
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index b5a9c5bb45..2ec2263321 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -390,7 +390,7 @@ static const int scriptForWritingSystem[] = {
QChar::Script_Nko // Nko
};
-Q_STATIC_ASSERT(sizeof(scriptForWritingSystem) / sizeof(scriptForWritingSystem[0]) == QFontDatabase::WritingSystemsCount);
+static_assert(sizeof(scriptForWritingSystem) / sizeof(scriptForWritingSystem[0]) == QFontDatabase::WritingSystemsCount);
Q_GUI_EXPORT int qt_script_for_writing_system(QFontDatabase::WritingSystem writingSystem)
{
@@ -1328,7 +1328,7 @@ QList<QFontDatabase::WritingSystem> QFontDatabase::writingSystems() const
QT_PREPEND_NAMESPACE(load)();
quint64 writingSystemsFound = 0;
- Q_STATIC_ASSERT(WritingSystemsCount < 64);
+ static_assert(WritingSystemsCount < 64);
for (int i = 0; i < d->count; ++i) {
QtFontFamily *family = d->families[i];
diff --git a/src/gui/text/qharfbuzzng.cpp b/src/gui/text/qharfbuzzng.cpp
index a93f648bc9..ae24b57cbf 100644
--- a/src/gui/text/qharfbuzzng.cpp
+++ b/src/gui/text/qharfbuzzng.cpp
@@ -239,7 +239,7 @@ static const hb_script_t _qtscript_to_hbscript[] = {
hb_script_t(HB_TAG('K', 'h', 'i', 't')), // Script_KhitanSmallScript
hb_script_t(HB_TAG('Y', 'e', 'z', 'i')), // Script_Yezidi
};
-Q_STATIC_ASSERT(QChar::ScriptCount == sizeof(_qtscript_to_hbscript) / sizeof(_qtscript_to_hbscript[0]));
+static_assert(QChar::ScriptCount == sizeof(_qtscript_to_hbscript) / sizeof(_qtscript_to_hbscript[0]));
hb_script_t hb_qt_script_to_script(QChar::Script script)
{
diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h
index ab4dc59594..dab69a8b89 100644
--- a/src/gui/text/qtextengine_p.h
+++ b/src/gui/text/qtextengine_p.h
@@ -189,7 +189,7 @@ struct QGlyphAttributes {
uchar justification : 4;
uchar reserved : 2;
};
-Q_STATIC_ASSERT(sizeof(QGlyphAttributes) == 1);
+static_assert(sizeof(QGlyphAttributes) == 1);
Q_DECLARE_TYPEINFO(QGlyphAttributes, Q_PRIMITIVE_TYPE);
struct QGlyphLayout
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp
index bec636757e..6fed48e9b6 100644
--- a/src/gui/text/qtexthtmlparser.cpp
+++ b/src/gui/text/qtexthtmlparser.cpp
@@ -319,7 +319,7 @@ static const struct QTextHtmlEntity { const char name[9]; char16_t code; } entit
{ "zwj", 0x200d },
{ "zwnj", 0x200c }
};
-Q_STATIC_ASSERT(MAX_ENTITY == sizeof entities / sizeof *entities);
+static_assert(MAX_ENTITY == sizeof entities / sizeof *entities);
#if defined(Q_CC_MSVC) && _MSC_VER < 1600
bool operator<(const QTextHtmlEntity &entity1, const QTextHtmlEntity &entity2)
diff --git a/src/gui/text/qtextmarkdownimporter.cpp b/src/gui/text/qtextmarkdownimporter.cpp
index b5532696f4..caf7c097a3 100644
--- a/src/gui/text/qtextmarkdownimporter.cpp
+++ b/src/gui/text/qtextmarkdownimporter.cpp
@@ -60,21 +60,21 @@ static const QChar Space = QLatin1Char(' ');
// TODO maybe eliminate the margins after all views recognize BlockQuoteLevel, CSS can format it, etc.
static const int BlockQuoteIndent = 40; // pixels, same as in QTextHtmlParserNode::initializeProperties
-Q_STATIC_ASSERT(int(QTextMarkdownImporter::FeatureCollapseWhitespace) == MD_FLAG_COLLAPSEWHITESPACE);
-Q_STATIC_ASSERT(int(QTextMarkdownImporter::FeaturePermissiveATXHeaders) == MD_FLAG_PERMISSIVEATXHEADERS);
-Q_STATIC_ASSERT(int(QTextMarkdownImporter::FeaturePermissiveURLAutoLinks) == MD_FLAG_PERMISSIVEURLAUTOLINKS);
-Q_STATIC_ASSERT(int(QTextMarkdownImporter::FeaturePermissiveMailAutoLinks) == MD_FLAG_PERMISSIVEEMAILAUTOLINKS);
-Q_STATIC_ASSERT(int(QTextMarkdownImporter::FeatureNoIndentedCodeBlocks) == MD_FLAG_NOINDENTEDCODEBLOCKS);
-Q_STATIC_ASSERT(int(QTextMarkdownImporter::FeatureNoHTMLBlocks) == MD_FLAG_NOHTMLBLOCKS);
-Q_STATIC_ASSERT(int(QTextMarkdownImporter::FeatureNoHTMLSpans) == MD_FLAG_NOHTMLSPANS);
-Q_STATIC_ASSERT(int(QTextMarkdownImporter::FeatureTables) == MD_FLAG_TABLES);
-Q_STATIC_ASSERT(int(QTextMarkdownImporter::FeatureStrikeThrough) == MD_FLAG_STRIKETHROUGH);
-Q_STATIC_ASSERT(int(QTextMarkdownImporter::FeaturePermissiveWWWAutoLinks) == MD_FLAG_PERMISSIVEWWWAUTOLINKS);
-Q_STATIC_ASSERT(int(QTextMarkdownImporter::FeaturePermissiveAutoLinks) == MD_FLAG_PERMISSIVEAUTOLINKS);
-Q_STATIC_ASSERT(int(QTextMarkdownImporter::FeatureTasklists) == MD_FLAG_TASKLISTS);
-Q_STATIC_ASSERT(int(QTextMarkdownImporter::FeatureNoHTML) == MD_FLAG_NOHTML);
-Q_STATIC_ASSERT(int(QTextMarkdownImporter::DialectCommonMark) == MD_DIALECT_COMMONMARK);
-Q_STATIC_ASSERT(int(QTextMarkdownImporter::DialectGitHub) == MD_DIALECT_GITHUB);
+static_assert(int(QTextMarkdownImporter::FeatureCollapseWhitespace) == MD_FLAG_COLLAPSEWHITESPACE);
+static_assert(int(QTextMarkdownImporter::FeaturePermissiveATXHeaders) == MD_FLAG_PERMISSIVEATXHEADERS);
+static_assert(int(QTextMarkdownImporter::FeaturePermissiveURLAutoLinks) == MD_FLAG_PERMISSIVEURLAUTOLINKS);
+static_assert(int(QTextMarkdownImporter::FeaturePermissiveMailAutoLinks) == MD_FLAG_PERMISSIVEEMAILAUTOLINKS);
+static_assert(int(QTextMarkdownImporter::FeatureNoIndentedCodeBlocks) == MD_FLAG_NOINDENTEDCODEBLOCKS);
+static_assert(int(QTextMarkdownImporter::FeatureNoHTMLBlocks) == MD_FLAG_NOHTMLBLOCKS);
+static_assert(int(QTextMarkdownImporter::FeatureNoHTMLSpans) == MD_FLAG_NOHTMLSPANS);
+static_assert(int(QTextMarkdownImporter::FeatureTables) == MD_FLAG_TABLES);
+static_assert(int(QTextMarkdownImporter::FeatureStrikeThrough) == MD_FLAG_STRIKETHROUGH);
+static_assert(int(QTextMarkdownImporter::FeaturePermissiveWWWAutoLinks) == MD_FLAG_PERMISSIVEWWWAUTOLINKS);
+static_assert(int(QTextMarkdownImporter::FeaturePermissiveAutoLinks) == MD_FLAG_PERMISSIVEAUTOLINKS);
+static_assert(int(QTextMarkdownImporter::FeatureTasklists) == MD_FLAG_TASKLISTS);
+static_assert(int(QTextMarkdownImporter::FeatureNoHTML) == MD_FLAG_NOHTML);
+static_assert(int(QTextMarkdownImporter::DialectCommonMark) == MD_DIALECT_COMMONMARK);
+static_assert(int(QTextMarkdownImporter::DialectGitHub) == MD_DIALECT_GITHUB);
// --------------------------------------------------------
// MD4C callback function wrappers
diff --git a/src/gui/text/unix/qfontconfigdatabase.cpp b/src/gui/text/unix/qfontconfigdatabase.cpp
index c6b0485ec5..624fd1f9a5 100644
--- a/src/gui/text/unix/qfontconfigdatabase.cpp
+++ b/src/gui/text/unix/qfontconfigdatabase.cpp
@@ -279,7 +279,7 @@ static const char specialLanguages[][6] = {
"", // KhitanSmallScript
"" // Yezidi
};
-Q_STATIC_ASSERT(sizeof specialLanguages / sizeof *specialLanguages == QChar::ScriptCount);
+static_assert(sizeof specialLanguages / sizeof *specialLanguages == QChar::ScriptCount);
// this could become a list of all languages used for each writing
// system, instead of using the single most common language.
@@ -319,7 +319,7 @@ static const char languageForWritingSystem[][6] = {
"non", // Runic
"man" // N'Ko
};
-Q_STATIC_ASSERT(sizeof languageForWritingSystem / sizeof *languageForWritingSystem == QFontDatabase::WritingSystemsCount);
+static_assert(sizeof languageForWritingSystem / sizeof *languageForWritingSystem == QFontDatabase::WritingSystemsCount);
#if FC_VERSION >= 20297
// Newer FontConfig let's us sort out fonts that report certain scripts support,
@@ -361,7 +361,7 @@ static const char capabilityForWritingSystem[][5] = {
"", // Runic
"nko " // N'Ko
};
-Q_STATIC_ASSERT(sizeof(capabilityForWritingSystem) / sizeof(*capabilityForWritingSystem) == QFontDatabase::WritingSystemsCount);
+static_assert(sizeof(capabilityForWritingSystem) / sizeof(*capabilityForWritingSystem) == QFontDatabase::WritingSystemsCount);
#endif
static const char *getFcFamilyForStyleHint(const QFont::StyleHint style)
diff --git a/src/gui/util/qgridlayoutengine_p.h b/src/gui/util/qgridlayoutengine_p.h
index 33bd4ad917..19ed07d30d 100644
--- a/src/gui/util/qgridlayoutengine_p.h
+++ b/src/gui/util/qgridlayoutengine_p.h
@@ -105,8 +105,8 @@ template <typename T>
class QHVContainer {
T m_data[2];
- Q_STATIC_ASSERT(Qt::Horizontal == 0x1);
- Q_STATIC_ASSERT(Qt::Vertical == 0x2);
+ static_assert(Qt::Horizontal == 0x1);
+ static_assert(Qt::Vertical == 0x2);
static constexpr int map(Qt::Orientation o) noexcept
{
return int(o) - 1;