path: root/src/corelib/tools
diff options
authorThiago Macieira <>2013-03-25 17:30:26 -0700
committerThe Qt Project <>2013-03-26 21:44:15 +0100
commitbafd3fdf1c72040abbf7ddf354f6b1c15c9985a4 (patch)
treededba8e8fc3ae3f51a28ef485149d71549080f47 /src/corelib/tools
parent03d057ff01332333b98f5298c3d0bd85b5604ac9 (diff)
Make the inline CPU detection functions also static
Since qCpuHasFeature() checks the static qCompilerCpuFeatures variable and that variable's value might change depending on the compiler flags, it's best to ensure that the function is not subject to link-time merging. That would be bad if it happened when qCpuHasFeature() was used from a file with higher CPU compiler settings than the default, as it would incorrectly conclude that certain features are always available. Change-Id: I8bacde056fb89869ec1d306a163742e72522315e Reviewed-by: Tor Arne Vestbø <>
Diffstat (limited to 'src/corelib/tools')
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h
index b9d546452f..98eb473da0 100644
--- a/src/corelib/tools/qsimd_p.h
+++ b/src/corelib/tools/qsimd_p.h
@@ -228,7 +228,7 @@ static const uint qCompilerCpuFeatures = 0
extern Q_CORE_EXPORT QBasicAtomicInt qt_cpu_features;
Q_CORE_EXPORT void qDetectCpuFeatures();
-inline uint qCpuFeatures()
+static inline uint qCpuFeatures()
int features = qt_cpu_features.load();
if (Q_UNLIKELY(features == 0)) {
@@ -239,7 +239,7 @@ inline uint qCpuFeatures()
return uint(features);
-inline uint qCpuHasFeature(CPUFeatures feature)
+static inline uint qCpuHasFeature(CPUFeatures feature)
return qCompilerCpuFeatures & feature || qCpuFeatures() & feature;