summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-06-24 09:23:47 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-07-06 17:56:58 +0200
commit0587d4752d8fb814d47a599130d98724d78b1525 (patch)
tree41199b3cc239c15297e3028a7c23640d3fff5d52 /src/corelib/io
parentc0385f0cee52a5bb17e95cbdedda3dbff5f60b53 (diff)
Remove uses of Q_ATOMIC_INT{8,16,32}_IS_SUPPORTED
It's always true these days, assert so in qatomic.cpp and tst_QAtomicInteger. Update the docs. Pick-to: 6.4 Change-Id: I3684cff96c1d2e05677314e29514cc279bd6b1a1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qloggingcategory.cpp19
-rw-r--r--src/corelib/io/qloggingcategory.h16
2 files changed, 1 insertions, 34 deletions
diff --git a/src/corelib/io/qloggingcategory.cpp b/src/corelib/io/qloggingcategory.cpp
index 201a50317b..bdae7e7f50 100644
--- a/src/corelib/io/qloggingcategory.cpp
+++ b/src/corelib/io/qloggingcategory.cpp
@@ -9,18 +9,6 @@ QT_BEGIN_NAMESPACE
const char qtDefaultCategoryName[] = "default";
Q_GLOBAL_STATIC(QLoggingCategory, qtDefaultCategory, qtDefaultCategoryName)
-#ifndef Q_ATOMIC_INT8_IS_SUPPORTED
-static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift)
-{
- const int bit = 1 << shift;
-
- if (enable)
- atomic->fetchAndOrRelaxed(bit);
- else
- atomic->fetchAndAndRelaxed(~bit);
-}
-#endif
-
/*!
\class QLoggingCategory
\inmodule QtCore
@@ -291,17 +279,10 @@ bool QLoggingCategory::isEnabled(QtMsgType msgtype) const
void QLoggingCategory::setEnabled(QtMsgType type, bool enable)
{
switch (type) {
-#ifdef Q_ATOMIC_INT8_IS_SUPPORTED
case QtDebugMsg: bools.enabledDebug.storeRelaxed(enable); break;
case QtInfoMsg: bools.enabledInfo.storeRelaxed(enable); break;
case QtWarningMsg: bools.enabledWarning.storeRelaxed(enable); break;
case QtCriticalMsg: bools.enabledCritical.storeRelaxed(enable); break;
-#else
- case QtDebugMsg: setBoolLane(&enabled, enable, DebugShift); break;
- case QtInfoMsg: setBoolLane(&enabled, enable, InfoShift); break;
- case QtWarningMsg: setBoolLane(&enabled, enable, WarningShift); break;
- case QtCriticalMsg: setBoolLane(&enabled, enable, CriticalShift); break;
-#endif
case QtFatalMsg: break;
}
}
diff --git a/src/corelib/io/qloggingcategory.h b/src/corelib/io/qloggingcategory.h
index ae8425142a..ca606bfae5 100644
--- a/src/corelib/io/qloggingcategory.h
+++ b/src/corelib/io/qloggingcategory.h
@@ -19,17 +19,11 @@ public:
bool isEnabled(QtMsgType type) const;
void setEnabled(QtMsgType type, bool enable);
-#ifdef Q_ATOMIC_INT8_IS_SUPPORTED
bool isDebugEnabled() const { return bools.enabledDebug.loadRelaxed(); }
bool isInfoEnabled() const { return bools.enabledInfo.loadRelaxed(); }
bool isWarningEnabled() const { return bools.enabledWarning.loadRelaxed(); }
bool isCriticalEnabled() const { return bools.enabledCritical.loadRelaxed(); }
-#else
- bool isDebugEnabled() const { return enabled.loadRelaxed() >> DebugShift & 1; }
- bool isInfoEnabled() const { return enabled.loadRelaxed() >> InfoShift & 1; }
- bool isWarningEnabled() const { return enabled.loadRelaxed() >> WarningShift & 1; }
- bool isCriticalEnabled() const { return enabled.loadRelaxed() >> CriticalShift & 1; }
-#endif
+
const char *categoryName() const { return name; }
// allows usage of both factory method and variable in qCX macros
@@ -49,19 +43,11 @@ private:
Q_DECL_UNUSED_MEMBER void *d; // reserved for future use
const char *name;
-#ifdef Q_BIG_ENDIAN
- enum { DebugShift = 0, WarningShift = 8, CriticalShift = 16, InfoShift = 24 };
-#else
- enum { DebugShift = 24, WarningShift = 16, CriticalShift = 8, InfoShift = 0};
-#endif
-
struct AtomicBools {
-#ifdef Q_ATOMIC_INT8_IS_SUPPORTED
QBasicAtomicInteger<bool> enabledDebug;
QBasicAtomicInteger<bool> enabledWarning;
QBasicAtomicInteger<bool> enabledCritical;
QBasicAtomicInteger<bool> enabledInfo;
-#endif
};
union {
AtomicBools bools;