[Openmp-commits] [openmp] r339393 - [OpenMP] Cleanup code

Jonathan Peyton via Openmp-commits openmp-commits at lists.llvm.org
Thu Aug 9 15:04:30 PDT 2018


Author: jlpeyton
Date: Thu Aug  9 15:04:30 2018
New Revision: 339393

URL: http://llvm.org/viewvc/llvm-project?rev=339393&view=rev
Log:
[OpenMP] Cleanup code

This patch cleans up unused functions, variables, sign compare issues, and
addresses some -Warning flags which are now enabled including -Wcast-qual.
Not all the warning flags in LibompHandleFlags.cmake are enabled, but some
are with this patch.

Some __kmp_gtid_from_* macros in kmp.h are switched to static inline functions
which allows us to remove the awkward definition of KMP_DEBUG_ASSERT() and
KMP_ASSERT() macros which used the comma operator. This had to be done for the
innumerable -Wunused-value warnings related to KMP_DEBUG_ASSERT()

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

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.cpp
    openmp/trunk/runtime/src/kmp_affinity.h
    openmp/trunk/runtime/src/kmp_alloc.cpp
    openmp/trunk/runtime/src/kmp_atomic.cpp
    openmp/trunk/runtime/src/kmp_barrier.cpp
    openmp/trunk/runtime/src/kmp_csupport.cpp
    openmp/trunk/runtime/src/kmp_debug.h
    openmp/trunk/runtime/src/kmp_dispatch.cpp
    openmp/trunk/runtime/src/kmp_dispatch.h
    openmp/trunk/runtime/src/kmp_gsupport.cpp
    openmp/trunk/runtime/src/kmp_lock.cpp
    openmp/trunk/runtime/src/kmp_lock.h
    openmp/trunk/runtime/src/kmp_runtime.cpp
    openmp/trunk/runtime/src/kmp_sched.cpp
    openmp/trunk/runtime/src/kmp_settings.cpp
    openmp/trunk/runtime/src/kmp_stub.cpp
    openmp/trunk/runtime/src/kmp_tasking.cpp
    openmp/trunk/runtime/src/kmp_wait_release.h
    openmp/trunk/runtime/src/ompt-general.cpp
    openmp/trunk/runtime/src/ompt-specific.h
    openmp/trunk/runtime/src/thirdparty/ittnotify/ittnotify_static.c

