Commit 43d8ca4
committed
osd: replace deprecated atomic_store with std::atomic<shared_ptr>
Update shared pointer atomic operations to use C++20's
`std::atomic<std::shared_ptr>` instead of the deprecated `atomic_store`
functions. This change addresses deprecation warnings from GCC-15's
libstdc++ where atomic shared pointer operations outside the `std::atomic`
class are being phased out:
```
In file included from /home/kefu/dev/ceph/src/osd/Watch.cc:9:
/home/kefu/dev/ceph/src/osd/OSD.h:1675:10: warning: 'atomic_store<const OSDMap>' is deprecated: use 'std::atomic<std::shared_ptr<T>>' instead [-Wdeprecated-declarations]
1675 | std::atomic_store(&_osdmap, osdmap);
| ^
/usr/lib/gcc/x86_64-redhat-linux/15/../../../../include/c++/15/bits/shared_ptr_atomic.h:181:5: note: 'atomic_store<const OSDMap>' has been explicitly marked deprecated here
181 | _GLIBCXX20_DEPRECATED_SUGGEST("std::atomic<std::shared_ptr<T>>")
| ^
/usr/lib/gcc/x86_64-redhat-linux/15/../../../../include/c++/15/x86_64-redhat-linux/bits/c++config.h:2055:45: note: expanded from macro '_GLIBCXX20_DEPRECATED_SUGGEST'
2055 | # define _GLIBCXX20_DEPRECATED_SUGGEST(ALT) _GLIBCXX_DEPRECATED_SUGGEST(ALT)
| ^
/usr/lib/gcc/x86_64-redhat-linux/15/../../../../include/c++/15/x86_64-redhat-linux/bits/c++config.h:2023:19: note: expanded from macro '_GLIBCXX_DEPRECATED_SUGGEST'
2023 | __attribute__ ((__deprecated__ ("use '" ALT "' instead")))
| ^
In file included from /home/kefu/dev/ceph/src/osd/Watch.cc:9:
```
The implementation now uses the standard-compliant approach that's
recommended in the compiler warnings, while maintaining backward
compatibility with older compilers by conditionally selecting the
appropriate implementation.
Signed-off-by: Kefu Chai <[email protected]>1 parent 2694580 commit 43d8ca4
1 file changed
+13
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1669 | 1669 | | |
1670 | 1670 | | |
1671 | 1671 | | |
1672 | | - | |
1673 | | - | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
1674 | 1677 | | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
1675 | 1681 | | |
| 1682 | + | |
1676 | 1683 | | |
1677 | 1684 | | |
| 1685 | + | |
| 1686 | + | |
| 1687 | + | |
1678 | 1688 | | |
| 1689 | + | |
1679 | 1690 | | |
1680 | 1691 | | |
1681 | 1692 | | |
| |||
0 commit comments