diff options
-rw-r--r-- | Android.mk | 2 | ||||
-rw-r--r-- | compiler/dex/quick/codegen_util.cc | 4 | ||||
-rw-r--r-- | compiler/dex/quick/gen_invoke.cc | 2 | ||||
-rw-r--r-- | compiler/llvm/runtime_support_builder.cc | 2 | ||||
-rw-r--r-- | runtime/atomic.cc | 2 | ||||
-rw-r--r-- | runtime/base/histogram-inl.h | 2 | ||||
-rw-r--r-- | runtime/common_test.h | 3 | ||||
-rw-r--r-- | runtime/debugger.cc | 4 | ||||
-rw-r--r-- | runtime/debugger.h | 2 | ||||
-rw-r--r-- | runtime/gc/heap.cc | 2 | ||||
-rw-r--r-- | runtime/hprof/hprof.cc | 12 | ||||
-rw-r--r-- | runtime/instrumentation.cc | 5 | ||||
-rw-r--r-- | runtime/jdwp/jdwp_adb.cc | 4 | ||||
-rw-r--r-- | runtime/mem_map.cc | 3 | ||||
-rw-r--r-- | runtime/native/java_lang_System.cc | 2 | ||||
-rw-r--r-- | runtime/thread_x86.cc | 2 |
16 files changed, 28 insertions, 25 deletions
diff --git a/Android.mk b/Android.mk index e660827eab..8331b69c2a 100644 --- a/Android.mk +++ b/Android.mk @@ -334,7 +334,7 @@ endif .PHONY: cpplint-art cpplint-art: ./art/tools/cpplint.py \ - --filter=-,+build/header_guard,+whitespace/braces,+whitespace/comma,+runtime/explicit,+whitespace/newline,+whitespace/parens,+build/namespaces,+readability/fn_size,+whitespace/operators,+readability/braces,+whitespace/indent,+whitespace/blank_line,+whitespace/end_of_line,+whitespace/labels,+whitespace/semicolon,+legal/copyright \ + --filter=-,+build/header_guard,+whitespace/braces,+whitespace/comma,+runtime/explicit,+whitespace/newline,+whitespace/parens,+build/namespaces,+readability/fn_size,+whitespace/operators,+readability/braces,+whitespace/indent,+whitespace/blank_line,+whitespace/end_of_line,+whitespace/labels,+whitespace/semicolon,+legal/copyright,+readability/casting \ $(shell find art -name *.h -o -name *$(ART_CPP_EXTENSION) | grep -v art/compiler/llvm/generated/) # "mm cpplint-art-aspirational" to see warnings we would like to fix diff --git a/compiler/dex/quick/codegen_util.cc b/compiler/dex/quick/codegen_util.cc index 8daa397135..630e294b37 100644 --- a/compiler/dex/quick/codegen_util.cc +++ b/compiler/dex/quick/codegen_util.cc @@ -190,10 +190,10 @@ void Mir2Lir::DumpLIRInsn(LIR* lir, unsigned char* base_addr) { } if (lir->use_mask && (!lir->flags.is_nop || dump_nop)) { - DUMP_RESOURCE_MASK(DumpResourceMask((LIR*) lir, lir->use_mask, "use")); + DUMP_RESOURCE_MASK(DumpResourceMask(lir, lir->use_mask, "use")); } if (lir->def_mask && (!lir->flags.is_nop || dump_nop)) { - DUMP_RESOURCE_MASK(DumpResourceMask((LIR*) lir, lir->def_mask, "def")); + DUMP_RESOURCE_MASK(DumpResourceMask(lir, lir->def_mask, "def")); } } diff --git a/compiler/dex/quick/gen_invoke.cc b/compiler/dex/quick/gen_invoke.cc index 8840526ec9..13a59bf69a 100644 --- a/compiler/dex/quick/gen_invoke.cc +++ b/compiler/dex/quick/gen_invoke.cc @@ -1113,7 +1113,7 @@ bool Mir2Lir::GenInlinedCurrentThread(CallInfo* info) { LoadWordDisp(TargetReg(kSelf), offset, rl_result.low_reg); } else { CHECK(cu_->instruction_set == kX86); - ((X86Mir2Lir*)this)->OpRegThreadMem(kOpMov, rl_result.low_reg, offset); + reinterpret_cast<X86Mir2Lir*>(this)->OpRegThreadMem(kOpMov, rl_result.low_reg, offset); } StoreValue(rl_dest, rl_result); return true; diff --git a/compiler/llvm/runtime_support_builder.cc b/compiler/llvm/runtime_support_builder.cc index 19ccc3603c..e6479e0fd8 100644 --- a/compiler/llvm/runtime_support_builder.cc +++ b/compiler/llvm/runtime_support_builder.cc @@ -43,7 +43,7 @@ RuntimeSupportBuilder::RuntimeSupportBuilder(::llvm::LLVMContext& context, #define GET_RUNTIME_SUPPORT_FUNC_DECL(ID, NAME) \ do { \ ::llvm::Function* fn = module_.getFunction(#NAME); \ - DCHECK_NE(fn, (void*)NULL) << "Function not found: " << #NAME; \ + DCHECK(fn != NULL) << "Function not found: " << #NAME; \ runtime_support_func_decls_[runtime_support::ID] = fn; \ } while (0); diff --git a/runtime/atomic.cc b/runtime/atomic.cc index f2a998289c..c91db793ba 100644 --- a/runtime/atomic.cc +++ b/runtime/atomic.cc @@ -34,7 +34,7 @@ static const size_t kSwapMutexCount = 32; static std::vector<Mutex*>* gSwapMutexes; static Mutex& GetSwapMutex(const volatile int64_t* addr) { - return *(*gSwapMutexes)[((unsigned)(void*)(addr) >> 3U) % kSwapMutexCount]; + return *(*gSwapMutexes)[(reinterpret_cast<unsigned>(addr) >> 3U) % kSwapMutexCount]; } #endif diff --git a/runtime/base/histogram-inl.h b/runtime/base/histogram-inl.h index d572cf9cba..1a63cf477f 100644 --- a/runtime/base/histogram-inl.h +++ b/runtime/base/histogram-inl.h @@ -66,7 +66,7 @@ template <class Value> inline size_t Histogram<Value>::FindBucket(Value val) { // dividing the value by the bucket width. DCHECK_GE(val, min_); DCHECK_LE(val, max_); - size_t bucket_idx = static_cast<size_t>((double)(val - min_) / bucket_width_); + size_t bucket_idx = static_cast<size_t>(static_cast<double>(val - min_) / bucket_width_); DCHECK_GE(bucket_idx, 0ul); DCHECK_LE(bucket_idx, bucket_count_); return bucket_idx; diff --git a/runtime/common_test.h b/runtime/common_test.h index 778ca63826..03a45aa20b 100644 --- a/runtime/common_test.h +++ b/runtime/common_test.h @@ -508,7 +508,8 @@ class CommonTest : public testing::Test { void ReserveImageSpace() { // Reserve where the image will be loaded up front so that other parts of test set up don't // accidentally end up colliding with the fixed memory address when we need to load the image. - image_reservation_.reset(MemMap::MapAnonymous("image reservation", (byte*)ART_BASE_ADDRESS, + image_reservation_.reset(MemMap::MapAnonymous("image reservation", + reinterpret_cast<byte*>(ART_BASE_ADDRESS), (size_t)100 * 1024 * 1024, // 100MB PROT_NONE)); } diff --git a/runtime/debugger.cc b/runtime/debugger.cc index 4fbee51045..9e9dd8736c 100644 --- a/runtime/debugger.cc +++ b/runtime/debugger.cc @@ -3281,7 +3281,7 @@ class HeapChunkContext { const size_t kMaxFreeLen = 2 * kPageSize; void* freeStart = startOfNextMemoryChunk_; void* freeEnd = start; - size_t freeLen = (char*)freeEnd - (char*)freeStart; + size_t freeLen = reinterpret_cast<char*>(freeEnd) - reinterpret_cast<char*>(freeStart); if (!native || freeLen < kMaxFreeLen) { AppendChunk(HPSG_STATE(SOLIDITY_FREE, 0), freeStart, freeLen); flush = false; @@ -3302,7 +3302,7 @@ class HeapChunkContext { // allocation then the first sizeof(size_t) may belong to it. const size_t dlMallocOverhead = sizeof(size_t); AppendChunk(state, start, used_bytes + dlMallocOverhead); - startOfNextMemoryChunk_ = (char*)start + used_bytes + dlMallocOverhead; + startOfNextMemoryChunk_ = reinterpret_cast<char*>(start) + used_bytes + dlMallocOverhead; } void AppendChunk(uint8_t state, void* ptr, size_t length) diff --git a/runtime/debugger.h b/runtime/debugger.h index 28a2c60f8c..9005fda392 100644 --- a/runtime/debugger.h +++ b/runtime/debugger.h @@ -417,7 +417,7 @@ class Dbg { SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); private: - static void DdmBroadcast(bool) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + static void DdmBroadcast(bool connect) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); static void PostThreadStartOrStop(Thread*, uint32_t) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc index ce253bc8cb..80a62051c2 100644 --- a/runtime/gc/heap.cc +++ b/runtime/gc/heap.cc @@ -319,7 +319,7 @@ void Heap::DumpGcPerformanceInfo(std::ostream& os) { size_t total_objects_allocated = GetObjectsAllocatedEver(); size_t total_bytes_allocated = GetBytesAllocatedEver(); if (total_duration != 0) { - const double total_seconds = double(total_duration / 1000) / 1000000.0; + const double total_seconds = static_cast<double>(total_duration / 1000) / 1000000.0; os << "Total time spent in GC: " << PrettyDuration(total_duration) << "\n"; os << "Mean GC size throughput: " << PrettySize(GetBytesFreedEver() / total_seconds) << "/s\n"; diff --git a/runtime/hprof/hprof.cc b/runtime/hprof/hprof.cc index d66ec7933b..3c8099a917 100644 --- a/runtime/hprof/hprof.cc +++ b/runtime/hprof/hprof.cc @@ -72,7 +72,7 @@ namespace hprof { #define U2_TO_BUF_BE(buf, offset, value) \ do { \ unsigned char* buf_ = (unsigned char*)(buf); \ - int offset_ = (int)(offset); \ + int offset_ = static_cast<int>(offset); \ uint16_t value_ = (uint16_t)(value); \ buf_[offset_ + 0] = (unsigned char)(value_ >> 8); \ buf_[offset_ + 1] = (unsigned char)(value_ ); \ @@ -81,7 +81,7 @@ namespace hprof { #define U4_TO_BUF_BE(buf, offset, value) \ do { \ unsigned char* buf_ = (unsigned char*)(buf); \ - int offset_ = (int)(offset); \ + int offset_ = static_cast<int>(offset); \ uint32_t value_ = (uint32_t)(value); \ buf_[offset_ + 0] = (unsigned char)(value_ >> 24); \ buf_[offset_ + 1] = (unsigned char)(value_ >> 16); \ @@ -92,7 +92,7 @@ namespace hprof { #define U8_TO_BUF_BE(buf, offset, value) \ do { \ unsigned char* buf_ = (unsigned char*)(buf); \ - int offset_ = (int)(offset); \ + int offset_ = static_cast<int>(offset); \ uint64_t value_ = (uint64_t)(value); \ buf_[offset_ + 0] = (unsigned char)(value_ >> 56); \ buf_[offset_ + 1] = (unsigned char)(value_ >> 48); \ @@ -222,7 +222,7 @@ class HprofRecord { return UNIQUE_ERROR; } nb = fwrite(body_, 1, length_, fp_); - if (nb != (int)length_) { + if (nb != static_cast<int>(length_)) { return UNIQUE_ERROR; } @@ -984,9 +984,9 @@ int Hprof::DumpHeapObject(mirror::Object* obj) { if (size == 1) { rec->AddU1List((const uint8_t*)aobj->GetRawData(sizeof(uint8_t)), length); } else if (size == 2) { - rec->AddU2List((const uint16_t*)(void*)aobj->GetRawData(sizeof(uint16_t)), length); + rec->AddU2List((const uint16_t*)aobj->GetRawData(sizeof(uint16_t)), length); } else if (size == 4) { - rec->AddU4List((const uint32_t*)(void*)aobj->GetRawData(sizeof(uint32_t)), length); + rec->AddU4List((const uint32_t*)aobj->GetRawData(sizeof(uint32_t)), length); } else if (size == 8) { rec->AddU8List((const uint64_t*)aobj->GetRawData(sizeof(uint64_t)), length); } diff --git a/runtime/instrumentation.cc b/runtime/instrumentation.cc index 091f66adce..8a05aa4725 100644 --- a/runtime/instrumentation.cc +++ b/runtime/instrumentation.cc @@ -495,7 +495,7 @@ void Instrumentation::PushInstrumentationStackFrame(Thread* self, mirror::Object size_t frame_id = StackVisitor::ComputeNumFrames(self); std::deque<instrumentation::InstrumentationStackFrame>* stack = self->GetInstrumentationStack(); if (kVerboseInstrumentation) { - LOG(INFO) << "Entering " << PrettyMethod(method) << " from PC " << (void*)lr; + LOG(INFO) << "Entering " << PrettyMethod(method) << " from PC " << reinterpret_cast<void*>(lr); } instrumentation::InstrumentationStackFrame instrumentation_frame(this_object, method, lr, frame_id, interpreter_entry); @@ -552,7 +552,8 @@ uint64_t Instrumentation::PopInstrumentationStackFrame(Thread* self, uintptr_t* (static_cast<uint64_t>(*return_pc) << 32); } else { if (kVerboseInstrumentation) { - LOG(INFO) << "Returning from " << PrettyMethod(method) << " to PC " << (void*)(*return_pc); + LOG(INFO) << "Returning from " << PrettyMethod(method) + << " to PC " << reinterpret_cast<void*>(*return_pc); } return *return_pc; } diff --git a/runtime/jdwp/jdwp_adb.cc b/runtime/jdwp/jdwp_adb.cc index 9b9fe4c02b..2bfe63e3d4 100644 --- a/runtime/jdwp/jdwp_adb.cc +++ b/runtime/jdwp/jdwp_adb.cc @@ -157,7 +157,7 @@ int JdwpAdbState::ReceiveClientFd() { cmsg->cmsg_len = msg.msg_controllen; cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = SCM_RIGHTS; - ((int*)(void*)CMSG_DATA(cmsg))[0] = -1; + (reinterpret_cast<int*>(CMSG_DATA(cmsg)))[0] = -1; int rc = TEMP_FAILURE_RETRY(recvmsg(control_sock_, &msg, 0)); @@ -170,7 +170,7 @@ int JdwpAdbState::ReceiveClientFd() { return -1; } - return ((int*)(void*)CMSG_DATA(cmsg))[0]; + return (reinterpret_cast<int*>(CMSG_DATA(cmsg)))[0]; } /* diff --git a/runtime/mem_map.cc b/runtime/mem_map.cc index c75dffa63c..a0f389cb1e 100644 --- a/runtime/mem_map.cc +++ b/runtime/mem_map.cc @@ -192,7 +192,8 @@ bool MemMap::ProtectRegion(uint8_t* addr, size_t length, int prot) { * (The address must be page-aligned, the length doesn't need to be, * but we do need to ensure we cover the same range.) */ - uint8_t* alignAddr = (uint8_t*) ((uintptr_t) addr & ~(kPageSize-1)); + uint8_t* alignAddr = reinterpret_cast<uint8_t*>(RoundDown(reinterpret_cast<uintptr_t>(addr), + kPageSize)); size_t alignLength = length + (addr - alignAddr); if (mprotect(alignAddr, alignLength, prot) == 0) { diff --git a/runtime/native/java_lang_System.cc b/runtime/native/java_lang_System.cc index 2462f2fd8e..30b4dc7ef5 100644 --- a/runtime/native/java_lang_System.cc +++ b/runtime/native/java_lang_System.cc @@ -123,7 +123,7 @@ void MemmoveWords(void* dst, const void* src, size_t n) { // Check for leftovers. Either we finished exactly, or we have one remaining 16-bit chunk. if ((n & 0x02) != 0) { - *(uint16_t*)d = *(uint16_t*)s; + *reinterpret_cast<uint16_t*>(d) = *reinterpret_cast<const uint16_t*>(s); } } else { // Copy backward, starting at the end. diff --git a/runtime/thread_x86.cc b/runtime/thread_x86.cc index 959f317471..c398b2877a 100644 --- a/runtime/thread_x86.cc +++ b/runtime/thread_x86.cc @@ -73,7 +73,7 @@ void Thread::InitCpu() { entry.d = seg_32bit; entry.g = limit_in_pages; - entry_number = i386_set_ldt(LDT_AUTO_ALLOC, (ldt_entry*)(void*)(&entry), 1); + entry_number = i386_set_ldt(LDT_AUTO_ALLOC, reinterpret_cast<ldt_entry*>(&entry), 1); if (entry_number == -1) { PLOG(FATAL) << "i386_set_ldt failed"; } |