From d897599e5ba43c644c685c916f55e70a56f420ff Mon Sep 17 00:00:00 2001 From: Galina Kistanova Date: Thu, 12 Jul 2012 20:45:36 +0000 Subject: [PATCH] Fixed few warnings. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160142 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/Memory.cpp | 11 ++++++----- lib/Support/Unix/Path.inc | 3 ++- lib/Support/raw_ostream.cpp | 3 ++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/Support/Memory.cpp b/lib/Support/Memory.cpp index 2a1642ac2e8..22f74944865 100644 --- a/lib/Support/Memory.cpp +++ b/lib/Support/Memory.cpp @@ -45,7 +45,7 @@ void llvm::sys::Memory::InvalidateInstructionCache(const void *Addr, # if (defined(__POWERPC__) || defined (__ppc__) || \ defined(_POWER) || defined(_ARCH_PPC)) || defined(__arm__) - sys_icache_invalidate(Addr, Len); + sys_icache_invalidate(const_cast(Addr), Len); # endif #else @@ -67,11 +67,12 @@ void llvm::sys::Memory::InvalidateInstructionCache(const void *Addr, asm volatile("isync"); # elif defined(__arm__) && defined(__GNUC__) // FIXME: Can we safely always call this for __GNUC__ everywhere? - char *Start = (char*) Addr; - char *End = Start + Len; - __clear_cache(Start, End); + const char *Start = static_cast(Addr); + const char *End = Start + Len; + __clear_cache(const_cast(Start), const_cast(End)); # elif defined(__mips__) - cacheflush((char*)Addr, Len, BCACHE); + const char *Start = static_cast(Addr); + cacheflush(const_cast(Start), Len, BCACHE); # endif #endif // end apple diff --git a/lib/Support/Unix/Path.inc b/lib/Support/Unix/Path.inc index ddc1e0f9cec..b41390adefd 100644 --- a/lib/Support/Unix/Path.inc +++ b/lib/Support/Unix/Path.inc @@ -884,7 +884,8 @@ const char *Path::MapInFilePages(int FD, size_t FileSize, off_t Offset) { } void Path::UnMapFilePages(const char *BasePtr, size_t FileSize) { - ::munmap((void*)BasePtr, FileSize); + const void *Addr = static_cast(BasePtr); + ::munmap(const_cast(Addr), FileSize); } } // end llvm namespace diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp index 86cdca15727..0cd9716ac94 100644 --- a/lib/Support/raw_ostream.cpp +++ b/lib/Support/raw_ostream.cpp @@ -528,7 +528,8 @@ void raw_fd_ostream::write_impl(const char *Ptr, size_t Size) { } else { // Use ::writev() where available. #if defined(HAVE_WRITEV) - struct iovec IOV = { (void*) Ptr, Size }; + const void *Addr = static_cast(Ptr); + struct iovec IOV = {const_cast(Addr), Size }; ret = ::writev(FD, &IOV, 1); #else ret = ::write(FD, Ptr, Size);