diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2024-03-26 10:39:43 +0800 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2024-04-04 11:31:51 +0800 |
commit | baa44b9ddfa0fe92275ff4f27d7f2b1a9be10486 (patch) | |
tree | ebcf7ad3ddfccd27cefd064fef224281df9138c6 /src/corelib/kernel | |
parent | 907181cb21fa79059f226fb1eeac8da938031368 (diff) |
Qt::ApplicationAttribute: static_assert that we don't go higher than 32
Because we can't support it on 32 bit operating systems.
Task-number: QTBUG-69558
Change-Id: I406ecccdf039d7d4f4c24268c92c91e367655cba
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r-- | src/corelib/kernel/qcoreapplication.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 7e6f21e8a6..2244f976a4 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -1022,7 +1022,6 @@ bool QCoreApplication::isSetuidAllowed() return QCoreApplicationPrivate::setuidAllowed; } - /*! Sets the attribute \a attribute if \a on is true; otherwise clears the attribute. @@ -1035,6 +1034,10 @@ bool QCoreApplication::isSetuidAllowed() */ void QCoreApplication::setAttribute(Qt::ApplicationAttribute attribute, bool on) { + // Since we bit-shift these values, we can't go higher than 32 on 32 bit operating systems + // without changing the storage type of QCoreApplicationPrivate::attribs to quint64. + static_assert(Qt::AA_AttributeCount <= sizeof(QCoreApplicationPrivate::attribs) * CHAR_BIT); + if (on) QCoreApplicationPrivate::attribs |= 1 << attribute; else |