From c81a322476a1b1c57ca72832e10c43663557e097 Mon Sep 17 00:00:00 2001 From: Jie Fu Date: Tue, 4 Apr 2023 07:40:34 +0800 Subject: [PATCH] [compiler-rt] Fix -Wcast-qual after D147005 (NFC) /home/jiefu/llvm-project/compiler-rt/lib/lsan/lsan_allocator.cpp:161:18: error: cast from 'const void *' to 'void *' drops const qualifier [-Werror,-Wcast-qual] return (void *)beg; ^ 1 error generated. --- compiler-rt/lib/dfsan/dfsan_allocator.cpp | 2 +- compiler-rt/lib/lsan/lsan_allocator.cpp | 2 +- compiler-rt/lib/msan/msan_allocator.cpp | 2 +- compiler-rt/lib/tsan/rtl/tsan_mman.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler-rt/lib/dfsan/dfsan_allocator.cpp b/compiler-rt/lib/dfsan/dfsan_allocator.cpp index cebf9983c9490..7ae6024fb2c9d 100644 --- a/compiler-rt/lib/dfsan/dfsan_allocator.cpp +++ b/compiler-rt/lib/dfsan/dfsan_allocator.cpp @@ -177,7 +177,7 @@ void *DFsanCalloc(uptr nmemb, uptr size) { void *AllocationBegin(const void *p) { if (!p) return nullptr; - const void *beg = allocator.GetBlockBegin(p); + void *beg = allocator.GetBlockBegin(p); if (!beg) return nullptr; Metadata *b = (Metadata *)allocator.GetMetaData(beg); diff --git a/compiler-rt/lib/lsan/lsan_allocator.cpp b/compiler-rt/lib/lsan/lsan_allocator.cpp index d50882657dc33..b0a54d7cd9bc5 100644 --- a/compiler-rt/lib/lsan/lsan_allocator.cpp +++ b/compiler-rt/lib/lsan/lsan_allocator.cpp @@ -148,7 +148,7 @@ void GetAllocatorCacheRange(uptr *begin, uptr *end) { void *GetMallocBegin(const void *p) { if (!p) return nullptr; - const void *beg = allocator.GetBlockBegin(p); + void *beg = allocator.GetBlockBegin(p); if (!beg) return nullptr; ChunkMetadata *m = Metadata(beg); diff --git a/compiler-rt/lib/msan/msan_allocator.cpp b/compiler-rt/lib/msan/msan_allocator.cpp index a760a434158a5..08ec3314b26e6 100644 --- a/compiler-rt/lib/msan/msan_allocator.cpp +++ b/compiler-rt/lib/msan/msan_allocator.cpp @@ -263,7 +263,7 @@ static void *MsanCalloc(StackTrace *stack, uptr nmemb, uptr size) { void *AllocationBegin(const void *p) { if (!p) return nullptr; - const void *beg = allocator.GetBlockBegin(p); + void *beg = allocator.GetBlockBegin(p); if (!beg) return nullptr; Metadata *b = (Metadata *)allocator.GetMetaData(beg); diff --git a/compiler-rt/lib/tsan/rtl/tsan_mman.cpp b/compiler-rt/lib/tsan/rtl/tsan_mman.cpp index 9c548dfff91f3..3cc4d16955ede 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_mman.cpp +++ b/compiler-rt/lib/tsan/rtl/tsan_mman.cpp @@ -355,7 +355,7 @@ void *user_pvalloc(ThreadState *thr, uptr pc, uptr sz) { void *user_alloc_begin(const void *p) { if (p == nullptr || !IsAppMem((uptr)p)) return nullptr; - const void *beg = allocator()->GetBlockBegin(p); + void *beg = allocator()->GetBlockBegin(p); if (!beg) return nullptr;