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ø <tor.arne.vestbo@digia.com>
This commit is contained in:
parent
03d057ff01
commit
bafd3fdf1c
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user