diff options
author | 2017-06-08 18:03:25 -0700 | |
---|---|---|
committer | 2017-06-21 21:30:59 -0700 | |
commit | 69489fad1e34c005fbe110bfae2a3c6bff879d4e (patch) | |
tree | 23c50305c52cf076cedd3bfd496a2adf0d1e46b3 | |
parent | 8979f71079ec18fa8d3c0915549ec03ee1fbadf5 (diff) |
ART: Fix old warnings
Fix Wconstant-conversion warnings.
Partially reverts commit df53be273509dd43725870fb20a2c7d71f7fbfd3.
Bug: 28149048
Bug: 29823425
Test: m
Test: m test-art-host
Change-Id: Ib377150690c0f2c2142e4b91f2144e2bcaa020ef
-rw-r--r-- | build/Android.bp | 3 | ||||
-rw-r--r-- | compiler/utils/arm/assembler_thumb2.cc | 2 | ||||
-rw-r--r-- | compiler/utils/mips/assembler_mips_test.cc | 2 | ||||
-rw-r--r-- | runtime/stack_map.h | 13 |
4 files changed, 11 insertions, 9 deletions
diff --git a/build/Android.bp b/build/Android.bp index 6d35debec2..c5ff486709 100644 --- a/build/Android.bp +++ b/build/Android.bp @@ -59,9 +59,6 @@ art_global_defaults { "-Wunreachable-code-break", "-Wunreachable-code-return", - // Bug: http://b/29823425 Disable -Wconstant-conversion for Clang update to r271374 - "-Wno-constant-conversion", - // Enable thread annotations for std::mutex, etc. "-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS", ], diff --git a/compiler/utils/arm/assembler_thumb2.cc b/compiler/utils/arm/assembler_thumb2.cc index d7096b3c87..abc36c6adc 100644 --- a/compiler/utils/arm/assembler_thumb2.cc +++ b/compiler/utils/arm/assembler_thumb2.cc @@ -324,7 +324,7 @@ void Thumb2Assembler::PatchCFI() { inline int16_t Thumb2Assembler::BEncoding16(int32_t offset, Condition cond) { DCHECK_ALIGNED(offset, 2); - int16_t encoding = B15 | B14; + int16_t encoding = static_cast<int16_t>(B15 | B14); if (cond != AL) { DCHECK(IsInt<9>(offset)); encoding |= B12 | (static_cast<int32_t>(cond) << 8) | ((offset >> 1) & 0xff); diff --git a/compiler/utils/mips/assembler_mips_test.cc b/compiler/utils/mips/assembler_mips_test.cc index c24e1b16fb..09175309f9 100644 --- a/compiler/utils/mips/assembler_mips_test.cc +++ b/compiler/utils/mips/assembler_mips_test.cc @@ -2851,7 +2851,7 @@ TEST_F(AssemblerMIPSTest, LongBranchReorder) { // Account for 5 extra instructions: ori, addu, lw, jalr, addiu. uint32_t offset_forward = (kAdduCount1 + 5) * sizeof(uint32_t); // Account for 5 extra instructions: subu, addiu, sw, nal, lui. - uint32_t offset_back = -(kAdduCount1 + 5) * sizeof(uint32_t); + uint32_t offset_back = static_cast<uint32_t>(-(kAdduCount1 + 5) * sizeof(uint32_t)); std::ostringstream oss; oss << diff --git a/runtime/stack_map.h b/runtime/stack_map.h index a22498661e..21780a1bc9 100644 --- a/runtime/stack_map.h +++ b/runtime/stack_map.h @@ -17,6 +17,8 @@ #ifndef ART_RUNTIME_STACK_MAP_H_ #define ART_RUNTIME_STACK_MAP_H_ +#include <limits> + #include "arch/code_offset.h" #include "base/bit_vector.h" #include "base/bit_utils.h" @@ -1259,7 +1261,10 @@ class InvokeInfo { // Most of the fields are encoded as ULEB128 to save space. struct CodeInfoEncoding { - static constexpr uint32_t kInvalidSize = static_cast<size_t>(-1); + using SizeType = uint32_t; + + static constexpr SizeType kInvalidSize = std::numeric_limits<SizeType>::max(); + // Byte sized tables go first to avoid unnecessary alignment bits. ByteSizedTable dex_register_map; ByteSizedTable location_catalog; @@ -1285,7 +1290,7 @@ struct CodeInfoEncoding { inline_info = BitEncodingTable<InlineInfoEncoding>(); } cache_header_size = - dchecked_integral_cast<uint32_t>(ptr - reinterpret_cast<const uint8_t*>(data)); + dchecked_integral_cast<SizeType>(ptr - reinterpret_cast<const uint8_t*>(data)); ComputeTableOffsets(); } @@ -1332,9 +1337,9 @@ struct CodeInfoEncoding { private: // Computed fields (not serialized). // Header size in bytes, cached to avoid needing to re-decoding the encoding in HeaderSize. - uint32_t cache_header_size = kInvalidSize; + SizeType cache_header_size = kInvalidSize; // Non header size in bytes, cached to avoid needing to re-decoding the encoding in NonHeaderSize. - uint32_t cache_non_header_size = kInvalidSize; + SizeType cache_non_header_size = kInvalidSize; }; /** |