[compiler-rt] r182857 - Fix MSVC W3 compiler warnings
Timur Iskhodzhanov
timurrrr at google.com
Wed May 29 10:27:21 PDT 2013
Good point, fixed by r182868!
2013/5/29 David Blaikie <dblaikie at gmail.com>
>
>
>
> On Wed, May 29, 2013 at 7:11 AM, Timur Iskhodzhanov <timurrrr at google.com>wrote:
>
>> Author: timurrrr
>> Date: Wed May 29 09:11:44 2013
>> New Revision: 182857
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=182857&view=rev
>> Log:
>> Fix MSVC W3 compiler warnings
>>
>> Modified:
>> compiler-rt/trunk/lib/asan/asan_fake_stack.cc
>> compiler-rt/trunk/lib/asan/asan_fake_stack.h
>> compiler-rt/trunk/lib/asan/asan_interceptors.cc
>> compiler-rt/trunk/lib/asan/asan_poisoning.h
>> compiler-rt/trunk/lib/asan/asan_report.cc
>> compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator.h
>> compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_libcdep.cc
>> compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc
>> compiler-rt/trunk/lib/sanitizer_common/sanitizer_printf.cc
>>
>> Modified: compiler-rt/trunk/lib/asan/asan_fake_stack.cc
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_fake_stack.cc?rev=182857&r1=182856&r2=182857&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/asan/asan_fake_stack.cc (original)
>> +++ compiler-rt/trunk/lib/asan/asan_fake_stack.cc Wed May 29 09:11:44 2013
>> @@ -141,7 +141,7 @@ ALWAYS_INLINE uptr FakeStack::AllocateSt
>>
>> ALWAYS_INLINE void FakeStack::DeallocateFrame(FakeFrame *fake_frame) {
>> CHECK(alive_);
>> - uptr size = fake_frame->size_minus_one + 1;
>> + uptr size = static_cast<uptr>(fake_frame->size_minus_one + 1);
>> uptr size_class = ComputeSizeClass(size);
>> CHECK(allocated_size_classes_[size_class]);
>> uptr ptr = (uptr)fake_frame;
>>
>> Modified: compiler-rt/trunk/lib/asan/asan_fake_stack.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_fake_stack.h?rev=182857&r1=182856&r2=182857&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/asan/asan_fake_stack.h (original)
>> +++ compiler-rt/trunk/lib/asan/asan_fake_stack.h Wed May 29 09:11:44 2013
>> @@ -80,7 +80,7 @@ class FakeStack {
>> static void OnFree(uptr ptr, uptr size, uptr real_stack);
>> // Return the bottom of the maped region.
>> uptr AddrIsInFakeStack(uptr addr);
>> - bool StackSize() { return stack_size_; }
>> + uptr StackSize() const { return stack_size_; }
>>
>> private:
>> static const uptr kMinStackFrameSizeLog = 9; // Min frame is 512B.
>>
>> Modified: compiler-rt/trunk/lib/asan/asan_interceptors.cc
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_interceptors.cc?rev=182857&r1=182856&r2=182857&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/asan/asan_interceptors.cc (original)
>> +++ compiler-rt/trunk/lib/asan/asan_interceptors.cc Wed May 29 09:11:44
>> 2013
>> @@ -673,7 +673,7 @@ INTERCEPTOR_WINAPI(DWORD, CreateThread,
>> u32 current_tid = GetCurrentTidOrInvalid();
>> AsanThread *t = AsanThread::Create(start_routine, arg);
>> CreateThreadContextArgs args = { t, &stack };
>> - int detached = 0; // FIXME: how can we determine it on Windows?
>> + bool detached = 0; // FIXME: how can we determine it on Windows?
>>
>
> Using 'false' to initializer a bool might be nicer.
>
>
>> asanThreadRegistry().CreateThread(*(uptr*)t, detached, current_tid,
>> &args);
>> return REAL(CreateThread)(security, stack_size,
>> asan_thread_start, t, flags, tid);
>>
>> Modified: compiler-rt/trunk/lib/asan/asan_poisoning.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_poisoning.h?rev=182857&r1=182856&r2=182857&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/asan/asan_poisoning.h (original)
>> +++ compiler-rt/trunk/lib/asan/asan_poisoning.h Wed May 29 09:11:44 2013
>> @@ -50,7 +50,7 @@ ALWAYS_INLINE void FastPoisonShadowParti
>> } else if (i >= size) {
>> *shadow = (SHADOW_GRANULARITY == 128) ? 0xff : value; //
>> unaddressable
>> } else {
>> - *shadow = size - i; // first size-i bytes are addressable
>> + *shadow = static_cast<u8>(size - i); // first size-i bytes are
>> addressable
>> }
>> }
>> }
>>
>> Modified: compiler-rt/trunk/lib/asan/asan_report.cc
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_report.cc?rev=182857&r1=182856&r2=182857&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/asan/asan_report.cc (original)
>> +++ compiler-rt/trunk/lib/asan/asan_report.cc Wed May 29 09:11:44 2013
>> @@ -125,7 +125,7 @@ static void PrintLegend() {
>> "application bytes):\n", (int)SHADOW_GRANULARITY);
>> PrintShadowByte(" Addressable: ", 0);
>> Printf(" Partially addressable: ");
>> - for (uptr i = 1; i < SHADOW_GRANULARITY; i++)
>> + for (u8 i = 1; i < SHADOW_GRANULARITY; i++)
>> PrintShadowByte("", i, " ");
>> Printf("\n");
>> PrintShadowByte(" Heap left redzone: ",
>> kAsanHeapLeftRedzoneMagic);
>> @@ -267,7 +267,7 @@ const char *ThreadNameWithParenthesis(u3
>> bool DescribeAddressIfStack(uptr addr, uptr access_size) {
>> AsanThread *t = FindThreadByStackAddress(addr);
>> if (!t) return false;
>> - const sptr kBufSize = 4095;
>> + const s64 kBufSize = 4095;
>> char buf[kBufSize];
>> uptr offset = 0;
>> uptr frame_pc = 0;
>> @@ -306,13 +306,13 @@ bool DescribeAddressIfStack(uptr addr, u
>> PrintStack(&alloca_stack);
>> // Report the number of stack objects.
>> char *p;
>> - uptr n_objects = internal_simple_strtoll(frame_descr, &p, 10);
>> + s64 n_objects = internal_simple_strtoll(frame_descr, &p, 10);
>> CHECK_GT(n_objects, 0);
>> Printf(" This frame has %zu object(s):\n", n_objects);
>> // Report all objects in this frame.
>> - for (uptr i = 0; i < n_objects; i++) {
>> - uptr beg, size;
>> - sptr len;
>> + for (s64 i = 0; i < n_objects; i++) {
>> + s64 beg, size;
>> + s64 len;
>> beg = internal_simple_strtoll(p, &p, 10);
>> size = internal_simple_strtoll(p, &p, 10);
>> len = internal_simple_strtoll(p, &p, 10);
>> @@ -323,9 +323,9 @@ bool DescribeAddressIfStack(uptr addr, u
>> }
>> p++;
>> buf[0] = 0;
>> - internal_strncat(buf, p, Min(kBufSize, len));
>> + internal_strncat(buf, p, static_cast<uptr>(Min(kBufSize, len)));
>> p += len;
>> - Printf(" [%zu, %zu) '%s'\n", beg, beg + size, buf);
>> + Printf(" [%lld, %lld) '%s'\n", beg, beg + size, buf);
>> }
>> Printf("HINT: this may be a false positive if your program uses "
>> "some custom stack unwind mechanism or swapcontext\n"
>>
>> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator.h?rev=182857&r1=182856&r2=182857&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator.h
>> (original)
>> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator.h Wed May
>> 29 09:11:44 2013
>> @@ -779,7 +779,7 @@ class SizeClassAllocator32 {
>> MapUnmapCallback().OnMap(res, kRegionSize);
>> stat->Add(AllocatorStatMmapped, kRegionSize);
>> CHECK_EQ(0U, (res & (kRegionSize - 1)));
>> - possible_regions.set(ComputeRegionId(res), class_id);
>> + possible_regions.set(ComputeRegionId(res),
>> static_cast<u8>(class_id));
>> return res;
>> }
>>
>>
>> Modified:
>> compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_libcdep.cc
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_libcdep.cc?rev=182857&r1=182856&r2=182857&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_libcdep.cc
>> (original)
>> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_libcdep.cc
>> Wed May 29 09:11:44 2013
>> @@ -17,7 +17,7 @@ namespace __sanitizer {
>>
>> bool PrintsToTty() {
>> MaybeOpenReportFile();
>> - return internal_isatty(report_fd);
>> + return internal_isatty(report_fd) != 0;
>> }
>>
>> } // namespace __sanitizer
>>
>> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc?rev=182857&r1=182856&r2=182857&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc (original)
>> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc Wed May 29
>> 09:11:44 2013
>> @@ -97,7 +97,7 @@ void ParseFlag(const char *env, int *fla
>> int value_length;
>> if (!GetFlagValue(env, name, &value, &value_length))
>> return;
>> - *flag = internal_atoll(value);
>> + *flag = static_cast<int>(internal_atoll(value));
>> }
>>
>> static LowLevelAllocator allocator_for_flags;
>>
>> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_printf.cc
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_printf.cc?rev=182857&r1=182856&r2=182857&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_printf.cc (original)
>> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_printf.cc Wed May 29
>> 09:11:44 2013
>> @@ -59,7 +59,7 @@ static int AppendUnsigned(char **buff, c
>> }
>> int result = 0;
>> while (pos-- > 0) {
>> - uptr digit = num_buffer[pos];
>> + char digit = static_cast<char>(num_buffer[pos]);
>> result += AppendChar(buff, buff_end, (digit < 10) ? '0' + digit
>> : 'a' + digit -
>> 10);
>> }
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130529/acbc5080/attachment.html>
More information about the llvm-commits
mailing list