]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
denc: support non-c++20 compliant C++ standard library
authorKefu Chai <tchaikov@gmail.com>
Fri, 2 Sep 2022 16:21:57 +0000 (00:21 +0800)
committerKefu Chai <tchaikov@gmail.com>
Sat, 3 Sep 2022 00:24:06 +0000 (08:24 +0800)
commit6cc31cc59386d2f38e1af5ee188fa37caab7cd12
treebcbd88a00d57ad8ffa606c1793bb1ae517bb0144
parent9f870f8527a3b621439b854771465978309847ac
denc: support non-c++20 compliant C++ standard library

when compiling with the standard library comes with GCC-10, we have
FTBFS like:

```
src/include/denc.h:517:49: error: 'bit_cast' is not a member of 'std';
did you mean 'bad_cast'?
  517 |   unsigned lowznib = v ?
      (std::countr_zero(std::bit_cast<uint64_t>(v)) / 4) : 0u;
      |                                                 ^~~~~~~~
      |                                                 bad_cast
```

to address this issue, an implementation of std::bit_cast<> is defined
if it is not available. in the long run, we should use a better C++
compiler for compiling the tree.

Fixes: https://tracker.ceph.com/issues/57355
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/include/cpp_lib_backport.h [new file with mode: 0644]
src/include/denc.h