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 | 45769d7967f4593ebe90da50d898edc7fe48da98 (patch) | |
tree | 516dc51fffa70fc5a759bf87242995cf2ccb4182 | |
parent | d80ed424db5879f5250e0be79332bc4c31a8ef29 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@273026 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | cmake/config-ix.cmake | 1 | ||||
-rw-r--r-- | lib/profile/CMakeLists.txt | 5 | ||||
-rw-r--r-- | lib/profile/InstrProfilingPort.h | 1 | ||||
-rw-r--r-- | lib/profile/InstrProfilingUtil.c | 1 | ||||
-rw-r--r-- | lib/profile/InstrProfilingValue.c | 2 | ||||
-rw-r--r-- | lib/profile/WindowsMMap.h | 8 |
6 files changed, 10 insertions, 8 deletions
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index bcedcfc6a..a9dcd7e7c 100644 --- a/cmake/config-ix.cmake +++ b/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/lib/profile/CMakeLists.txt b/lib/profile/CMakeLists.txt index 996f3beaf..79e5508ac 100644 --- a/lib/profile/CMakeLists.txt +++ b/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/lib/profile/InstrProfilingPort.h b/lib/profile/InstrProfilingPort.h index 17509c124..4fd8aca4a 100644 --- a/lib/profile/InstrProfilingPort.h +++ b/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/lib/profile/InstrProfilingUtil.c b/lib/profile/InstrProfilingUtil.c index e87ab7640..be1012117 100644 --- a/lib/profile/InstrProfilingUtil.c +++ b/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/lib/profile/InstrProfilingValue.c b/lib/profile/InstrProfilingValue.c index b6a982dcb..93957e323 100644 --- a/lib/profile/InstrProfilingValue.c +++ b/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/lib/profile/WindowsMMap.h b/lib/profile/WindowsMMap.h index 7b94eb282..271619aea 100644 --- a/lib/profile/WindowsMMap.h +++ b/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 |