diff options
author | Reid Kleckner <rnk@google.com> | 2016-06-17 18:12:50 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2016-06-17 18:12:50 +0000 |
commit | 652d70f3e1838012d2e40bb27ff08bcbc701cf5b (patch) | |
tree | f02518b81317e1d305fa02b40c747f185cce7bbc | |
parent | 148a6469dccf3c8a20874b1b451549826a1e4da8 (diff) | |
download | bcm5719-llvm-652d70f3e1838012d2e40bb27ff08bcbc701cf5b.tar.gz bcm5719-llvm-652d70f3e1838012d2e40bb27ff08bcbc701cf5b.zip |
Fix most MSVC warnings in compiler-rt profiling library
Here's the warnings and how they were fixed:
- InstrProfilingUtil.c(110): warning C4013: '_open_osfhandle' undefined; assuming extern returning int
Include io.h to get the prototype.
- warning C4005: 'FILE_MAP_EXECUTE': macro redefinition
Stop trying to support pre-XP versions of Windows, don't attempt to
define this macro.
- InstrProfilingWriter.c(271): warning C4221: nonstandard extension used: 'Data': cannot be initialized using address of automatic variable 'Header'
- InstrProfilingWriter.c(275): warning C4221: nonstandard extension used: 'Data': cannot be initialized using address of automatic variable 'Zeroes'
Turn this warning off. This is definitely legal in C++, all compilers
accept it, and I only have room for half of one language standard in my
brain.
- InstrProfilingValue.c(320): warning C4113: 'uint32_t (__cdecl *)()' differs in parameter lists from 'uint32_t (__cdecl *)(void)'
Fix this with an explicit (void) in the prototype.
- InstrProfilingMerge.c.obj : warning LNK4006: _VPMergeHook already defined in InstrProfilingMergeFile.c.obj; second definition ignored
Last remaining warning. This is from linking a selectany definition with
a strong definition. We need to sort out weak symbols in compiler-rt in
general, though.
llvm-svn: 273026
-rw-r--r-- | compiler-rt/cmake/config-ix.cmake | 1 | ||||
-rw-r--r-- | compiler-rt/lib/profile/CMakeLists.txt | 5 | ||||
-rw-r--r-- | compiler-rt/lib/profile/InstrProfilingPort.h | 1 | ||||
-rw-r--r-- | compiler-rt/lib/profile/InstrProfilingUtil.c | 1 | ||||
-rw-r--r-- | compiler-rt/lib/profile/InstrProfilingValue.c | 2 | ||||
-rw-r--r-- | compiler-rt/lib/profile/WindowsMMap.h | 8 |
6 files changed, 10 insertions, 8 deletions
diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake index bcedcfc6a86..a9dcd7e7ca6 100644 --- a/compiler-rt/cmake/config-ix.cmake +++ b/compiler-rt/cmake/config-ix.cmake @@ -60,6 +60,7 @@ check_cxx_compiler_flag(/W4 COMPILER_RT_HAS_W4_FLAG) check_cxx_compiler_flag(/WX COMPILER_RT_HAS_WX_FLAG) check_cxx_compiler_flag(/wd4146 COMPILER_RT_HAS_WD4146_FLAG) check_cxx_compiler_flag(/wd4291 COMPILER_RT_HAS_WD4291_FLAG) +check_cxx_compiler_flag(/wd4221 COMPILER_RT_HAS_WD4221_FLAG) check_cxx_compiler_flag(/wd4391 COMPILER_RT_HAS_WD4391_FLAG) check_cxx_compiler_flag(/wd4722 COMPILER_RT_HAS_WD4722_FLAG) check_cxx_compiler_flag(/wd4800 COMPILER_RT_HAS_WD4800_FLAG) diff --git a/compiler-rt/lib/profile/CMakeLists.txt b/compiler-rt/lib/profile/CMakeLists.txt index 996f3beaff4..79e5508ac40 100644 --- a/compiler-rt/lib/profile/CMakeLists.txt +++ b/compiler-rt/lib/profile/CMakeLists.txt @@ -77,6 +77,11 @@ if(COMPILER_RT_TARGET_HAS_FCNTL_LCK) -DCOMPILER_RT_HAS_FCNTL_LCK=1) endif() +# This appears to be a C-only warning banning the use of locals in aggregate +# initializers. All other compilers accept this, though. +# nonstandard extension used : 'identifier' : cannot be initialized using address of automatic variable +append_list_if(COMPILER_RT_HAS_WD4221_FLAG /wd4221 EXTRA_FLAGS) + if(APPLE) add_compiler_rt_runtime(clang_rt.profile STATIC diff --git a/compiler-rt/lib/profile/InstrProfilingPort.h b/compiler-rt/lib/profile/InstrProfilingPort.h index 17509c12447..4fd8aca4a9d 100644 --- a/compiler-rt/lib/profile/InstrProfilingPort.h +++ b/compiler-rt/lib/profile/InstrProfilingPort.h @@ -13,6 +13,7 @@ #ifdef _MSC_VER #define COMPILER_RT_ALIGNAS(x) __declspec(align(x)) #define COMPILER_RT_VISIBILITY +/* FIXME: selectany does not have the same semantics as weak. */ #define COMPILER_RT_WEAK __declspec(selectany) /* Need to include <windows.h> */ #define COMPILER_RT_ALLOCA _alloca diff --git a/compiler-rt/lib/profile/InstrProfilingUtil.c b/compiler-rt/lib/profile/InstrProfilingUtil.c index e87ab764044..be10121173e 100644 --- a/compiler-rt/lib/profile/InstrProfilingUtil.c +++ b/compiler-rt/lib/profile/InstrProfilingUtil.c @@ -12,6 +12,7 @@ #ifdef _WIN32 #include <direct.h> +#include <io.h> #include <windows.h> #else #include <sys/stat.h> diff --git a/compiler-rt/lib/profile/InstrProfilingValue.c b/compiler-rt/lib/profile/InstrProfilingValue.c index b6a982dcb5e..93957e32376 100644 --- a/compiler-rt/lib/profile/InstrProfilingValue.c +++ b/compiler-rt/lib/profile/InstrProfilingValue.c @@ -309,7 +309,7 @@ static ValueProfNode *getNextNValueData(uint32_t VK, uint32_t Site, return VNode; } -static uint32_t getValueProfDataSizeWrapper() { +static uint32_t getValueProfDataSizeWrapper(void) { return getValueProfDataSize(&RTRecordClosure); } diff --git a/compiler-rt/lib/profile/WindowsMMap.h b/compiler-rt/lib/profile/WindowsMMap.h index 7b94eb28230..271619aea09 100644 --- a/compiler-rt/lib/profile/WindowsMMap.h +++ b/compiler-rt/lib/profile/WindowsMMap.h @@ -21,13 +21,7 @@ */ #define PROT_READ 0x1 #define PROT_WRITE 0x2 -/* This flag is only available in WinXP+ */ -#ifdef FILE_MAP_EXECUTE -#define PROT_EXEC 0x4 -#else -#define PROT_EXEC 0x0 -#define FILE_MAP_EXECUTE 0 -#endif +#define PROT_EXEC 0x0 #define MAP_FILE 0x00 #define MAP_SHARED 0x01 |