<div dir="ltr">nice. Thanks for the fix!<div><br></div><div>David</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 17, 2016 at 11:12 AM, Reid Kleckner via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rnk<br>
Date: Fri Jun 17 13:12:50 2016<br>
New Revision: 273026<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=273026&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=273026&view=rev</a><br>
Log:<br>
Fix most MSVC warnings in compiler-rt profiling library<br>
<br>
Here's the warnings and how they were fixed:<br>
<br>
- InstrProfilingUtil.c(110): warning C4013: '_open_osfhandle' undefined; assuming extern returning int<br>
<br>
Include io.h to get the prototype.<br>
<br>
- warning C4005: 'FILE_MAP_EXECUTE': macro redefinition<br>
<br>
Stop trying to support pre-XP versions of Windows, don't attempt to<br>
define this macro.<br>
<br>
- InstrProfilingWriter.c(271): warning C4221: nonstandard extension used: 'Data': cannot be initialized using address of automatic variable 'Header'<br>
- InstrProfilingWriter.c(275): warning C4221: nonstandard extension used: 'Data': cannot be initialized using address of automatic variable 'Zeroes'<br>
<br>
Turn this warning off. This is definitely legal in C++, all compilers<br>
accept it, and I only have room for half of one language standard in my<br>
brain.<br>
<br>
- InstrProfilingValue.c(320): warning C4113: 'uint32_t (__cdecl *)()' differs in parameter lists from 'uint32_t (__cdecl *)(void)'<br>
<br>
Fix this with an explicit (void) in the prototype.<br>
<br>
- InstrProfilingMerge.c.obj : warning LNK4006: _VPMergeHook already defined in InstrProfilingMergeFile.c.obj; second definition ignored<br>
<br>
Last remaining warning. This is from linking a selectany definition with<br>
a strong definition. We need to sort out weak symbols in compiler-rt in<br>
general, though.<br>
<br>
Modified:<br>
    compiler-rt/trunk/cmake/config-ix.cmake<br>
    compiler-rt/trunk/lib/profile/CMakeLists.txt<br>
    compiler-rt/trunk/lib/profile/InstrProfilingPort.h<br>
    compiler-rt/trunk/lib/profile/InstrProfilingUtil.c<br>
    compiler-rt/trunk/lib/profile/InstrProfilingValue.c<br>
    compiler-rt/trunk/lib/profile/WindowsMMap.h<br>
<br>
Modified: compiler-rt/trunk/cmake/config-ix.cmake<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/config-ix.cmake?rev=273026&r1=273025&r2=273026&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/config-ix.cmake?rev=273026&r1=273025&r2=273026&view=diff</a><br>
==============================================================================<br>
--- compiler-rt/trunk/cmake/config-ix.cmake (original)<br>
+++ compiler-rt/trunk/cmake/config-ix.cmake Fri Jun 17 13:12:50 2016<br>
@@ -60,6 +60,7 @@ check_cxx_compiler_flag(/W4 COMPILER_RT_<br>
 check_cxx_compiler_flag(/WX COMPILER_RT_HAS_WX_FLAG)<br>
 check_cxx_compiler_flag(/wd4146 COMPILER_RT_HAS_WD4146_FLAG)<br>
 check_cxx_compiler_flag(/wd4291 COMPILER_RT_HAS_WD4291_FLAG)<br>
+check_cxx_compiler_flag(/wd4221 COMPILER_RT_HAS_WD4221_FLAG)<br>
 check_cxx_compiler_flag(/wd4391 COMPILER_RT_HAS_WD4391_FLAG)<br>
 check_cxx_compiler_flag(/wd4722 COMPILER_RT_HAS_WD4722_FLAG)<br>
 check_cxx_compiler_flag(/wd4800 COMPILER_RT_HAS_WD4800_FLAG)<br>
<br>
Modified: compiler-rt/trunk/lib/profile/CMakeLists.txt<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/CMakeLists.txt?rev=273026&r1=273025&r2=273026&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/CMakeLists.txt?rev=273026&r1=273025&r2=273026&view=diff</a><br>
==============================================================================<br>
--- compiler-rt/trunk/lib/profile/CMakeLists.txt (original)<br>
+++ compiler-rt/trunk/lib/profile/CMakeLists.txt Fri Jun 17 13:12:50 2016<br>
@@ -77,6 +77,11 @@ if(COMPILER_RT_TARGET_HAS_FCNTL_LCK)<br>
      -DCOMPILER_RT_HAS_FCNTL_LCK=1)<br>
 endif()<br>
