summaryrefslogtreecommitdiffstats
path: root/libcxx
diff options
context:
space:
mode:
authorJF Bastien <jfbastien@apple.com>2018-06-01 18:02:53 +0000
committerJF Bastien <jfbastien@apple.com>2018-06-01 18:02:53 +0000
commit84d7a4a344f6f6243d6a70bd3964687150f0ec40 (patch)
tree9d38b953a4024b5b37450a5fcb0e8bcc20903207 /libcxx
parentfd657bd4be4392c5c5d7c0040fbf7b4189b651a4 (diff)
downloadbcm5719-llvm-84d7a4a344f6f6243d6a70bd3964687150f0ec40.tar.gz
bcm5719-llvm-84d7a4a344f6f6243d6a70bd3964687150f0ec40.zip
Mark __c11_atomic_load as const
Summary: C++11 onwards specs the non-member functions atomic_load and atomic_load_explicit as taking the atomic<T> by const (potentially volatile) pointer. C11, in its infinite wisdom, decided to drop the const, and C17 will fix this with DR459 (the current draft forgot to fix B.16, but that’s not the normative part). This patch fixes the libc++ version of the __c11_atomic_load builtins defined for GCC's compatibility sake. D47618 takes care of the clang side. Discussion: http://lists.llvm.org/pipermail/cfe-dev/2018-May/058129.html <rdar://problem/27426936> Reviewers: EricWF, mclow.lists Subscribers: christof, cfe-commits Differential Revision: https://reviews.llvm.org/D47613 llvm-svn: 333776
Diffstat (limited to 'libcxx')
-rw-r--r--libcxx/include/atomic4
1 files changed, 2 insertions, 2 deletions
diff --git a/libcxx/include/atomic b/libcxx/include/atomic
index dfca76b1626..809f78a06d3 100644
--- a/libcxx/include/atomic
+++ b/libcxx/include/atomic
@@ -698,7 +698,7 @@ static inline void __c11_atomic_store(_Atomic(_Tp)* __a, _Tp __val,
}
template <typename _Tp>
-static inline _Tp __c11_atomic_load(volatile _Atomic(_Tp)* __a,
+static inline _Tp __c11_atomic_load(const volatile _Atomic(_Tp)* __a,
memory_order __order) {
_Tp __ret;
__atomic_load(&__a->__a_value, &__ret,
@@ -707,7 +707,7 @@ static inline _Tp __c11_atomic_load(volatile _Atomic(_Tp)* __a,
}
template <typename _Tp>
-static inline _Tp __c11_atomic_load(_Atomic(_Tp)* __a, memory_order __order) {
+static inline _Tp __c11_atomic_load(const _Atomic(_Tp)* __a, memory_order __order) {
_Tp __ret;
__atomic_load(&__a->__a_value, &__ret,
__gcc_atomic::__to_gcc_order(__order));
OpenPOWER on IntegriCloud