[Openmp-commits] [openmp] r348756 - Support clang compiling under windows-gnu and windows-msvc

Andrey Churbanov via Openmp-commits openmp-commits at lists.llvm.org
Mon Dec 10 05:45:00 PST 2018


Author: achurbanov
Date: Mon Dec 10 05:45:00 2018
New Revision: 348756

URL: http://llvm.org/viewvc/llvm-project?rev=348756&view=rev
Log:
Support clang compiling under	windows-gnu and windows-msvc

Patch by Peiyuan Song <squallatf at gmail.com>

Differential Revision: https://reviews.llvm.org/D53422

Modified:
    openmp/trunk/runtime/cmake/LibompHandleFlags.cmake
    openmp/trunk/runtime/cmake/config-ix.cmake
    openmp/trunk/runtime/src/kmp.h
    openmp/trunk/runtime/src/kmp_affinity.h
    openmp/trunk/runtime/src/kmp_config.h.cmake
    openmp/trunk/runtime/src/kmp_dispatch.cpp
    openmp/trunk/runtime/src/kmp_io.cpp
    openmp/trunk/runtime/src/kmp_lock.cpp
    openmp/trunk/runtime/src/kmp_os.h
    openmp/trunk/runtime/src/kmp_platform.h
    openmp/trunk/runtime/src/kmp_safe_c_api.h
    openmp/trunk/runtime/src/kmp_settings.cpp
    openmp/trunk/runtime/src/kmp_utility.cpp
    openmp/trunk/runtime/src/kmp_wrapper_getpid.h
    openmp/trunk/runtime/src/kmp_wrapper_malloc.h
    openmp/trunk/runtime/src/libomp.rc.var
    openmp/trunk/runtime/src/thirdparty/ittnotify/ittnotify_static.c
    openmp/trunk/runtime/src/z_Windows_NT_util.cpp

Modified: openmp/trunk/runtime/cmake/LibompHandleFlags.cmake
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/cmake/LibompHandleFlags.cmake?rev=348756&r1=348755&r2=348756&view=diff
==============================================================================
--- openmp/trunk/runtime/cmake/LibompHandleFlags.cmake (original)
+++ openmp/trunk/runtime/cmake/LibompHandleFlags.cmake Mon Dec 10 05:45:00 2018
@@ -50,6 +50,7 @@ function(libomp_get_c_and_cxxflags_commo
   libomp_append(flags_local /GS LIBOMP_HAVE_GS_FLAG)
   libomp_append(flags_local /EHsc LIBOMP_HAVE_EHSC_FLAG)
   libomp_append(flags_local /Oy- LIBOMP_HAVE_OY__FLAG)
+  libomp_append(flags_local -mrtm LIBOMP_HAVE_MRTM_FLAG)
   # Intel(R) C Compiler flags
   libomp_append(flags_local /Qsafeseh LIBOMP_HAVE_QSAFESEH_FLAG)
   libomp_append(flags_local -Qoption,cpp,--extended_float_types LIBOMP_HAVE_EXTENDED_FLOAT_TYPES_FLAG)

Modified: openmp/trunk/runtime/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/cmake/config-ix.cmake?rev=348756&r1=348755&r2=348756&view=diff
==============================================================================
--- openmp/trunk/runtime/cmake/config-ix.cmake (original)
+++ openmp/trunk/runtime/cmake/config-ix.cmake Mon Dec 10 05:45:00 2018
@@ -73,13 +73,16 @@ check_c_compiler_flag(-ftls-model=initia
 libomp_check_architecture_flag(-mmic LIBOMP_HAVE_MMIC_FLAG)
 libomp_check_architecture_flag(-m32 LIBOMP_HAVE_M32_FLAG)
 if(WIN32)
-  # Check Windows MSVC style flags.
-  check_c_compiler_flag(/TP LIBOMP_HAVE_TP_FLAG)
-  check_cxx_compiler_flag(/EHsc LIBOMP_HAVE_EHSC_FLAG)
-  check_cxx_compiler_flag(/GS LIBOMP_HAVE_GS_FLAG)
-  check_cxx_compiler_flag(/Oy- LIBOMP_HAVE_Oy__FLAG)
-  check_cxx_compiler_flag(/arch:SSE2 LIBOMP_HAVE_ARCH_SSE2_FLAG)
-  check_cxx_compiler_flag(/Qsafeseh LIBOMP_HAVE_QSAFESEH_FLAG)
+  if(MSVC)
+    # Check Windows MSVC style flags.
+    check_c_compiler_flag(/TP LIBOMP_HAVE_TP_FLAG)
+    check_cxx_compiler_flag(/EHsc LIBOMP_HAVE_EHSC_FLAG)
+    check_cxx_compiler_flag(/GS LIBOMP_HAVE_GS_FLAG)
+    check_cxx_compiler_flag(/Oy- LIBOMP_HAVE_Oy__FLAG)
+    check_cxx_compiler_flag(/arch:SSE2 LIBOMP_HAVE_ARCH_SSE2_FLAG)
+    check_cxx_compiler_flag(/Qsafeseh LIBOMP_HAVE_QSAFESEH_FLAG)
+  endif()
+  check_c_compiler_flag(-mrtm LIBOMP_HAVE_MRTM_FLAG)
   # It is difficult to create a dummy masm assembly file
   # and then check the MASM assembler to see if these flags exist and work,
   # so we assume they do for Windows.

Modified: openmp/trunk/runtime/src/kmp.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp.h?rev=348756&r1=348755&r2=348756&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp.h (original)
+++ openmp/trunk/runtime/src/kmp.h Mon Dec 10 05:45:00 2018
@@ -544,11 +544,15 @@ typedef int PACKED_REDUCTION_METHOD_T;
 
 #if KMP_OS_WINDOWS
 #define USE_CBLKDATA
+#if KMP_MSVC_COMPAT
 #pragma warning(push)
 #pragma warning(disable : 271 310)
+#endif
 #include <windows.h>
+#if KMP_MSVC_COMPAT
 #pragma warning(pop)
 #endif
+#endif
 
 #if KMP_OS_UNIX
 #include <dlfcn.h>
@@ -560,7 +564,7 @@ typedef int PACKED_REDUCTION_METHOD_T;
 
 // GROUP_AFFINITY is already defined for _MSC_VER>=1600 (VS2010 and later).
 #if KMP_OS_WINDOWS
-#if _MSC_VER < 1600
+#if _MSC_VER < 1600 && KMP_MSVC_COMPAT
 typedef struct GROUP_AFFINITY {
   KAFFINITY Mask;
   WORD Group;

Modified: openmp/trunk/runtime/src/kmp_affinity.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_affinity.h?rev=348756&r1=348755&r2=348756&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_affinity.h (original)
+++ openmp/trunk/runtime/src/kmp_affinity.h Mon Dec 10 05:45:00 2018
@@ -375,26 +375,26 @@ class KMPNativeAffinity : public KMPAffi
       mask[i / BITS_PER_MASK_T] &= ~((mask_t)1 << (i % BITS_PER_MASK_T));
     }
     void zero() override {
-      for (size_t i = 0; i < __kmp_num_proc_groups; ++i)
+      for (int i = 0; i < __kmp_num_proc_groups; ++i)
         mask[i] = 0;
     }
     void copy(const KMPAffinity::Mask *src) override {
       const Mask *convert = static_cast<const Mask *>(src);
-      for (size_t i = 0; i < __kmp_num_proc_groups; ++i)
+      for (int i = 0; i < __kmp_num_proc_groups; ++i)
         mask[i] = convert->mask[i];
     }
     void bitwise_and(const KMPAffinity::Mask *rhs) override {
       const Mask *convert = static_cast<const Mask *>(rhs);
-      for (size_t i = 0; i < __kmp_num_proc_groups; ++i)
+      for (int i = 0; i < __kmp_num_proc_groups; ++i)
         mask[i] &= convert->mask[i];
     }
     void bitwise_or(const KMPAffinity::Mask *rhs) override {
       const Mask *convert = static_cast<const Mask *>(rhs);
-      for (size_t i = 0; i < __kmp_num_proc_groups; ++i)
+      for (int i = 0; i < __kmp_num_proc_groups; ++i)
         mask[i] |= convert->mask[i];
     }
     void bitwise_not() override {
-      for (size_t i = 0; i < __kmp_num_proc_groups; ++i)
+      for (int i = 0; i < __kmp_num_proc_groups; ++i)
         mask[i] = ~(mask[i]);
     }
     int begin() const override {

Modified: openmp/trunk/runtime/src/kmp_config.h.cmake
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_config.h.cmake?rev=348756&r1=348755&r2=348756&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_config.h.cmake (original)
+++ openmp/trunk/runtime/src/kmp_config.h.cmake Mon Dec 10 05:45:00 2018
@@ -74,6 +74,8 @@
 #if LIBOMP_TSAN_SUPPORT
 #define TSAN_SUPPORT
 #endif
+#cmakedefine01 MSVC
+#define KMP_MSVC_COMPAT MSVC
 
 // Configured cache line based on architecture
 #if KMP_ARCH_PPC64

Modified: openmp/trunk/runtime/src/kmp_dispatch.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_dispatch.cpp?rev=348756&r1=348755&r2=348756&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_dispatch.cpp (original)
+++ openmp/trunk/runtime/src/kmp_dispatch.cpp Mon Dec 10 05:45:00 2018
@@ -24,7 +24,7 @@
 #include "kmp_itt.h"
 #include "kmp_stats.h"
 #include "kmp_str.h"
-#if KMP_OS_WINDOWS && KMP_ARCH_X86
+#if KMP_USE_X87CONTROL
 #include <float.h>
 #endif
 #include "kmp_lock.h"
@@ -478,7 +478,7 @@ void __kmp_dispatch_init_algorithm(ident
         /* commonly used term: (2 nproc - 1)/(2 nproc) */
         DBL x;
 
-#if KMP_OS_WINDOWS && KMP_ARCH_X86
+#if KMP_USE_X87CONTROL
         /* Linux* OS already has 64-bit computation by default for long double,
            and on Windows* OS on Intel(R) 64, /Qlong_double doesn't work. On
            Windows* OS on IA-32 architecture, we need to set precision to 64-bit
@@ -573,7 +573,7 @@ void __kmp_dispatch_init_algorithm(ident
         pr->u.p.count = tc - __kmp_dispatch_guided_remaining(
                                  tc, GUIDED_ANALYTICAL_WORKAROUND, cross) -
                         cross * chunk;
-#if KMP_OS_WINDOWS && KMP_ARCH_X86
+#if KMP_USE_X87CONTROL
         // restore FPCW
         _control87(oldFpcw, _MCW_PC);
 #endif
@@ -1625,7 +1625,7 @@ int __kmp_dispatch_next_algorithm(int gt
   case kmp_sch_guided_analytical_chunked: {
     T chunkspec = pr->u.p.parm1;
     UT chunkIdx;
-#if KMP_OS_WINDOWS && KMP_ARCH_X86
+#if KMP_USE_X87CONTROL
     /* for storing original FPCW value for Windows* OS on
        IA-32 architecture 8-byte version */
     unsigned int oldFpcw;
@@ -1662,7 +1662,7 @@ int __kmp_dispatch_next_algorithm(int gt
    Windows* OS.
    This check works around the possible effect that init != 0 for chunkIdx == 0.
  */
-#if KMP_OS_WINDOWS && KMP_ARCH_X86
+#if KMP_USE_X87CONTROL
         /* If we haven't already done so, save original
            FPCW and set precision to 64-bit, as Windows* OS
            on IA-32 architecture defaults to 53-bit */
@@ -1690,7 +1690,7 @@ int __kmp_dispatch_next_algorithm(int gt
         } // if
       } // if
     } // while (1)
-#if KMP_OS_WINDOWS && KMP_ARCH_X86
+#if KMP_USE_X87CONTROL
     /* restore FPCW if necessary
        AC: check fpcwSet flag first because oldFpcw can be uninitialized here
     */

Modified: openmp/trunk/runtime/src/kmp_io.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_io.cpp?rev=348756&r1=348755&r2=348756&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_io.cpp (original)
+++ openmp/trunk/runtime/src/kmp_io.cpp Mon Dec 10 05:45:00 2018
@@ -27,11 +27,15 @@
 #include "kmp_str.h"
 
 #if KMP_OS_WINDOWS
+#if KMP_MSVC_COMPAT
 #pragma warning(push)
 #pragma warning(disable : 271 310)
+#endif
 #include <windows.h>
+#if KMP_MSVC_COMPAT
 #pragma warning(pop)
 #endif
+#endif
 
 /* ------------------------------------------------------------------------ */
 

Modified: openmp/trunk/runtime/src/kmp_lock.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_lock.cpp?rev=348756&r1=348755&r2=348756&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_lock.cpp (original)
+++ openmp/trunk/runtime/src/kmp_lock.cpp Mon Dec 10 05:45:00 2018
@@ -1716,7 +1716,8 @@ static void __kmp_set_queuing_lock_flags
 
 /* RTM Adaptive locks */
 
-#if KMP_COMPILER_ICC && __INTEL_COMPILER >= 1300
+#if (KMP_COMPILER_ICC && __INTEL_COMPILER >= 1300) ||                          \
+    (KMP_COMPILER_MSVC && _MSC_VER >= 1700) || KMP_COMPILER_CLANG
 
 #include <immintrin.h>
 #define SOFT_ABORT_MASK (_XABORT_RETRY | _XABORT_CONFLICT | _XABORT_EXPLICIT)

Modified: openmp/trunk/runtime/src/kmp_os.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_os.h?rev=348756&r1=348755&r2=348756&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_os.h (original)
+++ openmp/trunk/runtime/src/kmp_os.h Mon Dec 10 05:45:00 2018
@@ -100,6 +100,7 @@ typedef long double _Quad;
 #endif
 #endif /* KMP_ARCH_X86 || KMP_ARCH_X86_64 */
 
+#define KMP_USE_X87CONTROL 0
 #if KMP_OS_WINDOWS
 typedef char kmp_int8;
 typedef unsigned char kmp_uint8;
@@ -122,6 +123,10 @@ typedef struct kmp_struct64 kmp_int64;
 typedef struct kmp_struct64 kmp_uint64;
 /* Not sure what to use for KMP_[U]INT64_SPEC here */
 #endif
+#if KMP_ARCH_X86 && KMP_MSVC_COMPAT
+#undef KMP_USE_X87CONTROL
+#define KMP_USE_X87CONTROL 1
+#endif
 #if KMP_ARCH_X86_64
 #define KMP_INTPTR 1
 typedef __int64 kmp_intptr_t;
@@ -246,7 +251,7 @@ template <> struct traits_t<unsigned lon
 
 #define KMP_EXPORT extern /* export declaration in guide libraries */
 
-#if __GNUC__ >= 4
+#if __GNUC__ >= 4 && !defined(__MINGW32__)
 #define __forceinline __inline
 #endif
 
@@ -296,7 +301,7 @@ extern "C" {
 #define KMP_NORETURN __attribute__((noreturn))
 #endif
 
-#if KMP_OS_WINDOWS
+#if KMP_OS_WINDOWS && KMP_MSVC_COMPAT
 #define KMP_ALIGN(bytes) __declspec(align(bytes))
 #define KMP_THREAD_LOCAL __declspec(thread)
 #define KMP_ALIAS /* Nothing */
@@ -356,10 +361,12 @@ enum kmp_mem_fence_type {
 
 #if KMP_ASM_INTRINS && KMP_OS_WINDOWS
 
+#if KMP_MSVC_COMPAT && !KMP_COMPILER_CLANG
 #pragma intrinsic(InterlockedExchangeAdd)
 #pragma intrinsic(InterlockedCompareExchange)
 #pragma intrinsic(InterlockedExchange)
 #pragma intrinsic(InterlockedExchange64)
+#endif
 
 // Using InterlockedIncrement / InterlockedDecrement causes a library loading
 // ordering problem, so we use InterlockedExchangeAdd instead.

Modified: openmp/trunk/runtime/src/kmp_platform.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_platform.h?rev=348756&r1=348755&r2=348756&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_platform.h (original)
+++ openmp/trunk/runtime/src/kmp_platform.h Mon Dec 10 05:45:00 2018
@@ -101,7 +101,7 @@
 #define KMP_ARCH_MIPS64 0
 
 #if KMP_OS_WINDOWS
-#if defined _M_AMD64
+#if defined(_M_AMD64) || defined(__x86_64)
 #undef KMP_ARCH_X86_64
 #define KMP_ARCH_X86_64 1
 #else

Modified: openmp/trunk/runtime/src/kmp_safe_c_api.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_safe_c_api.h?rev=348756&r1=348755&r2=348756&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_safe_c_api.h (original)
+++ openmp/trunk/runtime/src/kmp_safe_c_api.h Mon Dec 10 05:45:00 2018
@@ -15,7 +15,7 @@
 
 // Not every unsafe call listed here is handled now, but keeping everything
 // in one place should be handy for future maintenance.
-#if KMP_OS_WINDOWS
+#if KMP_OS_WINDOWS && KMP_MSVC_COMPAT
 
 #define RSIZE_MAX_STR (4UL << 10) // 4KB
 

Modified: openmp/trunk/runtime/src/kmp_settings.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_settings.cpp?rev=348756&r1=348755&r2=348756&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_settings.cpp (original)
+++ openmp/trunk/runtime/src/kmp_settings.cpp Mon Dec 10 05:45:00 2018
@@ -5513,7 +5513,7 @@ void __kmp_env_initialize(char const *st
         // then determine if it is equal to that single group.
         if (within_one_group) {
           DWORD num_bits_in_group = __kmp_GetActiveProcessorCount(group);
-          int num_bits_in_mask = 0;
+          DWORD num_bits_in_mask = 0;
           for (int bit = init_mask->begin(); bit != init_mask->end();
                bit = init_mask->next(bit))
             num_bits_in_mask++;

Modified: openmp/trunk/runtime/src/kmp_utility.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_utility.cpp?rev=348756&r1=348755&r2=348756&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_utility.cpp (original)
+++ openmp/trunk/runtime/src/kmp_utility.cpp Mon Dec 10 05:45:00 2018
@@ -375,7 +375,11 @@ void __kmp_expand_file_name(char *result
         case 'I':
         case 'i': {
           pid_t id = getpid();
+#if KMP_ARCH_X86_64 && defined(__MINGW32__)
+          snp_result = KMP_SNPRINTF(pos, end - pos + 1, "%0*lld", width, id);
+#else
           snp_result = KMP_SNPRINTF(pos, end - pos + 1, "%0*d", width, id);
+#endif
           if (snp_result >= 0 && snp_result <= end - pos) {
             while (*pos)
               ++pos;

Modified: openmp/trunk/runtime/src/kmp_wrapper_getpid.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_wrapper_getpid.h?rev=348756&r1=348755&r2=348756&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_wrapper_getpid.h (original)
+++ openmp/trunk/runtime/src/kmp_wrapper_getpid.h Mon Dec 10 05:45:00 2018
@@ -39,7 +39,9 @@
 // "process.h".
 #include <process.h>
 // Let us simulate Unix.
+#if KMP_MSVC_COMPAT
 typedef int pid_t;
+#endif
 #define getpid _getpid
 #define __kmp_gettid() GetCurrentThreadId()
 

Modified: openmp/trunk/runtime/src/kmp_wrapper_malloc.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_wrapper_malloc.h?rev=348756&r1=348755&r2=348756&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_wrapper_malloc.h (original)
+++ openmp/trunk/runtime/src/kmp_wrapper_malloc.h Mon Dec 10 05:45:00 2018
@@ -93,7 +93,9 @@
 // Include alloca() declaration.
 #if KMP_OS_WINDOWS
 #include <malloc.h> // Windows* OS: _alloca() declared in "malloc.h".
+#if KMP_MSVC_COMPAT
 #define alloca _alloca // Allow to use alloca() with no underscore.
+#endif
 #elif KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_OPENBSD
 // Declared in "stdlib.h".
 #elif KMP_OS_UNIX

Modified: openmp/trunk/runtime/src/libomp.rc.var
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/libomp.rc.var?rev=348756&r1=348755&r2=348756&view=diff
==============================================================================
--- openmp/trunk/runtime/src/libomp.rc.var (original)
+++ openmp/trunk/runtime/src/libomp.rc.var Mon Dec 10 05:45:00 2018
@@ -11,7 +11,7 @@
 ////===----------------------------------------------------------------------===//
 //
 
-#include "winres.h"
+#include "winresrc.h"
 #include "kmp_config.h"
 
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US    // English (U.S.) resources

Modified: openmp/trunk/runtime/src/thirdparty/ittnotify/ittnotify_static.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/thirdparty/ittnotify/ittnotify_static.c?rev=348756&r1=348755&r2=348756&view=diff
==============================================================================
--- openmp/trunk/runtime/src/thirdparty/ittnotify/ittnotify_static.c (original)
+++ openmp/trunk/runtime/src/thirdparty/ittnotify/ittnotify_static.c Mon Dec 10 05:45:00 2018
@@ -12,7 +12,11 @@
 #include "ittnotify_config.h"
 
 #if ITT_PLATFORM==ITT_PLATFORM_WIN
+#if defined(__MINGW32__)
+#include <limits.h>
+#else
 #define PATH_MAX 512
+#endif
 #else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */
 #include <limits.h>
 #include <dlfcn.h>
@@ -28,7 +32,9 @@
 #include "ittnotify.h"
 #include "legacy/ittnotify.h"
 
+#if KMP_MSVC_COMPAT
 #include "disable_warnings.h"
+#endif
 
 static const char api_version[] = API_VERSION "\0\n@(#) $Revision: 481659 $\n";
 
@@ -194,7 +200,7 @@ static __itt_group_alias group_alias[] =
 
 #pragma pack(pop)
 
-#if ITT_PLATFORM==ITT_PLATFORM_WIN
+#if ITT_PLATFORM==ITT_PLATFORM_WIN && KMP_MSVC_COMPAT
 #pragma warning(push)
 #pragma warning(disable: 4054) /* warning C4054: 'type cast' : from function pointer 'XXX' to data pointer 'void *' */
 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
@@ -217,7 +223,7 @@ static __itt_api_info api_list[] = {
     {NULL, NULL, NULL, NULL, __itt_group_none}
 };
 
-#if ITT_PLATFORM==ITT_PLATFORM_WIN
+#if ITT_PLATFORM==ITT_PLATFORM_WIN && KMP_MSVC_COMPAT
 #pragma warning(pop)
 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
 
@@ -252,7 +258,7 @@ typedef void (__itt_api_fini_t)(__itt_gl
 ITT_EXTERN_C void _N_(error_handler)(__itt_error_code, va_list args);
 #endif /* ITT_NOTIFY_EXT_REPORT */
 
-#if ITT_PLATFORM==ITT_PLATFORM_WIN
+#if ITT_PLATFORM==ITT_PLATFORM_WIN && KMP_MSVC_COMPAT
 #pragma warning(push)
 #pragma warning(disable: 4055) /* warning C4055: 'type cast' : from data pointer 'void *' to function pointer 'XXX' */
 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
@@ -278,7 +284,7 @@ static void __itt_report_error(unsigned
     va_end(args);
 }
 
-#if ITT_PLATFORM==ITT_PLATFORM_WIN
+#if ITT_PLATFORM==ITT_PLATFORM_WIN && KMP_MSVC_COMPAT
 #pragma warning(pop)
 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
 
@@ -1013,7 +1019,7 @@ static void __itt_nullify_all_pointers(v
         *_N_(_ittapi_global).api_list_ptr[i].func_ptr = _N_(_ittapi_global).api_list_ptr[i].null_func;
 }
 
-#if ITT_PLATFORM==ITT_PLATFORM_WIN
+#if ITT_PLATFORM==ITT_PLATFORM_WIN && KMP_MSVC_COMPAT
 #pragma warning(push)
 #pragma warning(disable: 4054) /* warning C4054: 'type cast' : from function pointer 'XXX' to data pointer 'void *' */
 #pragma warning(disable: 4055) /* warning C4055: 'type cast' : from data pointer 'void *' to function pointer 'XXX' */
@@ -1191,7 +1197,6 @@ ITT_EXTERN_C __itt_error_handler_t* _N_(
     return prev;
 }
 
-#if ITT_PLATFORM==ITT_PLATFORM_WIN
+#if ITT_PLATFORM==ITT_PLATFORM_WIN && KMP_MSVC_COMPAT
 #pragma warning(pop)
 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
-

Modified: openmp/trunk/runtime/src/z_Windows_NT_util.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/z_Windows_NT_util.cpp?rev=348756&r1=348755&r2=348756&view=diff
==============================================================================
--- openmp/trunk/runtime/src/z_Windows_NT_util.cpp (original)
+++ openmp/trunk/runtime/src/z_Windows_NT_util.cpp Mon Dec 10 05:45:00 2018
@@ -887,6 +887,7 @@ kmp_uint64 __kmp_now_nsec() {
   return 1e9 * __kmp_win32_tick * now.QuadPart;
 }
 
+extern "C"
 void *__stdcall __kmp_launch_worker(void *arg) {
   volatile void *stack_data;
   void *exit_val;




More information about the Openmp-commits mailing list