<br>
+# This appears to be a C-only warning banning the use of locals in aggregate<br>
+# initializers. All other compilers accept this, though.<br>
+# nonstandard extension used : 'identifier' : cannot be initialized using address of automatic variable<br>
+append_list_if(COMPILER_RT_HAS_WD4221_FLAG /wd4221 EXTRA_FLAGS)<br>
+<br>
 if(APPLE)<br>
   add_compiler_rt_runtime(clang_rt.profile<br>
     STATIC<br>
<br>
Modified: compiler-rt/trunk/lib/profile/InstrProfilingPort.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingPort.h?rev=273026&r1=273025&r2=273026&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingPort.h?rev=273026&r1=273025&r2=273026&view=diff</a><br>
==============================================================================<br>
--- compiler-rt/trunk/lib/profile/InstrProfilingPort.h (original)<br>
+++ compiler-rt/trunk/lib/profile/InstrProfilingPort.h Fri Jun 17 13:12:50 2016<br>
@@ -13,6 +13,7 @@<br>
 #ifdef _MSC_VER<br>
 #define COMPILER_RT_ALIGNAS(x) __declspec(align(x))<br>
 #define COMPILER_RT_VISIBILITY<br>
+/* FIXME: selectany does not have the same semantics as weak. */<br>
 #define COMPILER_RT_WEAK __declspec(selectany)<br>
 /* Need to include <windows.h> */<br>
 #define COMPILER_RT_ALLOCA _alloca<br>
<br>
Modified: compiler-rt/trunk/lib/profile/InstrProfilingUtil.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingUtil.c?rev=273026&r1=273025&r2=273026&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingUtil.c?rev=273026&r1=273025&r2=273026&view=diff</a><br>
==============================================================================<br>
--- compiler-rt/trunk/lib/profile/InstrProfilingUtil.c (original)<br>
+++ compiler-rt/trunk/lib/profile/InstrProfilingUtil.c Fri Jun 17 13:12:50 2016<br>
@@ -12,6 +12,7 @@<br>
<br>
 #ifdef _WIN32<br>
 #include <direct.h><br>
+#include <io.h><br>
 #include <windows.h><br>
 #else<br>
 #include <sys/stat.h><br>
<br>
Modified: compiler-rt/trunk/lib/profile/InstrProfilingValue.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingValue.c?rev=273026&r1=273025&r2=273026&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingValue.c?rev=273026&r1=273025&r2=273026&view=diff</a><br>
==============================================================================<br>
--- compiler-rt/trunk/lib/profile/InstrProfilingValue.c (original)<br>
+++ compiler-rt/trunk/lib/profile/InstrProfilingValue.c Fri Jun 17 13:12:50 2016<br>
@@ -309,7 +309,7 @@ static ValueProfNode *getNextNValueData(<br>
   return VNode;<br>
 }<br>
<br>
-static uint32_t getValueProfDataSizeWrapper() {<br>
+static uint32_t getValueProfDataSizeWrapper(void) {<br>
   return getValueProfDataSize(&RTRecordClosure);<br>
 }<br>
<br>
<br>
Modified: compiler-rt/trunk/lib/profile/WindowsMMap.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/WindowsMMap.h?rev=273026&r1=273025&r2=273026&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/WindowsMMap.h?rev=273026&r1=273025&r2=273026&view=diff</a><br>
==============================================================================<br>
--- compiler-rt/trunk/lib/profile/WindowsMMap.h (original)<br>
+++ compiler-rt/trunk/lib/profile/WindowsMMap.h Fri Jun 17 13:12:50 2016<br>
@@ -21,13 +21,7 @@<br>
  */<br>
 #define PROT_READ     0x1<br>
 #define PROT_WRITE    0x2<br>
-/* This flag is only available in WinXP+ */<br>
-#ifdef FILE_MAP_EXECUTE<br>
-#define PROT_EXEC     0x4<br>
-#else<br>
-#define PROT_EXEC        0x0<br>
-#define FILE_MAP_EXECUTE 0<br>
-#endif<br>
+#define PROT_EXEC     0x0<br>
<br>
 #define MAP_FILE      0x00<br>
 #define MAP_SHARED    0x01<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>