forked from OSchip/llvm-project
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++. llvm-svn: 330616
This commit is contained in:
parent
7f31119fb0
commit
963aba3452
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue