chore: add clang-tidy exceptions for const_casts

This commit is contained in:
Marcus Holland-Moritz 2024-10-21 00:30:21 +02:00
parent 5d341ec60e
commit 68e0bcd480
3 changed files with 3 additions and 0 deletions

View File

@ -115,6 +115,7 @@ mmap::advise(advice adv [[maybe_unused]], file_off_t offset [[maybe_unused]],
size += misalign;
size -= size % page_size_;
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast)
auto data = const_cast<char*>(mf_.const_data() + offset);
int native_adv = posix_advice(adv);

View File

@ -102,6 +102,7 @@ class cached_block_ final : public cached_block {
// TODO: should be possible to do this on Windows and macOS as well
auto page_size = ::sysconf(_SC_PAGESIZE);
tmp.resize((data_.size() + page_size - 1) / page_size);
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast)
if (::mincore(const_cast<uint8_t*>(data_.data()), data_.size(),
tmp.data()) == 0) {
// i&1 == 1 means resident in memory

View File

@ -441,6 +441,7 @@ size_t inode_reader_<LoggerPolicy>::readv(iovec_read_buf& buf, uint32_t inode,
auto rv = read_internal(inode, size, offset, maxiov, chunks, ec,
[&](size_t, const block_range& br) {
auto& iov = buf.buf.emplace_back();
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast)
iov.iov_base = const_cast<uint8_t*>(br.data());
iov.iov_len = br.size();
buf.ranges.emplace_back(br);