Modified: openmp/trunk/runtime/cmake/LibompHandleFlags.cmake
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/cmake/LibompHandleFlags.cmake?rev=339393&r1=339392&r2=339393&view=diff
==============================================================================
--- openmp/trunk/runtime/cmake/LibompHandleFlags.cmake (original)
+++ openmp/trunk/runtime/cmake/LibompHandleFlags.cmake Thu Aug  9 15:04:30 2018
@@ -28,22 +28,24 @@ function(libomp_get_c_and_cxxflags_commo
   set(flags_local)
   libomp_append(flags_local -fno-exceptions LIBOMP_HAVE_FNO_EXCEPTIONS_FLAG)
   libomp_append(flags_local -fno-rtti LIBOMP_HAVE_FNO_RTTI_FLAG)
-  libomp_append(flags_local -Wno-sign-compare LIBOMP_HAVE_WNO_SIGN_COMPARE_FLAG)
-  libomp_append(flags_local -Wno-unused-function LIBOMP_HAVE_WNO_UNUSED_FUNCTION_FLAG)
-  libomp_append(flags_local -Wno-unused-local-typedef LIBOMP_HAVE_WNO_UNUSED_LOCAL_TYPEDEF_FLAG)
-  libomp_append(flags_local -Wno-unused-value LIBOMP_HAVE_WNO_UNUSED_VALUE_FLAG)
-  libomp_append(flags_local -Wno-unused-variable LIBOMP_HAVE_WNO_UNUSED_VARIABLE_FLAG)
+  if(${OPENMP_STANDALONE_BUILD})
+    libomp_append(flags_local -Wsign-compare LIBOMP_HAVE_WNO_SIGN_COMPARE_FLAG)
+    libomp_append(flags_local -Wunused-function LIBOMP_HAVE_WNO_UNUSED_FUNCTION_FLAG)
+    libomp_append(flags_local -Wunused-local-typedef LIBOMP_HAVE_WNO_UNUSED_LOCAL_TYPEDEF_FLAG)
+    libomp_append(flags_local -Wunused-value LIBOMP_HAVE_WNO_UNUSED_VALUE_FLAG)
+    libomp_append(flags_local -Wunused-variable LIBOMP_HAVE_WNO_UNUSED_VARIABLE_FLAG)
+    libomp_append(flags_local -Wdeprecated-register LIBOMP_HAVE_WNO_DEPRECATED_REGISTER_FLAG)
+    libomp_append(flags_local -Wunknown-pragmas LIBOMP_HAVE_WNO_UNKNOWN_PRAGMAS_FLAG)
+    libomp_append(flags_local -Wcomment LIBOMP_HAVE_WNO_COMMENT_FLAG)
+    libomp_append(flags_local -Wself-assign LIBOMP_HAVE_WNO_SELF_ASSIGN_FLAG)
+    libomp_append(flags_local -Wformat-pedantic LIBOMP_HAVE_WNO_FORMAT_PEDANTIC_FLAG)
+  endif()
   libomp_append(flags_local -Wno-switch LIBOMP_HAVE_WNO_SWITCH_FLAG)
   libomp_append(flags_local -Wno-covered-switch-default LIBOMP_HAVE_WNO_COVERED_SWITCH_DEFAULT_FLAG)
-  libomp_append(flags_local -Wno-deprecated-register LIBOMP_HAVE_WNO_DEPRECATED_REGISTER_FLAG)
   libomp_append(flags_local -Wno-gnu-anonymous-struct LIBOMP_HAVE_WNO_GNU_ANONYMOUS_STRUCT_FLAG)
-  libomp_append(flags_local -Wno-unknown-pragmas LIBOMP_HAVE_WNO_UNKNOWN_PRAGMAS_FLAG)
   libomp_append(flags_local -Wno-missing-field-initializers LIBOMP_HAVE_WNO_MISSING_FIELD_INITIALIZERS_FLAG)
   libomp_append(flags_local -Wno-missing-braces LIBOMP_HAVE_WNO_MISSING_BRACES_FLAG)
-  libomp_append(flags_local -Wno-comment LIBOMP_HAVE_WNO_COMMENT_FLAG)
-  libomp_append(flags_local -Wno-self-assign LIBOMP_HAVE_WNO_SELF_ASSIGN_FLAG)
   libomp_append(flags_local -Wno-vla-extension LIBOMP_HAVE_WNO_VLA_EXTENSION_FLAG)
-  libomp_append(flags_local -Wno-format-pedantic LIBOMP_HAVE_WNO_FORMAT_PEDANTIC_FLAG)
   libomp_append(flags_local -Wstringop-overflow=0 LIBOMP_HAVE_WSTRINGOP_OVERFLOW_FLAG)
   libomp_append(flags_local /GS LIBOMP_HAVE_GS_FLAG)
   libomp_append(flags_local /EHsc LIBOMP_HAVE_EHSC_FLAG)
@@ -88,6 +90,9 @@ endfunction()
 function(libomp_get_cxxflags cxxflags)
   set(cxxflags_local)
   libomp_get_c_and_cxxflags_common(cxxflags_local)
+  if(${OPENMP_STANDALONE_BUILD})
+      libomp_append(cxxflags_local -Wcast-qual LIBOMP_HAVE_WCAST_QUAL_FLAG)
+  endif()
   set(cxxflags_local ${cxxflags_local} ${LIBOMP_CXXFLAGS})
   libomp_setup_flags(cxxflags_local)
   set(${cxxflags} ${cxxflags_local} PARENT_SCOPE)

Modified: openmp/trunk/runtime/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/cmake/config-ix.cmake?rev=339393&r1=339392&r2=339393&view=diff
==============================================================================
--- openmp/trunk/runtime/cmake/config-ix.cmake (original)
+++ openmp/trunk/runtime/cmake/config-ix.cmake Thu Aug  9 15:04:30 2018
@@ -50,6 +50,7 @@ endfunction()
 check_cxx_compiler_flag(-fno-exceptions LIBOMP_HAVE_FNO_EXCEPTIONS_FLAG)
 check_cxx_compiler_flag(-fno-rtti LIBOMP_HAVE_FNO_RTTI_FLAG)
 check_c_compiler_flag("-x c++" LIBOMP_HAVE_X_CPP_FLAG)
+check_cxx_compiler_flag(-Wcast-qual LIBOMP_HAVE_WCAST_QUAL_FLAG)
 check_c_compiler_flag(-Wunused-function LIBOMP_HAVE_WNO_UNUSED_FUNCTION_FLAG)
 check_c_compiler_flag(-Wunused-local-typedef LIBOMP_HAVE_WNO_UNUSED_LOCAL_TYPEDEF_FLAG)
 check_c_compiler_flag(-Wunused-value LIBOMP_HAVE_WNO_UNUSED_VALUE_FLAG)

Modified: openmp/trunk/runtime/src/kmp.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp.h?rev=339393&r1=339392&r2=339393&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp.h (original)
+++ openmp/trunk/runtime/src/kmp.h Thu Aug  9 15:04:30 2018
@@ -586,7 +586,7 @@ extern size_t __kmp_affin_mask_size;
 #define KMP_AFFINITY_DISABLE() (__kmp_affin_mask_size = 0)
 #define KMP_AFFINITY_ENABLE(mask_size) (__kmp_affin_mask_size = mask_size)
 #define KMP_CPU_SET_ITERATE(i, mask)                                           \
-  for (i = (mask)->begin(); i != (mask)->end(); i = (mask)->next(i))
+  for (i = (mask)->begin(); (int)i != (mask)->end(); i = (mask)->next(i))
 #define KMP_CPU_SET(i, mask) (mask)->set(i)
 #define KMP_CPU_ISSET(i, mask) (mask)->is_set(i)
 #define KMP_CPU_CLR(i, mask) (mask)->clear(i)
@@ -830,36 +830,6 @@ extern int __kmp_hws_abs_flag; // absolu
 #define KMP_GTID_UNKNOWN (-5) /* Is not known */
 #define KMP_GTID_MIN (-6) /* Minimal gtid for low bound check in DEBUG */
 
-#define __kmp_get_gtid() __kmp_get_global_thread_id()
-#define __kmp_entry_gtid() __kmp_get_global_thread_id_reg()
-
-#define __kmp_tid_from_gtid(gtid)                                              \
-  (KMP_DEBUG_ASSERT((gtid) >= 0), __kmp_threads[(gtid)]->th.th_info.ds.ds_tid)
-
-#define __kmp_get_tid() (__kmp_tid_from_gtid(__kmp_get_gtid()))
-#define __kmp_gtid_from_tid(tid, team)                                         \
-  (KMP_DEBUG_ASSERT((tid) >= 0 && (team) != NULL),                             \
-   team->t.t_threads[(tid)]->th.th_info.ds.ds_gtid)
-
-#define __kmp_get_team() (__kmp_threads[(__kmp_get_gtid())]->th.th_team)
-#define __kmp_team_from_gtid(gtid)                                             \
-  (KMP_DEBUG_ASSERT((gtid) >= 0), __kmp_threads[(gtid)]->th.th_team)
-
-#define __kmp_thread_from_gtid(gtid)                                           \
-  (KMP_DEBUG_ASSERT((gtid) >= 0), __kmp_threads[(gtid)])
-#define __kmp_get_thread() (__kmp_thread_from_gtid(__kmp_get_gtid()))
-
-// Returns current thread (pointer to kmp_info_t). In contrast to
-// __kmp_get_thread(), it works with registered and not-yet-registered threads.
-#define __kmp_gtid_from_thread(thr)                                            \
-  (KMP_DEBUG_ASSERT((thr) != NULL), (thr)->th.th_info.ds.ds_gtid)
-
-// AT: Which way is correct?
-// AT: 1. nproc = __kmp_threads[ ( gtid ) ] -> th.th_team -> t.t_nproc;
-// AT: 2. nproc = __kmp_threads[ ( gtid ) ] -> th.th_team_nproc;
-#define __kmp_get_team_num_threads(gtid)                                       \
-  (__kmp_threads[(gtid)]->th.th_team->t.t_nproc)
-
 /* ------------------------------------------------------------------------ */
 
 #define KMP_UINT64_MAX                                                         \
@@ -1013,11 +983,6 @@ extern kmp_uint64 __kmp_now_nsec();
 
 #define KMP_MASTER_GTID(gtid) (__kmp_tid_from_gtid((gtid)) == 0)
 #define KMP_WORKER_GTID(gtid) (__kmp_tid_from_gtid((gtid)) != 0)
-#define KMP_UBER_GTID(gtid)                                                    \
-  (KMP_DEBUG_ASSERT((gtid) >= KMP_GTID_MIN),                                   \
-   KMP_DEBUG_ASSERT((gtid) < __kmp_threads_capacity),                          \
-   (gtid) >= 0 && __kmp_root[(gtid)] && __kmp_threads[(gtid)] &&               \
-       (__kmp_threads[(gtid)] == __kmp_root[(gtid)]->r.r_uber_thread))
 #define KMP_INITIAL_GTID(gtid) ((gtid) == 0)
 
 #ifndef TRUE
@@ -1065,9 +1030,9 @@ extern void __kmp_x86_pause(void);
 // regression after removal of extra PAUSE from KMP_YIELD_SPIN(). Changing
 // the delay from 100 to 300 showed even better performance than double PAUSE
 // on Spec OMP2001 and LCPC tasking tests, no regressions on EPCC.
-static void __kmp_x86_pause(void) { _mm_delay_32(300); }
+static inline void __kmp_x86_pause(void) { _mm_delay_32(300); }
 #else
-static void __kmp_x86_pause(void) { _mm_pause(); }
+static inline void __kmp_x86_pause(void) { _mm_pause(); }
 #endif
 #define KMP_CPU_PAUSE() __kmp_x86_pause()
 #elif KMP_ARCH_PPC64
@@ -3050,6 +3015,52 @@ extern kmp_root_t **__kmp_root; /* root
 /* end data protected by fork/join lock */
 /* ------------------------------------------------------------------------- */
 
+#define __kmp_get_gtid() __kmp_get_global_thread_id()
+#define __kmp_entry_gtid() __kmp_get_global_thread_id_reg()
+#define __kmp_get_tid() (__kmp_tid_from_gtid(__kmp_get_gtid()))
+#define __kmp_get_team() (__kmp_threads[(__kmp_get_gtid())]->th.th_team)
+#define __kmp_get_thread() (__kmp_thread_from_gtid(__kmp_get_gtid()))
+
+// AT: Which way is correct?
+// AT: 1. nproc = __kmp_threads[ ( gtid ) ] -> th.th_team -> t.t_nproc;
+// AT: 2. nproc = __kmp_threads[ ( gtid ) ] -> th.th_team_nproc;
+#define __kmp_get_team_num_threads(gtid)                                       \
+  (__kmp_threads[(gtid)]->th.th_team->t.t_nproc)
+
+static inline bool KMP_UBER_GTID(int gtid) {
+  KMP_DEBUG_ASSERT(gtid >= KMP_GTID_MIN);
+  KMP_DEBUG_ASSERT(gtid < __kmp_threads_capacity);
+  return (gtid >= 0 && __kmp_root[gtid] && __kmp_threads[gtid] &&
+          __kmp_threads[gtid] == __kmp_root[gtid]->r.r_uber_thread);
+}
+
+static inline int __kmp_tid_from_gtid(int gtid) {
+  KMP_DEBUG_ASSERT(gtid >= 0);
+  return __kmp_threads[gtid]->th.th_info.ds.ds_tid;
+}
+
+static inline int __kmp_gtid_from_tid(int tid, const kmp_team_t *team) {
+  KMP_DEBUG_ASSERT(tid >= 0 && team);
+  return team->t.t_threads[tid]->th.th_info.ds.ds_gtid;
+}
+
+static inline int __kmp_gtid_from_thread(const kmp_info_t *thr) {
+  KMP_DEBUG_ASSERT(thr);
+  return thr->th.th_info.ds.ds_gtid;
+}
+
+static inline kmp_info_t *__kmp_thread_from_gtid(int gtid) {
+  KMP_DEBUG_ASSERT(gtid >= 0);
+  return __kmp_threads[gtid];
+}
+
+static inline kmp_team_t *__kmp_team_from_gtid(int gtid) {
+  KMP_DEBUG_ASSERT(gtid >= 0);
+  return __kmp_threads[gtid]->th.th_team;
+}
+
+/* ------------------------------------------------------------------------- */
+
 extern kmp_global_t __kmp_global; /* global status */
 
 extern kmp_info_t __kmp_monitor;

Modified: openmp/trunk/runtime/src/kmp_affinity.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_affinity.cpp?rev=339393&r1=339392&r2=339393&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_affinity.cpp (original)
+++ openmp/trunk/runtime/src/kmp_affinity.cpp Thu Aug  9 15:04:30 2018
@@ -91,7 +91,7 @@ char *__kmp_affinity_print_mask(char *bu
   char *end = buf + buf_len - 1;
 
   // Find first element / check for empty set.
-  size_t i;
+  int i;
   i = mask->begin();
   if (i == mask->end()) {
     KMP_SNPRINTF(scan, end - scan + 1, "{<empty>}");
@@ -101,7 +101,7 @@ char *__kmp_affinity_print_mask(char *bu
     return buf;
   }
 
-  KMP_SNPRINTF(scan, end - scan + 1, "{%ld", (long)i);
+  KMP_SNPRINTF(scan, end - scan + 1, "{%d", i);
   while (*scan != '\0')
     scan++;
   i++;
@@ -117,7 +117,7 @@ char *__kmp_affinity_print_mask(char *bu
     if (end - scan < 15) {
       break;
     }
-    KMP_SNPRINTF(scan, end - scan + 1, ",%-ld", (long)i);
+    KMP_SNPRINTF(scan, end - scan + 1, ",%-d", i);
     while (*scan != '\0')
       scan++;
   }
@@ -840,7 +840,7 @@ static int __kmp_affinity_create_flat_ma
   *address2os =
       (AddrUnsPair *)__kmp_allocate(sizeof(**address2os) * __kmp_avail_proc);
   int avail_ct = 0;
-  unsigned int i;
+  int i;
   KMP_CPU_SET_ITERATE(i, __kmp_affin_fullMask) {
     // Skip this proc if it is not included in the machine model.
     if (!KMP_CPU_ISSET(i, __kmp_affin_fullMask)) {
@@ -958,17 +958,6 @@ public:
   unsigned threadId; //      ""
 };
 
-static int __kmp_affinity_cmp_apicThreadInfo_os_id(const void *a,
-                                                   const void *b) {
-  const apicThreadInfo *aa = (const apicThreadInfo *)a;
-  const apicThreadInfo *bb = (const apicThreadInfo *)b;
-  if (aa->osId < bb->osId)
-    return -1;
-  if (aa->osId > bb->osId)
-    return 1;
-  return 0;
-}
-
 static int __kmp_affinity_cmp_apicThreadInfo_phys_id(const void *a,
                                                      const void *b) {
   const apicThreadInfo *aa = (const apicThreadInfo *)a;
@@ -995,7 +984,6 @@ static int __kmp_affinity_cmp_apicThread
 static int __kmp_affinity_create_apicid_map(AddrUnsPair **address2os,
                                             kmp_i18n_id_t *const msg_id) {
   kmp_cpuid buf;
-  int rc;
   *address2os = NULL;
   *msg_id = kmp_i18n_null;
 
@@ -1347,7 +1335,7 @@ static int __kmp_affinity_create_apicid_
                __kmp_nThreadsPerCore, __kmp_ncores);
   }
   KMP_DEBUG_ASSERT(__kmp_pu_os_idx == NULL);
-  KMP_DEBUG_ASSERT(nApics == __kmp_avail_proc);
+  KMP_DEBUG_ASSERT(nApics == (unsigned)__kmp_avail_proc);
   __kmp_pu_os_idx = (int *)__kmp_allocate(sizeof(int) * __kmp_avail_proc);
   for (i = 0; i < nApics; ++i) {
     __kmp_pu_os_idx[i] = threadInfo[i].osId;
@@ -1802,7 +1790,6 @@ static int __kmp_affinity_create_x2apici
     int newPkgLevel = -1;
     int newCoreLevel = -1;
     int newThreadLevel = -1;
-    int i;
     for (level = 0; level < depth; level++) {
       if ((maxCt[level] == 1) && (level != pkgLevel)) {
         // Remove this level. Never remove the package level
@@ -1872,16 +1859,6 @@ static int __kmp_affinity_create_x2apici
 typedef unsigned *ProcCpuInfo;
 static unsigned maxIndex = pkgIdIndex;
 
-static int __kmp_affinity_cmp_ProcCpuInfo_os_id(const void *a, const void *b) {
-  const unsigned *aa = (const unsigned *)a;
-  const unsigned *bb = (const unsigned *)b;
-  if (aa[osIdIndex] < bb[osIdIndex])
-    return -1;
-  if (aa[osIdIndex] > bb[osIdIndex])
-    return 1;
-  return 0;
-}
-
 static int __kmp_affinity_cmp_ProcCpuInfo_phys_id(const void *a,
                                                   const void *b) {
   unsigned i;
@@ -2512,7 +2489,7 @@ restart_radix_check:
 #endif // KMP_MIC && REDUCE_TEAM_SIZE
 
   KMP_DEBUG_ASSERT(__kmp_pu_os_idx == NULL);
-  KMP_DEBUG_ASSERT(num_avail == __kmp_avail_proc);
+  KMP_DEBUG_ASSERT(num_avail == (unsigned)__kmp_avail_proc);
   __kmp_pu_os_idx = (int *)__kmp_allocate(sizeof(int) * __kmp_avail_proc);
   for (i = 0; i < num_avail; ++i) { // fill the os indices
     __kmp_pu_os_idx[i] = threadInfo[i][osIdIndex];
@@ -2533,7 +2510,6 @@ restart_radix_check:
   // which has a sibling. These levels are in the map, and the package level is
   // always in the map.
   bool *inMap = (bool *)__kmp_allocate((maxIndex + 1) * sizeof(bool));
-  int level = 0;
   for (index = threadIdIndex; index < maxIndex; index++) {
     KMP_ASSERT(totals[index] >= totals[index + 1]);
     inMap[index] = (totals[index] > totals[index + 1]);
@@ -4772,8 +4748,6 @@ void __kmp_affinity_set_init_mask(int gt
 #if OMP_40_ENABLED
 
 void __kmp_affinity_set_place(int gtid) {
-  int retval;
-
   if (!KMP_AFFINITY_CAPABLE()) {
     return;
   }
@@ -4942,8 +4916,6 @@ int __kmp_aux_get_affinity_max_proc() {
 }
 
 int __kmp_aux_set_affinity_mask_proc(int proc, void **mask) {
-  int retval;
-
   if (!KMP_AFFINITY_CAPABLE()) {
     return -1;
   }
@@ -4976,8 +4948,6 @@ int __kmp_aux_set_affinity_mask_proc(int
 }
 
 int __kmp_aux_unset_affinity_mask_proc(int proc, void **mask) {
-  int retval;
-
   if (!KMP_AFFINITY_CAPABLE()) {
     return -1;
   }
@@ -5010,8 +4980,6 @@ int __kmp_aux_unset_affinity_mask_proc(i
 }
 
 int __kmp_aux_get_affinity_mask_proc(int proc, void **mask) {
-  int retval;
-
   if (!KMP_AFFINITY_CAPABLE()) {
     return -1;
   }

Modified: openmp/trunk/runtime/src/kmp_affinity.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_affinity.h?rev=339393&r1=339392&r2=339393&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_affinity.h (original)
+++ openmp/trunk/runtime/src/kmp_affinity.h Thu Aug  9 15:04:30 2018
@@ -81,13 +81,12 @@ public:
       return error;
     }
     int get_proc_group() const override {
-      int i;
       int group = -1;
 #if KMP_OS_WINDOWS
       if (__kmp_num_proc_groups == 1) {
         return 1;
       }
-      for (i = 0; i < __kmp_num_proc_groups; i++) {
+      for (int i = 0; i < __kmp_num_proc_groups; i++) {
         // On windows, the long type is always 32 bits
         unsigned long first_32_bits = hwloc_bitmap_to_ith_ulong(mask, i * 2);
         unsigned long second_32_bits =
@@ -333,7 +332,7 @@ class KMPNativeAffinity : public KMPAffi
   void deallocate_mask(KMPAffinity::Mask *m) override {
     KMPNativeAffinity::Mask *native_mask =
         static_cast<KMPNativeAffinity::Mask *>(m);
-    delete m;
+    delete native_mask;
   }
   KMPAffinity::Mask *allocate_mask_array(int num) override {
     return new Mask[num];

Modified: openmp/trunk/runtime/src/kmp_alloc.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_alloc.cpp?rev=339393&r1=339392&r2=339393&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_alloc.cpp (original)
+++ openmp/trunk/runtime/src/kmp_alloc.cpp Thu Aug  9 15:04:30 2018
@@ -53,16 +53,6 @@ static void bectl(kmp_info_t *th, bget_c
                   bget_acquire_t acquire, bget_release_t release,
                   bufsize pool_incr);
 
-#ifdef KMP_DEBUG
-static void bstats(kmp_info_t *th, bufsize *curalloc, bufsize *totfree,
-                   bufsize *maxfree, long *nget, long *nrel);
-static void bstatse(kmp_info_t *th, bufsize *pool_incr, long *npool,
-                    long *npget, long *nprel, long *ndget, long *ndrel);
-static void bufdump(kmp_info_t *th, void *buf);
-static void bpoold(kmp_info_t *th, void *pool, int dumpalloc, int dumpfree);
-static int bpoolv(kmp_info_t *th, void *pool);
-#endif
-
 /* BGET CONFIGURATION */
 /* Buffer allocation size quantum: all buffers allocated are a
    multiple of this size.  This MUST be a power of two. */
@@ -271,23 +261,6 @@ static thr_data_t *get_thr_data(kmp_info
   return data;
 }
 
-#ifdef KMP_DEBUG
-
-static void __kmp_bget_validate_queue(kmp_info_t *th) {
-  /* NOTE: assume that the global_lock is held */
-
-  void *p = (void *)th->th.th_local.bget_list;
-
-  while (p != 0) {
-    bfhead_t *b = BFH(((char *)p) - sizeof(bhead_t));
-
-    KMP_DEBUG_ASSERT(b->bh.bb.bsize != 0);
-    p = (void *)b->ql.flink;
-  }
-}
-
-#endif
-
 /* Walk the free list and release the enqueued buffers */
 static void __kmp_bget_dequeue(kmp_info_t *th) {
   void *p = TCR_SYNC_PTR(th->th.th_local.bget_list);
@@ -1017,197 +990,6 @@ static void bfreed(kmp_info_t *th) {
     __kmp_printf_no_lock("__kmp_printpool: T#%d No free blocks\n", gtid);
 }
 
-#ifdef KMP_DEBUG
-
-#if BufStats
-
-/*  BSTATS  --  Return buffer allocation free space statistics.  */
-static void bstats(kmp_info_t *th, bufsize *curalloc, bufsize *totfree,
-                   bufsize *maxfree, long *nget, long *nrel) {
-  int bin = 0;
-  thr_data_t *thr = get_thr_data(th);
-
-  *nget = thr->numget;
-  *nrel = thr->numrel;
-  *curalloc = (bufsize)thr->totalloc;
-  *totfree = 0;
-  *maxfree = -1;
-
-  for (bin = 0; bin < MAX_BGET_BINS; ++bin) {
-    bfhead_t *b = thr->freelist[bin].ql.flink;
-
-    while (b != &thr->freelist[bin]) {
-      KMP_DEBUG_ASSERT(b->bh.bb.bsize > 0);
-      *totfree += b->bh.bb.bsize;
-      if (b->bh.bb.bsize > *maxfree) {
-        *maxfree = b->bh.bb.bsize;
-      }
-      b = b->ql.flink; /* Link to next buffer */
-    }
-  }
-}
-
-/*  BSTATSE  --  Return extended statistics  */
-static void bstatse(kmp_info_t *th, bufsize *pool_incr, long *npool,
-                    long *npget, long *nprel, long *ndget, long *ndrel) {
-  thr_data_t *thr = get_thr_data(th);
-
-  *pool_incr = (thr->pool_len < 0) ? -thr->exp_incr : thr->exp_incr;
-  *npool = thr->numpblk;
-  *npget = thr->numpget;
-  *nprel = thr->numprel;
-  *ndget = thr->numdget;
-  *ndrel = thr->numdrel;
-}
-
-#endif /* BufStats */
-
-/*  BUFDUMP  --  Dump the data in a buffer.  This is called with the  user
-                 data pointer, and backs up to the buffer header.  It will
-                 dump either a free block or an allocated one.  */
-static void bufdump(kmp_info_t *th, void *buf) {
-  bfhead_t *b;
-  unsigned char *bdump;
-  bufsize bdlen;
-
-  b = BFH(((char *)buf) - sizeof(bhead_t));
-  KMP_DEBUG_ASSERT(b->bh.bb.bsize != 0);
-  if (b->bh.bb.bsize < 0) {
-    bdump = (unsigned char *)buf;
-    bdlen = (-b->bh.bb.bsize) - (bufsize)sizeof(bhead_t);
-  } else {
-    bdump = (unsigned char *)(((char *)b) + sizeof(bfhead_t));
-    bdlen = b->bh.bb.bsize - (bufsize)sizeof(bfhead_t);
-  }
-
-  while (bdlen > 0) {
-    int i, dupes = 0;
-    bufsize l = bdlen;
-    char bhex[50], bascii[20];
-
-    if (l > 16) {
-      l = 16;
-    }
-
-    for (i = 0; i < l; i++) {
-      (void)KMP_SNPRINTF(bhex + i * 3, sizeof(bhex) - i * 3, "%02X ", bdump[i]);
-      if (bdump[i] > 0x20 && bdump[i] < 0x7F)
-        bascii[i] = bdump[i];
-      else
-        bascii[i] = ' ';
-    }
-    bascii[i] = 0;
-    (void)__kmp_printf_no_lock("%-48s   %s\n", bhex, bascii);
-    bdump += l;
-    bdlen -= l;
-    while ((bdlen > 16) &&
-           (memcmp((char *)(bdump - 16), (char *)bdump, 16) == 0)) {
-      dupes++;
-      bdump += 16;
-      bdlen -= 16;
-    }
-    if (dupes > 1) {
-      (void)__kmp_printf_no_lock(
-          "     (%d lines [%d bytes] identical to above line skipped)\n", dupes,
-          dupes * 16);
-    } else if (dupes == 1) {
-      bdump -= 16;
-      bdlen += 16;
-    }
-  }
-}
-
-/*  BPOOLD  --  Dump a buffer pool.  The buffer headers are always listed.
-                If DUMPALLOC is nonzero, the contents of allocated buffers
-                are  dumped.   If  DUMPFREE  is  nonzero,  free blocks are
-                dumped as well.  If FreeWipe  checking  is  enabled,  free
-                blocks  which  have  been clobbered will always be dumped. */
-static void bpoold(kmp_info_t *th, void *buf, int dumpalloc, int dumpfree) {
-  bfhead_t *b = BFH((char *)buf - sizeof(bhead_t));
-
-  while (b->bh.bb.bsize != ESent) {
-    bufsize bs = b->bh.bb.bsize;
-
-    if (bs < 0) {
-      bs = -bs;
-      (void)__kmp_printf_no_lock("Allocated buffer: size %6ld bytes.\n",
-                                 (long)bs);
-      if (dumpalloc) {
-        bufdump(th, (void *)(((char *)b) + sizeof(bhead_t)));
-      }
-    } else {
-      const char *lerr = "";
-
-      KMP_DEBUG_ASSERT(bs > 0);
-      if ((b->ql.blink->ql.flink != b) || (b->ql.flink->ql.blink != b)) {
-        lerr = "  (Bad free list links)";
-      }
-      (void)__kmp_printf_no_lock("Free block:       size %6ld bytes.%s\n",
-                                 (long)bs, lerr);
-#ifdef FreeWipe
-      lerr = ((char *)b) + sizeof(bfhead_t);
-      if ((bs > sizeof(bfhead_t)) &&
-          ((*lerr != 0x55) ||
-           (memcmp(lerr, lerr + 1, (size_t)(bs - (sizeof(bfhead_t) + 1))) !=
-            0))) {
-        (void)__kmp_printf_no_lock(
-            "(Contents of above free block have been overstored.)\n");
-        bufdump(th, (void *)(((char *)b) + sizeof(bhead_t)));
-      } else
-#endif
-          if (dumpfree) {
-        bufdump(th, (void *)(((char *)b) + sizeof(bhead_t)));
-      }
-    }
-    b = BFH(((char *)b) + bs);
-  }
-}
-
-/*  BPOOLV  --  Validate a buffer pool. */
-static int bpoolv(kmp_info_t *th, void *buf) {
-  bfhead_t *b = BFH(buf);
-
-  while (b->bh.bb.bsize != ESent) {
-    bufsize bs = b->bh.bb.bsize;
-
-    if (bs < 0) {
-      bs = -bs;
-    } else {
-#ifdef FreeWipe
-      char *lerr = "";
-#endif
-
-      KMP_DEBUG_ASSERT(bs > 0);
-      if (bs <= 0) {
-        return 0;
-      }
-      if ((b->ql.blink->ql.flink != b) || (b->ql.flink->ql.blink != b)) {
-        (void)__kmp_printf_no_lock(
-            "Free block: size %6ld bytes.  (Bad free list links)\n", (long)bs);
-        KMP_DEBUG_ASSERT(0);
-        return 0;
-      }
-#ifdef FreeWipe
-      lerr = ((char *)b) + sizeof(bfhead_t);
-      if ((bs > sizeof(bfhead_t)) &&
-          ((*lerr != 0x55) ||
-           (memcmp(lerr, lerr + 1, (size_t)(bs - (sizeof(bfhead_t) + 1))) !=
-            0))) {
-        (void)__kmp_printf_no_lock(
-            "(Contents of above free block have been overstored.)\n");
-        bufdump(th, (void *)(((char *)b) + sizeof(bhead_t)));
-        KMP_DEBUG_ASSERT(0);
-        return 0;
-      }
-#endif /* FreeWipe */
-    }
-    b = BFH(((char *)b) + bs);
-  }
-  return 1;
-}
-
-#endif /* KMP_DEBUG */
-
 void __kmp_initialize_bget(kmp_info_t *th) {
   KMP_DEBUG_ASSERT(SizeQuant >= sizeof(void *) && (th != 0));
 

Modified: openmp/trunk/runtime/src/kmp_atomic.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_atomic.cpp?rev=339393&r1=339392&r2=339393&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_atomic.cpp (original)
+++ openmp/trunk/runtime/src/kmp_atomic.cpp Thu Aug  9 15:04:30 2018
@@ -2906,7 +2906,6 @@ ATOMIC_CRITICAL_CPT(cmplx16, div_a16_cpt
 #define ATOMIC_CMPXCHG_CPT_REV(TYPE_ID, OP_ID, TYPE, BITS, OP, GOMP_FLAG)      \
   ATOMIC_BEGIN_CPT(TYPE_ID, OP_ID, TYPE, TYPE)                                 \
   TYPE new_value;                                                              \
-  TYPE KMP_ATOMIC_VOLATILE temp_val;                                           \
   OP_GOMP_CRITICAL_CPT_REV(OP, GOMP_FLAG)                                      \
   OP_CMPXCHG_CPT_REV(TYPE, BITS, OP)                                           \
   }
@@ -2978,7 +2977,6 @@ ATOMIC_CMPXCHG_CPT_REV(float8, sub_cpt_r
 #define ATOMIC_CRITICAL_CPT_REV(TYPE_ID, OP_ID, TYPE, OP, LCK_ID, GOMP_FLAG)   \
   ATOMIC_BEGIN_CPT(TYPE_ID, OP_ID, TYPE, TYPE)                                 \
   TYPE new_value;                                                              \
-  TYPE KMP_ATOMIC_VOLATILE temp_val;                                           \
   /*printf("__kmp_atomic_mode = %d\n", __kmp_atomic_mode);*/                   \
   OP_GOMP_CRITICAL_CPT_REV(OP, GOMP_FLAG)                                      \
   OP_CRITICAL_CPT_REV(OP, LCK_ID)                                              \

Modified: openmp/trunk/runtime/src/kmp_barrier.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_barrier.cpp?rev=339393&r1=339392&r2=339393&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_barrier.cpp (original)
+++ openmp/trunk/runtime/src/kmp_barrier.cpp Thu Aug  9 15:04:30 2018
@@ -1223,7 +1223,6 @@ int __kmp_barrier(enum barrier_type bt,
   kmp_info_t *this_thr = __kmp_threads[gtid];
   kmp_team_t *team = this_thr->th.th_team;
   int status = 0;
-  ident_t *loc = __kmp_threads[gtid]->th.th_ident;
 #if OMPT_SUPPORT
   ompt_data_t *my_task_data;
   ompt_data_t *my_parallel_data;
@@ -1373,6 +1372,7 @@ int __kmp_barrier(enum barrier_type bt,
           this_thr->th.th_teams_microtask == NULL &&
 #endif
           team->t.t_active_level == 1) {
+        ident_t *loc = __kmp_threads[gtid]->th.th_ident;
         kmp_uint64 cur_time = __itt_get_timestamp();
         kmp_info_t **other_threads = team->t.t_threads;
         int nproc = this_thr->th.th_team_nproc;

Modified: openmp/trunk/runtime/src/kmp_csupport.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_csupport.cpp?rev=339393&r1=339392&r2=339393&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_csupport.cpp (original)
+++ openmp/trunk/runtime/src/kmp_csupport.cpp Thu Aug  9 15:04:30 2018
@@ -1262,6 +1262,7 @@ static __forceinline kmp_dyna_lockseq_t
 }
 
 #if OMPT_SUPPORT && OMPT_OPTIONAL
+#if KMP_USE_DYNAMIC_LOCK
 static kmp_mutex_impl_t
 __ompt_get_mutex_impl_type(void *user_lock, kmp_indirect_lock_t *ilock = 0) {
   if (user_lock) {
@@ -1306,7 +1307,7 @@ __ompt_get_mutex_impl_type(void *user_lo
     return ompt_mutex_impl_unknown;
   }
 }
-
+#else
 // For locks without dynamic binding
 static kmp_mutex_impl_t __ompt_get_mutex_impl_type() {
   switch (__kmp_user_lock_kind) {
@@ -1329,7 +1330,8 @@ static kmp_mutex_impl_t __ompt_get_mutex
     return ompt_mutex_impl_unknown;
   }
 }
-#endif
+#endif // KMP_USE_DYNAMIC_LOCK
+#endif // OMPT_SUPPORT && OMPT_OPTIONAL
 
 /*!
 @ingroup WORK_SHARING

Modified: openmp/trunk/runtime/src/kmp_debug.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_debug.h?rev=339393&r1=339392&r2=339393&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_debug.h (original)
+++ openmp/trunk/runtime/src/kmp_debug.h Thu Aug  9 15:04:30 2018
@@ -35,24 +35,33 @@ extern void __kmp_dump_debug_buffer(void
 extern int __kmp_debug_assert(char const *expr, char const *file, int line);
 #ifdef KMP_DEBUG
 #define KMP_ASSERT(cond)                                                       \
-  ((cond) ? 0 : __kmp_debug_assert(#cond, __FILE__, __LINE__))
+  if (!(cond)) {                                                               \
+    __kmp_debug_assert(#cond, __FILE__, __LINE__);                             \
+  }
 #define KMP_ASSERT2(cond, msg)                                                 \
-  ((cond) ? 0 : __kmp_debug_assert((msg), __FILE__, __LINE__))
+  if (!(cond)) {                                                               \
+    __kmp_debug_assert((msg), __FILE__, __LINE__);                             \
+  }
 #define KMP_DEBUG_ASSERT(cond) KMP_ASSERT(cond)
 #define KMP_DEBUG_ASSERT2(cond, msg) KMP_ASSERT2(cond, msg)
+#define KMP_DEBUG_USE_VAR(x) /* Nothing (it is used!) */
 #else
 // Do not expose condition in release build. Use "assertion failure".
 #define KMP_ASSERT(cond)                                                       \
-  ((cond) ? 0 : __kmp_debug_assert("assertion failure", __FILE__, __LINE__))
+  if (!(cond)) {                                                               \
+    __kmp_debug_assert("assertion failure", __FILE__, __LINE__);               \
+  }
 #define KMP_ASSERT2(cond, msg) KMP_ASSERT(cond)
-#define KMP_DEBUG_ASSERT(cond) 0
-#define KMP_DEBUG_ASSERT2(cond, msg) 0
+#define KMP_DEBUG_ASSERT(cond) /* Nothing */
+#define KMP_DEBUG_ASSERT2(cond, msg) /* Nothing */
+#define KMP_DEBUG_USE_VAR(x) ((void)(x))
 #endif // KMP_DEBUG
 #else
-#define KMP_ASSERT(cond) 0
-#define KMP_ASSERT2(cond, msg) 0
-#define KMP_DEBUG_ASSERT(cond) 0
-#define KMP_DEBUG_ASSERT2(cond, msg) 0
+#define KMP_ASSERT(cond) /* Nothing */
+#define KMP_ASSERT2(cond, msg) /* Nothing */
+#define KMP_DEBUG_ASSERT(cond) /* Nothing */
+#define KMP_DEBUG_ASSERT2(cond, msg) /* Nothing */
+#define KMP_DEBUG_USE_VAR(x) ((void)(x))
 #endif // KMP_USE_ASSERT
 
 #ifdef KMP_DEBUG

Modified: openmp/trunk/runtime/src/kmp_dispatch.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_dispatch.cpp?rev=339393&r1=339392&r2=339393&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_dispatch.cpp (original)
+++ openmp/trunk/runtime/src/kmp_dispatch.cpp Thu Aug  9 15:04:30 2018
@@ -97,7 +97,6 @@ void __kmp_dispatch_init_algorithm(ident
                                    typename traits_t<T>::signed_t chunk,
                                    T nproc, T tid) {
   typedef typename traits_t<T>::unsigned_t UT;
-  typedef typename traits_t<T>::signed_t ST;
   typedef typename traits_t<T>::floating_t DBL;
 
   int active;
@@ -106,6 +105,7 @@ void __kmp_dispatch_init_algorithm(ident
   kmp_team_t *team;
 
 #ifdef KMP_DEBUG
+  typedef typename traits_t<T>::signed_t ST;
   {
     char *buff;
     // create format specifiers before the debug output
@@ -731,8 +731,6 @@ __kmp_dispatch_init(ident_t *loc, int gt
                     T ub, typename traits_t<T>::signed_t st,
                     typename traits_t<T>::signed_t chunk, int push_ws) {
   typedef typename traits_t<T>::unsigned_t UT;
-  typedef typename traits_t<T>::signed_t ST;
-  typedef typename traits_t<T>::floating_t DBL;
 
   int active;
   kmp_info_t *th;
@@ -753,6 +751,7 @@ __kmp_dispatch_init(ident_t *loc, int gt
   SSC_MARK_DISPATCH_INIT();
 #endif
 #ifdef KMP_DEBUG
+  typedef typename traits_t<T>::signed_t ST;
   {
     char *buff;
     // create format specifiers before the debug output
@@ -1867,7 +1866,6 @@ static int __kmp_dispatch_next(ident_t *
 
   typedef typename traits_t<T>::unsigned_t UT;
   typedef typename traits_t<T>::signed_t ST;
-  typedef typename traits_t<T>::floating_t DBL;
   // This is potentially slightly misleading, schedule(runtime) will appear here
   // even if the actual runtme schedule is static. (Which points out a
   // disadavantage of schedule(runtime): even when static scheduling is used it
@@ -2123,7 +2121,6 @@ static void __kmp_dist_get_bounds(ident_
                                   kmp_int32 *plastiter, T *plower, T *pupper,
                                   typename traits_t<T>::signed_t incr) {
   typedef typename traits_t<T>::unsigned_t UT;
-  typedef typename traits_t<T>::signed_t ST;
   kmp_uint32 team_id;
   kmp_uint32 nteams;
   UT trip_count;
@@ -2133,6 +2130,7 @@ static void __kmp_dist_get_bounds(ident_
   KMP_DEBUG_ASSERT(plastiter && plower && pupper);
   KE_TRACE(10, ("__kmpc_dist_get_bounds called (%d)\n", gtid));
 #ifdef KMP_DEBUG
+  typedef typename traits_t<T>::signed_t ST;
   {
     char *buff;
     // create format specifiers before the debug output
@@ -2170,7 +2168,7 @@ static void __kmp_dist_get_bounds(ident_
   nteams = th->th.th_teams_size.nteams;
 #endif
   team_id = team->t.t_master_tid;
-  KMP_DEBUG_ASSERT(nteams == team->t.t_parent->t.t_nproc);
+  KMP_DEBUG_ASSERT(nteams == (kmp_uint32)team->t.t_parent->t.t_nproc);
 
   // compute global trip count
   if (incr == 1) {

Modified: openmp/trunk/runtime/src/kmp_dispatch.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_dispatch.h?rev=339393&r1=339392&r2=339393&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_dispatch.h (original)
+++ openmp/trunk/runtime/src/kmp_dispatch.h Thu Aug  9 15:04:30 2018
@@ -332,7 +332,6 @@ static UT __kmp_wait_yield(volatile UT *
 
 template <typename UT>
 void __kmp_dispatch_deo(int *gtid_ref, int *cid_ref, ident_t *loc_ref) {
-  typedef typename traits_t<UT>::signed_t ST;
   dispatch_private_info_template<UT> *pr;
 
   int gtid = *gtid_ref;

Modified: openmp/trunk/runtime/src/kmp_gsupport.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_gsupport.cpp?rev=339393&r1=339392&r2=339393&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_gsupport.cpp (original)
+++ openmp/trunk/runtime/src/kmp_gsupport.cpp Thu Aug  9 15:04:30 2018
@@ -456,7 +456,6 @@ void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_P
 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_END)(void) {
   int gtid = __kmp_get_gtid();
   kmp_info_t *thr;
-  int ompt_team_size = __kmp_team_from_gtid(gtid)->t.t_nproc;
 
   thr = __kmp_threads[gtid];
 
@@ -1193,7 +1192,6 @@ void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_T
     ompt_thread_info_t oldInfo;
     kmp_info_t *thread;
     kmp_taskdata_t *taskdata;
-    kmp_taskdata_t *current_task;
     if (ompt_enabled.enabled) {
       // Store the threads states and restore them after the task
       thread = __kmp_threads[gtid];

Modified: openmp/trunk/runtime/src/kmp_lock.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_lock.cpp?rev=339393&r1=339392&r2=339393&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_lock.cpp (original)
+++ openmp/trunk/runtime/src/kmp_lock.cpp Thu Aug  9 15:04:30 2018
@@ -197,10 +197,6 @@ void __kmp_init_tas_lock(kmp_tas_lock_t
   lck->lk.poll = KMP_LOCK_FREE(tas);
 }
 
-static void __kmp_init_tas_lock_with_checks(kmp_tas_lock_t *lck) {
-  __kmp_init_tas_lock(lck);
-}
-
 void __kmp_destroy_tas_lock(kmp_tas_lock_t *lck) { lck->lk.poll = 0; }
 
 static void __kmp_destroy_tas_lock_with_checks(kmp_tas_lock_t *lck) {
@@ -297,10 +293,6 @@ void __kmp_init_nested_tas_lock(kmp_tas_
   lck->lk.depth_locked = 0; // >= 0 for nestable locks, -1 for simple locks
 }
 
-static void __kmp_init_nested_tas_lock_with_checks(kmp_tas_lock_t *lck) {
-  __kmp_init_nested_tas_lock(lck);
-}
-
 void __kmp_destroy_nested_tas_lock(kmp_tas_lock_t *lck) {
   __kmp_destroy_tas_lock(lck);
   lck->lk.depth_locked = 0;
@@ -510,10 +502,6 @@ void __kmp_init_futex_lock(kmp_futex_loc
   TCW_4(lck->lk.poll, KMP_LOCK_FREE(futex));
 }
 
-static void __kmp_init_futex_lock_with_checks(kmp_futex_lock_t *lck) {
-  __kmp_init_futex_lock(lck);
-}
-
 void __kmp_destroy_futex_lock(kmp_futex_lock_t *lck) { lck->lk.poll = 0; }
 
 static void __kmp_destroy_futex_lock_with_checks(kmp_futex_lock_t *lck) {
@@ -610,10 +598,6 @@ void __kmp_init_nested_futex_lock(kmp_fu
   lck->lk.depth_locked = 0; // >= 0 for nestable locks, -1 for simple locks
 }
 
-static void __kmp_init_nested_futex_lock_with_checks(kmp_futex_lock_t *lck) {
-  __kmp_init_nested_futex_lock(lck);
-}
-
 void __kmp_destroy_nested_futex_lock(kmp_futex_lock_t *lck) {
   __kmp_destroy_futex_lock(lck);
   lck->lk.depth_locked = 0;
@@ -800,10 +784,6 @@ void __kmp_init_ticket_lock(kmp_ticket_l
                              std::memory_order_release);
 }
 
-static void __kmp_init_ticket_lock_with_checks(kmp_ticket_lock_t *lck) {
-  __kmp_init_ticket_lock(lck);
-}
-
 void __kmp_destroy_ticket_lock(kmp_ticket_lock_t *lck) {
   std::atomic_store_explicit(&lck->lk.initialized, false,
                              std::memory_order_release);
@@ -955,10 +935,6 @@ void __kmp_init_nested_ticket_lock(kmp_t
   // >= 0 for nestable locks, -1 for simple locks
 }
 
-static void __kmp_init_nested_ticket_lock_with_checks(kmp_ticket_lock_t *lck) {
-  __kmp_init_nested_ticket_lock(lck);
-}
-
 void __kmp_destroy_nested_ticket_lock(kmp_ticket_lock_t *lck) {
   __kmp_destroy_ticket_lock(lck);
   std::atomic_store_explicit(&lck->lk.depth_locked, 0,
@@ -987,12 +963,6 @@ __kmp_destroy_nested_ticket_lock_with_ch
 
 // access functions to fields which don't exist for all lock kinds.
 
-static int __kmp_is_ticket_lock_initialized(kmp_ticket_lock_t *lck) {
-  return std::atomic_load_explicit(&lck->lk.initialized,
-                                   std::memory_order_relaxed) &&
-         (lck->lk.self == lck);
-}
-
 static const ident_t *__kmp_get_ticket_lock_location(kmp_ticket_lock_t *lck) {
   return lck->lk.location;
 }
@@ -1577,10 +1547,6 @@ void __kmp_init_queuing_lock(kmp_queuing
   KA_TRACE(1000, ("__kmp_init_queuing_lock: lock %p initialized\n", lck));
 }
 
-static void __kmp_init_queuing_lock_with_checks(kmp_queuing_lock_t *lck) {
-  __kmp_init_queuing_lock(lck);
-}
-
 void __kmp_destroy_queuing_lock(kmp_queuing_lock_t *lck) {
   lck->lk.initialized = NULL;
   lck->lk.location = NULL;
@@ -1706,11 +1672,6 @@ void __kmp_init_nested_queuing_lock(kmp_
   lck->lk.depth_locked = 0; // >= 0 for nestable locks, -1 for simple locks
 }
 
-static void
-__kmp_init_nested_queuing_lock_with_checks(kmp_queuing_lock_t *lck) {
-  __kmp_init_nested_queuing_lock(lck);
-}
-
 void __kmp_destroy_nested_queuing_lock(kmp_queuing_lock_t *lck) {
   __kmp_destroy_queuing_lock(lck);
   lck->lk.depth_locked = 0;
@@ -1733,10 +1694,6 @@ __kmp_destroy_nested_queuing_lock_with_c
 
 // access functions to fields which don't exist for all lock kinds.
 
-static int __kmp_is_queuing_lock_initialized(kmp_queuing_lock_t *lck) {
-  return lck == lck->lk.initialized;
-}
-
 static const ident_t *__kmp_get_queuing_lock_location(kmp_queuing_lock_t *lck) {
   return lck->lk.location;
 }
@@ -2252,10 +2209,6 @@ static void __kmp_init_adaptive_lock(kmp
   KA_TRACE(1000, ("__kmp_init_adaptive_lock: lock %p initialized\n", lck));
 }
 
-static void __kmp_init_adaptive_lock_with_checks(kmp_adaptive_lock_t *lck) {
-  __kmp_init_adaptive_lock(lck);
-}
-
 static void __kmp_destroy_adaptive_lock(kmp_adaptive_lock_t *lck) {
 #if KMP_DEBUG_ADAPTIVE_LOCKS
   __kmp_accumulate_speculative_stats(&lck->lk.adaptive);
@@ -2553,10 +2506,6 @@ void __kmp_init_drdpa_lock(kmp_drdpa_loc
   KA_TRACE(1000, ("__kmp_init_drdpa_lock: lock %p initialized\n", lck));
 }
 
-static void __kmp_init_drdpa_lock_with_checks(kmp_drdpa_lock_t *lck) {
-  __kmp_init_drdpa_lock(lck);
-}
-
 void __kmp_destroy_drdpa_lock(kmp_drdpa_lock_t *lck) {
   lck->lk.initialized = NULL;
   lck->lk.location = NULL;
@@ -2689,10 +2638,6 @@ void __kmp_init_nested_drdpa_lock(kmp_dr
   lck->lk.depth_locked = 0; // >= 0 for nestable locks, -1 for simple locks
 }
 
-static void __kmp_init_nested_drdpa_lock_with_checks(kmp_drdpa_lock_t *lck) {
-  __kmp_init_nested_drdpa_lock(lck);
-}
-
 void __kmp_destroy_nested_drdpa_lock(kmp_drdpa_lock_t *lck) {
   __kmp_destroy_drdpa_lock(lck);
   lck->lk.depth_locked = 0;
@@ -2714,10 +2659,6 @@ static void __kmp_destroy_nested_drdpa_l
 
 // access functions to fields which don't exist for all lock kinds.
 
-static int __kmp_is_drdpa_lock_initialized(kmp_drdpa_lock_t *lck) {
-  return lck == lck->lk.initialized;
-}
-
 static const ident_t *__kmp_get_drdpa_lock_location(kmp_drdpa_lock_t *lck) {
   return lck->lk.location;
 }
@@ -2797,6 +2738,10 @@ static inline kmp_uint32 swap4(kmp_uint3
 
 static void __kmp_destroy_hle_lock(kmp_dyna_lock_t *lck) { TCW_4(*lck, 0); }
 
+static void __kmp_destroy_hle_lock_with_checks(kmp_dyna_lock_t *lck) {
+  TCW_4(*lck, 0);
+}
+
 static void __kmp_acquire_hle_lock(kmp_dyna_lock_t *lck, kmp_int32 gtid) {
   // Use gtid for KMP_LOCK_BUSY if necessary
   if (swap4(lck, KMP_LOCK_BUSY(1, hle)) != KMP_LOCK_FREE(hle)) {
@@ -2846,6 +2791,10 @@ static void __kmp_destroy_rtm_lock(kmp_q
   __kmp_destroy_queuing_lock(lck);
 }
 
+static void __kmp_destroy_rtm_lock_with_checks(kmp_queuing_lock_t *lck) {
+  __kmp_destroy_queuing_lock_with_checks(lck);
+}
+
 static void __kmp_acquire_rtm_lock(kmp_queuing_lock_t *lck, kmp_int32 gtid) {
   unsigned retries = 3, status;
   do {
@@ -2934,7 +2883,12 @@ void (*__kmp_direct_init[])(kmp_dyna_loc
 
 // destroy functions
 #define expand(l, op) 0, (void (*)(kmp_dyna_lock_t *))__kmp_##op##_##l##_lock,
-void (*__kmp_direct_destroy[])(kmp_dyna_lock_t *) = {
+static void (*direct_destroy[])(kmp_dyna_lock_t *) = {
+    __kmp_destroy_indirect_lock, 0, KMP_FOREACH_D_LOCK(expand, destroy)};
+#undef expand
+#define expand(l, op)                                                          \
+  0, (void (*)(kmp_dyna_lock_t *))__kmp_destroy_##l##_lock_with_checks,
+static void (*direct_destroy_check[])(kmp_dyna_lock_t *) = {
     __kmp_destroy_indirect_lock, 0, KMP_FOREACH_D_LOCK(expand, destroy)};
 #undef expand
 
@@ -2969,6 +2923,7 @@ static int (*direct_test_check[])(kmp_dy
 #undef expand
 
 // Exposes only one set of jump tables (*lock or *lock_with_checks).
+void (*(*__kmp_direct_destroy))(kmp_dyna_lock_t *) = 0;
 int (*(*__kmp_direct_set))(kmp_dyna_lock_t *, kmp_int32) = 0;
 int (*(*__kmp_direct_unset))(kmp_dyna_lock_t *, kmp_int32) = 0;
 int (*(*__kmp_direct_test))(kmp_dyna_lock_t *, kmp_int32) = 0;
@@ -2977,7 +2932,15 @@ int (*(*__kmp_direct_test))(kmp_dyna_loc
 #define expand(l, op) (void (*)(kmp_user_lock_p)) __kmp_##op##_##l##_##lock,
 void (*__kmp_indirect_init[])(kmp_user_lock_p) = {
     KMP_FOREACH_I_LOCK(expand, init)};
-void (*__kmp_indirect_destroy[])(kmp_user_lock_p) = {
+#undef expand
+
+#define expand(l, op) (void (*)(kmp_user_lock_p)) __kmp_##op##_##l##_##lock,
+static void (*indirect_destroy[])(kmp_user_lock_p) = {
+    KMP_FOREACH_I_LOCK(expand, destroy)};
+#undef expand
+#define expand(l, op)                                                          \
+  (void (*)(kmp_user_lock_p)) __kmp_##op##_##l##_##lock_with_checks,
+static void (*indirect_destroy_check[])(kmp_user_lock_p) = {
     KMP_FOREACH_I_LOCK(expand, destroy)};
 #undef expand
 
@@ -3010,6 +2973,7 @@ static int (*indirect_test_check[])(kmp_
 #undef expand
 
 // Exposes only one jump tables (*lock or *lock_with_checks).
+void (*(*__kmp_indirect_destroy))(kmp_user_lock_p) = 0;
 int (*(*__kmp_indirect_set))(kmp_user_lock_p, kmp_int32) = 0;
 int (*(*__kmp_indirect_unset))(kmp_user_lock_p, kmp_int32) = 0;
 int (*(*__kmp_indirect_test))(kmp_user_lock_p, kmp_int32) = 0;
@@ -3239,16 +3203,20 @@ void __kmp_init_dynamic_user_locks() {
     __kmp_direct_set = direct_set_check;
     __kmp_direct_unset = direct_unset_check;
     __kmp_direct_test = direct_test_check;
+    __kmp_direct_destroy = direct_destroy_check;
     __kmp_indirect_set = indirect_set_check;
     __kmp_indirect_unset = indirect_unset_check;
     __kmp_indirect_test = indirect_test_check;
+    __kmp_indirect_destroy = indirect_destroy_check;
   } else {
     __kmp_direct_set = direct_set;
     __kmp_direct_unset = direct_unset;
     __kmp_direct_test = direct_test;
+    __kmp_direct_destroy = direct_destroy;
     __kmp_indirect_set = indirect_set;
     __kmp_indirect_unset = indirect_unset;
     __kmp_indirect_test = indirect_test;
+    __kmp_indirect_destroy = indirect_destroy;
   }
   // If the user locks have already been initialized, then return. Allow the
   // switch between different KMP_CONSISTENCY_CHECK values, but do not allocate
@@ -3370,6 +3338,67 @@ int __kmp_num_locks_in_block = 1; // FIX
 
 #else // KMP_USE_DYNAMIC_LOCK
 
+static void __kmp_init_tas_lock_with_checks(kmp_tas_lock_t *lck) {
+  __kmp_init_tas_lock(lck);
+}
+
+static void __kmp_init_nested_tas_lock_with_checks(kmp_tas_lock_t *lck) {
+  __kmp_init_nested_tas_lock(lck);
+}
+
+#if KMP_USE_FUTEX
+static void __kmp_init_futex_lock_with_checks(kmp_futex_lock_t *lck) {
+  __kmp_init_futex_lock(lck);
+}
+
+static void __kmp_init_nested_futex_lock_with_checks(kmp_futex_lock_t *lck) {
+  __kmp_init_nested_futex_lock(lck);
+}
+#endif
+
+static int __kmp_is_ticket_lock_initialized(kmp_ticket_lock_t *lck) {
+  return lck == lck->lk.initialized;
+}
+
+static void __kmp_init_ticket_lock_with_checks(kmp_ticket_lock_t *lck) {
+  __kmp_init_ticket_lock(lck);
+}
+
+static void __kmp_init_nested_ticket_lock_with_checks(kmp_ticket_lock_t *lck) {
+  __kmp_init_nested_ticket_lock(lck);
+}
+
+static int __kmp_is_queuing_lock_initialized(kmp_queuing_lock_t *lck) {
+  return lck == lck->lk.initialized;
+}
+
+static void __kmp_init_queuing_lock_with_checks(kmp_queuing_lock_t *lck) {
+  __kmp_init_queuing_lock(lck);
+}
+
+static void
+__kmp_init_nested_queuing_lock_with_checks(kmp_queuing_lock_t *lck) {
+  __kmp_init_nested_queuing_lock(lck);
+}
+
+#if KMP_USE_ADAPTIVE_LOCKS
+static void __kmp_init_adaptive_lock_with_checks(kmp_adaptive_lock_t *lck) {
+  __kmp_init_adaptive_lock(lck);
+}
+#endif
+
+static int __kmp_is_drdpa_lock_initialized(kmp_drdpa_lock_t *lck) {
+  return lck == lck->lk.initialized;
+}
+
+static void __kmp_init_drdpa_lock_with_checks(kmp_drdpa_lock_t *lck) {
+  __kmp_init_drdpa_lock(lck);
+}
+
+static void __kmp_init_nested_drdpa_lock_with_checks(kmp_drdpa_lock_t *lck) {
+  __kmp_init_nested_drdpa_lock(lck);
+}
+
 /* user locks
  * They are implemented as a table of function pointers which are set to the
  * lock functions of the appropriate kind, once that has been determined. */

Modified: openmp/trunk/runtime/src/kmp_lock.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_lock.h?rev=339393&r1=339392&r2=339393&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_lock.h (original)
+++ openmp/trunk/runtime/src/kmp_lock.h Thu Aug  9 15:04:30 2018
@@ -1143,7 +1143,7 @@ typedef struct {
 // Function tables for direct locks. Set/unset/test differentiate functions
 // with/without consistency checking.
 extern void (*__kmp_direct_init[])(kmp_dyna_lock_t *, kmp_dyna_lockseq_t);
-extern void (*__kmp_direct_destroy[])(kmp_dyna_lock_t *);
+extern void (*(*__kmp_direct_destroy))(kmp_dyna_lock_t *);
 extern int (*(*__kmp_direct_set))(kmp_dyna_lock_t *, kmp_int32);
 extern int (*(*__kmp_direct_unset))(kmp_dyna_lock_t *, kmp_int32);
 extern int (*(*__kmp_direct_test))(kmp_dyna_lock_t *, kmp_int32);
@@ -1151,7 +1151,7 @@ extern int (*(*__kmp_direct_test))(kmp_d
 // Function tables for indirect locks. Set/unset/test differentiate functions
 // with/withuot consistency checking.
 extern void (*__kmp_indirect_init[])(kmp_user_lock_p);
-extern void (*__kmp_indirect_destroy[])(kmp_user_lock_p);
+extern void (*(*__kmp_indirect_destroy))(kmp_user_lock_p);
 extern int (*(*__kmp_indirect_set))(kmp_user_lock_p, kmp_int32);
 extern int (*(*__kmp_indirect_unset))(kmp_user_lock_p, kmp_int32);
 extern int (*(*__kmp_indirect_test))(kmp_user_lock_p, kmp_int32);

Modified: openmp/trunk/runtime/src/kmp_runtime.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_runtime.cpp?rev=339393&r1=339392&r2=339393&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_runtime.cpp (original)
+++ openmp/trunk/runtime/src/kmp_runtime.cpp Thu Aug  9 15:04:30 2018
@@ -4007,10 +4007,11 @@ void __kmp_task_info() {
   kmp_team_t *steam = this_thr->th.th_serial_team;
   kmp_team_t *team = this_thr->th.th_team;
 
-  __kmp_printf("__kmp_task_info: gtid=%d tid=%d t_thread=%p team=%p curtask=%p "
-               "ptask=%p\n",
-               gtid, tid, this_thr, team, this_thr->th.th_current_task,
-               team->t.t_implicit_task_taskdata[tid].td_parent);
+  __kmp_printf(
+      "__kmp_task_info: gtid=%d tid=%d t_thread=%p team=%p steam=%p curtask=%p "
+      "ptask=%p\n",
+      gtid, tid, this_thr, team, steam, this_thr->th.th_current_task,
+      team->t.t_implicit_task_taskdata[tid].td_parent);
 }
 #endif // KMP_DEBUG
 
@@ -6293,7 +6294,7 @@ void __kmp_register_library_startup(void
       if (tail != NULL) {
         long *flag_addr = 0;
         long flag_val = 0;
-        KMP_SSCANF(flag_addr_str, "%p", &flag_addr);
+        KMP_SSCANF(flag_addr_str, "%p", RCAST(void**, &flag_addr));
         KMP_SSCANF(flag_val_str, "%lx", &flag_val);
         if (flag_addr != 0 && flag_val != 0 && strcmp(file_name, "") != 0) {
           // First, check whether environment-encoded address is mapped into
@@ -7638,7 +7639,6 @@ __kmp_determine_reduction_method(
   } else {
 
     int atomic_available = FAST_REDUCTION_ATOMIC_METHOD_GENERATED;
-    int tree_available = FAST_REDUCTION_TREE_METHOD_GENERATED;
 
 #if KMP_ARCH_X86_64 || KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS64
 
@@ -7652,6 +7652,7 @@ __kmp_determine_reduction_method(
       teamsize_cutoff = 8;
     }
 #endif
+    int tree_available = FAST_REDUCTION_TREE_METHOD_GENERATED;
     if (tree_available) {
       if (team_size <= teamsize_cutoff) {
         if (atomic_available) {
@@ -7682,6 +7683,7 @@ __kmp_determine_reduction_method(
 
 #elif KMP_OS_DARWIN
 
+    int tree_available = FAST_REDUCTION_TREE_METHOD_GENERATED;
     if (atomic_available && (num_vars <= 3)) {
       retval = atomic_reduce_block;
     } else if (tree_available) {

Modified: openmp/trunk/runtime/src/kmp_sched.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_sched.cpp?rev=339393&r1=339392&r2=339393&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_sched.cpp (original)
+++ openmp/trunk/runtime/src/kmp_sched.cpp Thu Aug  9 15:04:30 2018
@@ -475,7 +475,7 @@ static void __kmp_dist_for_static_init(i
   nteams = th->th.th_teams_size.nteams;
 #endif
   team_id = team->t.t_master_tid;
-  KMP_DEBUG_ASSERT(nteams == team->t.t_parent->t.t_nproc);
+  KMP_DEBUG_ASSERT(nteams == (kmp_uint32)team->t.t_parent->t.t_nproc);
 
   // compute global trip count
   if (incr == 1) {
@@ -717,7 +717,7 @@ static void __kmp_team_static_init(ident
   nteams = th->th.th_teams_size.nteams;
 #endif
   team_id = team->t.t_master_tid;
-  KMP_DEBUG_ASSERT(nteams == team->t.t_parent->t.t_nproc);
+  KMP_DEBUG_ASSERT(nteams == (kmp_uint32)team->t.t_parent->t.t_nproc);
 
   // compute trip count
   if (incr == 1) {

Modified: openmp/trunk/runtime/src/kmp_settings.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_settings.cpp?rev=339393&r1=339392&r2=339393&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_settings.cpp (original)
+++ openmp/trunk/runtime/src/kmp_settings.cpp Thu Aug  9 15:04:30 2018
@@ -34,6 +34,7 @@ bool __kmp_env_format = 0; // 0 - old fo
 // -----------------------------------------------------------------------------
 // Helper string functions. Subject to move to kmp_str.
 
+#ifdef USE_LOAD_BALANCE
 static double __kmp_convert_to_double(char const *s) {
   double result;
 
@@ -43,6 +44,7 @@ static double __kmp_convert_to_double(ch
 
   return result;
 }
+#endif
 
 #ifdef KMP_DEBUG
 static unsigned int __kmp_readstr_with_sentinel(char *dest, char const *src,
@@ -132,6 +134,7 @@ static int __kmp_match_str(char const *t
   return TRUE;
 }
 
+#if KMP_OS_DARWIN
 static size_t __kmp_round4k(size_t size) {
   size_t _4k = 4 * 1024;
   if (size & (_4k - 1)) {
@@ -142,6 +145,7 @@ static size_t __kmp_round4k(size_t size)
   }
   return size;
 } // __kmp_round4k
+#endif
 
 /* Here, multipliers are like __kmp_convert_to_seconds, but floating-point
    values are allowed, and the return value is in milliseconds.  The default
@@ -532,6 +536,7 @@ static void __kmp_stg_print_int(kmp_str_
   }
 } // __kmp_stg_print_int
 
+#if USE_ITT_BUILD && USE_ITT_NOTIFY
 static void __kmp_stg_print_uint64(kmp_str_buf_t *buffer, char const *name,
                                    kmp_uint64 value) {
   if (__kmp_env_format) {
@@ -540,6 +545,7 @@ static void __kmp_stg_print_uint64(kmp_s
     __kmp_str_buf_print(buffer, "   %s=%" KMP_UINT64_SPEC "\n", name, value);
   }
 } // __kmp_stg_print_uint64
+#endif
 
 static void __kmp_stg_print_str(kmp_str_buf_t *buffer, char const *name,
                                 char const *value) {
@@ -1949,7 +1955,6 @@ static void __kmp_parse_affinity_env(cha
   // Guards.
   int type = 0;
   int proclist = 0;
-  int max_proclist = 0;
   int verbose = 0;
   int warnings = 0;
   int respect = 0;
@@ -2639,7 +2644,7 @@ static int __kmp_parse_place_list(const
   const char *next = scan;
 
   for (;;) {
-    int start, count, stride;
+    int count, stride;
 
     if (!__kmp_parse_place(var, &scan)) {
       return FALSE;

Modified: openmp/trunk/runtime/src/kmp_stub.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_stub.cpp?rev=339393&r1=339392&r2=339393&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_stub.cpp (original)
+++ openmp/trunk/runtime/src/kmp_stub.cpp Thu Aug  9 15:04:30 2018
@@ -46,7 +46,9 @@
 #define kmp_realloc kmpc_realloc
 #define kmp_free kmpc_free
 
+#if KMP_OS_WINDOWS
 static double frequency = 0.0;
+#endif
 
 // Helper functions.
 static size_t __kmps_init() {

Modified: openmp/trunk/runtime/src/kmp_tasking.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_tasking.cpp?rev=339393&r1=339392&r2=339393&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_tasking.cpp (original)
+++ openmp/trunk/runtime/src/kmp_tasking.cpp Thu Aug  9 15:04:30 2018
@@ -265,6 +265,7 @@ static kmp_int32 __kmp_push_task(kmp_int
     // untied task needs to increment counter so that the task structure is not
     // freed prematurely
     kmp_int32 counter = 1 + KMP_ATOMIC_INC(&taskdata->td_untied_count);
+    KMP_DEBUG_USE_VAR(counter);
     KA_TRACE(
         20,
         ("__kmp_push_task: T#%d untied_count (%d) incremented for task %p\n",
@@ -526,6 +527,7 @@ static void __kmpc_omp_task_begin_if0_te
     // untied task needs to increment counter so that the task structure is not
     // freed prematurely
     kmp_int32 counter = 1 + KMP_ATOMIC_INC(&taskdata->td_untied_count);
+    KMP_DEBUG_USE_VAR(counter);
     KA_TRACE(20, ("__kmpc_omp_task_begin_if0: T#%d untied_count (%d) "
                   "incremented for task %p\n",
                   gtid, counter, taskdata));
@@ -1264,7 +1266,6 @@ kmp_task_t *__kmpc_omp_task_alloc(ident_
 static void __kmp_invoke_task(kmp_int32 gtid, kmp_task_t *task,
                               kmp_taskdata_t *current_task) {
   kmp_taskdata_t *taskdata = KMP_TASK_TO_TASKDATA(task);
-  kmp_uint64 cur_time;
 #if OMP_40_ENABLED
   int discard = 0 /* false */;
 #endif
@@ -1293,6 +1294,7 @@ static void __kmp_invoke_task(kmp_int32
 #endif
 
 #if USE_ITT_BUILD && USE_ITT_NOTIFY
+  kmp_uint64 cur_time;
   if (__kmp_forkjoin_frames_mode == 3) {
     // Get the current time stamp to measure task execution time to correct
     // barrier imbalance time
@@ -2402,8 +2404,9 @@ static kmp_task_t *__kmp_steal_task(kmp_
       victim_td->td.td_deque[prev] = victim_td->td.td_deque[target];
       prev = target;
     }
-    KMP_DEBUG_ASSERT(victim_td->td.td_deque_tail ==
-                     ((target + 1) & TASK_DEQUE_MASK(victim_td->td)));
+    KMP_DEBUG_ASSERT(
+        victim_td->td.td_deque_tail ==
+        (kmp_uint32)((target + 1) & TASK_DEQUE_MASK(victim_td->td)));
     victim_td->td.td_deque_tail = target; // tail -= 1 (wrapped))
   }
   if (*thread_finished) {
@@ -3952,11 +3955,9 @@ void __kmp_taskloop_recur(ident_t *loc,
 #endif
   p_task_dup_t ptask_dup = (p_task_dup_t)task_dup;
   kmp_uint64 lower = *lb;
-  kmp_uint64 upper = *ub;
   kmp_info_t *thread = __kmp_threads[gtid];
   //  kmp_taskdata_t *current_task = thread->th.th_current_task;
   kmp_task_t *next_task;
-  kmp_int32 lastpriv = 0;
   size_t lower_offset =
       (char *)lb - (char *)task; // remember offset of lb in the task structure
   size_t upper_offset =

Modified: openmp/trunk/runtime/src/kmp_wait_release.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_wait_release.h?rev=339393&r1=339392&r2=339393&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_wait_release.h (original)
+++ openmp/trunk/runtime/src/kmp_wait_release.h Thu Aug  9 15:04:30 2018
@@ -54,6 +54,7 @@ public:
   typedef P flag_t;
   kmp_flag_native(volatile P *p, flag_type ft) : loc(p), t(ft) {}
   volatile P *get() { return loc; }
+  void *get_void_p() { return RCAST(void *, CCAST(P *, loc)); }
   void set(volatile P *new_loc) { loc = new_loc; }
   flag_type get_type() { return t; }
   P load() { return *loc; }
@@ -76,6 +77,10 @@ public:
    */
   std::atomic<P> *get() { return loc; }
   /*!
+   * @result void* pointer to the actual flag
+   */
+  void *get_void_p() { return RCAST(void *, loc); }
+  /*!
    * @param new_loc in   set loc to point at new_loc
    */
   void set(std::atomic<P> *new_loc) { loc = new_loc; }
@@ -153,21 +158,25 @@ static inline void __ompt_implicit_task_
 
 /* Spin wait loop that first does pause, then yield, then sleep. A thread that
    calls __kmp_wait_*  must make certain that another thread calls __kmp_release
-   to wake it back up to prevent deadlocks!  */
+   to wake it back up to prevent deadlocks!
+
+   NOTE: We may not belong to a team at this point.  */
 template <class C, int final_spin>
 static inline void
 __kmp_wait_template(kmp_info_t *this_thr,
                     C *flag USE_ITT_BUILD_ARG(void *itt_sync_obj)) {
-  // NOTE: We may not belong to a team at this point.
+#if USE_ITT_BUILD && USE_ITT_NOTIFY
   volatile void *spin = flag->get();
+#endif
   kmp_uint32 spins;
-  kmp_uint32 hibernate;
   int th_gtid;
   int tasks_completed = FALSE;
   int oversubscribed;
 #if !KMP_USE_MONITOR
   kmp_uint64 poll_count;
   kmp_uint64 hibernate_goal;
+#else
+  kmp_uint32 hibernate;
 #endif
 
   KMP_FSYNC_SPIN_INIT(spin, NULL);
@@ -479,7 +488,7 @@ template <class C> static inline void __
 #endif
   KF_TRACE(20, ("__kmp_release: T#%d releasing flag(%x)\n", gtid, flag->get()));
   KMP_DEBUG_ASSERT(flag->get());
-  KMP_FSYNC_RELEASING(flag->get());
+  KMP_FSYNC_RELEASING(flag->get_void_p());
 
   flag->internal_release();
 

Modified: openmp/trunk/runtime/src/ompt-general.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/ompt-general.cpp?rev=339393&r1=339392&r2=339393&view=diff
==============================================================================
--- openmp/trunk/runtime/src/ompt-general.cpp (original)
+++ openmp/trunk/runtime/src/ompt-general.cpp Thu Aug  9 15:04:30 2018
@@ -643,7 +643,10 @@ OMPT_API_ROUTINE int ompt_get_proc_id(vo
  * compatability
  ****************************************************************************/
 
+/*
+ * Currently unused function
 OMPT_API_ROUTINE int ompt_get_ompt_version() { return OMPT_VERSION; }
+*/
 
 /*****************************************************************************
 * application-facing API

Modified: openmp/trunk/runtime/src/ompt-specific.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/ompt-specific.h?rev=339393&r1=339392&r2=339393&view=diff
==============================================================================
--- openmp/trunk/runtime/src/ompt-specific.h (original)
+++ openmp/trunk/runtime/src/ompt-specific.h Thu Aug  9 15:04:30 2018
@@ -52,7 +52,10 @@ int __ompt_get_task_info_internal(int an
 
 ompt_data_t *__ompt_get_thread_data_internal();
 
+/*
+ * Unused currently
 static uint64_t __ompt_get_get_unique_id_internal();
+*/
 
 /*****************************************************************************
  * macros

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=339393&r1=339392&r2=339393&view=diff
==============================================================================
--- openmp/trunk/runtime/src/thirdparty/ittnotify/ittnotify_static.c (original)
+++ openmp/trunk/runtime/src/thirdparty/ittnotify/ittnotify_static.c Thu Aug  9 15:04:30 2018
@@ -94,8 +94,6 @@ static const char* ittnotify_lib_name =
         __itt_mutex_lock(&p.mutex);                                  \
 }
 
-const int _N_(err) = 0;
-
 typedef int (__itt_init_ittlib_t)(const char*, __itt_group_id);
 
 /* this define used to control initialization function name. */
@@ -490,7 +488,7 @@ static void ITTAPI ITT_VERSIONIZE(ITT_JO
 
 static int ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(thr_name_setW),_init))(const wchar_t* name, int namelen)
 {
-    namelen = namelen;
+    (void)namelen;
     ITT_VERSIONIZE(ITT_JOIN(_N_(thread_set_nameW),_init))(name);
     return 0;
 }
@@ -538,14 +536,14 @@ static void ITTAPI ITT_VERSIONIZE(ITT_JO
 #if ITT_PLATFORM==ITT_PLATFORM_WIN
 static int ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(thr_name_setA),_init))(const char* name, int namelen)
 {
-    namelen = namelen;
+    (void)namelen;
     ITT_VERSIONIZE(ITT_JOIN(_N_(thread_set_nameA),_init))(name);
     return 0;
 }
 #else  /* ITT_PLATFORM==ITT_PLATFORM_WIN */
 static int ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(thr_name_set),_init))(const char* name, int namelen)
 {
-    namelen = namelen;
+    (void)namelen;
     ITT_VERSIONIZE(ITT_JOIN(_N_(thread_set_name),_init))(name);
     return 0;
 }




More information about the Openmp-commits mailing list