summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2018-04-23 17:05:47 +0000
committerReid Kleckner <rnk@google.com>2018-04-23 17:05:47 +0000
commitfc39236ab190af3435460e028ef7d6028a15a254 (patch)
tree7a4335897037c3912834605c5b65a3d22a62394e
parentd86761884c4e79b9bce4d2dcca3fb15925a362ea (diff)
Fix clang-cl warnings in compiler-rt
The profile library was missing some includes and was erroneously using ftruncate. WinASan was using `= {0}` to initialize structs, which creates -Wmissing-field-initializers and -Wmissing-braces warnings with clang. Use `= {}` instead, since this is C++. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@330616 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/profile/InstrProfilingFile.c3
-rw-r--r--lib/sanitizer_common/sanitizer_common_interceptors.inc2
-rw-r--r--lib/sanitizer_common/sanitizer_win.cc4
3 files changed, 5 insertions, 4 deletions
diff --git a/lib/profile/InstrProfilingFile.c b/lib/profile/InstrProfilingFile.c
index 6e6b8fac5..1299a6d8c 100644
--- a/lib/profile/InstrProfilingFile.c
+++ b/lib/profile/InstrProfilingFile.c
@@ -19,6 +19,7 @@
#include "WindowsMMap.h"
/* For _chsize_s */
#include <io.h>
+#include <process.h>
#else
#include <sys/file.h>
#include <sys/mman.h>
@@ -186,7 +187,7 @@ static int doProfileMerging(FILE *ProfileFile, int *MergeDone) {
// Truncate the file in case merging of value profile did not happend to
// prevent from leaving garbage data at the end of the profile file.
- ftruncate(fileno(ProfileFile), __llvm_profile_get_size_for_buffer());
+ COMPILER_RT_FTRUNCATE(ProfileFile, __llvm_profile_get_size_for_buffer());
(void)munmap(ProfileBuffer, ProfileFileSize);
*MergeDone = 1;
diff --git a/lib/sanitizer_common/sanitizer_common_interceptors.inc b/lib/sanitizer_common/sanitizer_common_interceptors.inc
index cc3d6d889..21edd5680 100644
--- a/lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ b/lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -6537,6 +6537,7 @@ INTERCEPTOR(wchar_t *, wcsncat, wchar_t *dst, const wchar_t *src, SIZE_T n) {
#define INIT_WCSCAT
#endif
+#if SANITIZER_INTERCEPT_STRXFRM
static SIZE_T RealStrLen(const char *str) { return REAL(strlen)(str); }
static SIZE_T RealStrLen(const wchar_t *str) { return REAL(wcslen)(str); }
@@ -6553,7 +6554,6 @@ static SIZE_T RealStrLen(const wchar_t *str) { return REAL(wcslen)(str); }
return res; \
}
-#if SANITIZER_INTERCEPT_STRXFRM
INTERCEPTOR(SIZE_T, strxfrm, char *dest, const char *src, SIZE_T len) {
STRXFRM_INTERCEPTOR_IMPL(strxfrm, dest, src, len);
}
diff --git a/lib/sanitizer_common/sanitizer_win.cc b/lib/sanitizer_common/sanitizer_win.cc
index 364594961..326abaee1 100644
--- a/lib/sanitizer_common/sanitizer_win.cc
+++ b/lib/sanitizer_common/sanitizer_win.cc
@@ -492,7 +492,7 @@ void SleepForMillis(int millis) {
}
u64 NanoTime() {
- static LARGE_INTEGER frequency = {0};
+ static LARGE_INTEGER frequency = {};
LARGE_INTEGER counter;
if (UNLIKELY(frequency.QuadPart == 0)) {
QueryPerformanceFrequency(&frequency);
@@ -1059,7 +1059,7 @@ bool GetRandom(void *buffer, uptr length, bool blocking) {
}
u32 GetNumberOfCPUs() {
- SYSTEM_INFO sysinfo = {0};
+ SYSTEM_INFO sysinfo = {};
GetNativeSystemInfo(&sysinfo);
return sysinfo.dwNumberOfProcessors;
}