diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-01-27 13:15:18 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-02-12 12:39:52 +0100 |
commit | c8e03f129ea52ddc8e15104d5441328f6c90647f (patch) | |
tree | 3d6fc8e018245e6a36b5d83293d09e5ae7a42afc /tests/auto/corelib/kernel | |
parent | b5c4d1f50b1e2d44fbb3535ebedc565525ecc64f (diff) |
QHashSeed: remove 'pure' attribute on globalSeed()
While 'pure' in GCC is weaker than Stepanov's Regular Procedure from
Elements of Programming (equal result for equal inputs), it does not
allow accesses to volatile memory:
> functions declared with the pure attribute can safely read any
> non-volatile objects
The globalSeed() function reads from an atomic variable that can be
changed at any time from another thread.
Atomics, while not volatile objects in the sense of the keyword, must
fall under the pure attribute doc's exclusion criterion:
The difference between a volatile and an atomic access, while
important for the implementation of the function, is indistinguishable
to the caller of the function: both volatile and atomic objects can
change value without the current thread of execution changing them,
with no way for the caller of the function to distinguish which one
occurred.
Therefore, globalSeed() should not be pure.
5.15 is not affected, as qGlobalQHashSeed() is not marked as pure.
Task-number: QTBUG-62185
Pick-to: 6.3 6.2
Change-Id: I6fc52e2bd41ef4aa3f8039072b47c7a1314b98fa
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/kernel')
0 files changed, 0 insertions, 0 deletions