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>
This commit is contained in:
Mitch Curtis 2024-03-26 10:39:43 +08:00
parent 907181cb21
commit baa44b9ddf

View File

@ -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