[Openmp-commits] [openmp] r239057 - Fix some sign compare warnings.
Jonathan Peyton
jonathan.l.peyton at intel.com
Thu Jun 4 10:29:14 PDT 2015
Author: jlpeyton
Date: Thu Jun 4 12:29:13 2015
New Revision: 239057
URL: http://llvm.org/viewvc/llvm-project?rev=239057&view=rev
Log:
Fix some sign compare warnings.
This change changes kmp_bstate.old_tid to sign integer instead of unsigned integer.
It also defines two new macros KMP_NSEC_PER_SEC and KMP_USEC_PER_SEC which lets us take
control of the sign (we want them to be longs). Also, in kmp_wait_release.h, the byteref()
function's return type is changed from char to unsigned char.
Modified:
openmp/trunk/runtime/src/kmp.h
openmp/trunk/runtime/src/kmp_wait_release.h
openmp/trunk/runtime/src/z_Linux_util.c
openmp/trunk/runtime/src/z_Windows_NT_util.c
Modified: openmp/trunk/runtime/src/kmp.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp.h?rev=239057&r1=239056&r2=239057&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp.h (original)
+++ openmp/trunk/runtime/src/kmp.h Thu Jun 4 12:29:13 2015
@@ -157,13 +157,8 @@ class kmp_stats_list;
// #define USE_QUEUING_LOCK_FOR_BGET
// #endif
-#ifndef NSEC_PER_SEC
-# define NSEC_PER_SEC 1000000000L
-#endif
-
-#ifndef USEC_PER_SEC
-# define USEC_PER_SEC 1000000L
-#endif
+#define KMP_NSEC_PER_SEC 1000000000L
+#define KMP_USEC_PER_SEC 1000000L
/*!
@ingroup BASIC_TYPES
@@ -1657,7 +1652,7 @@ typedef struct KMP_ALIGN_CACHE kmp_bstat
kmp_uint32 *skip_per_level;
kmp_uint32 my_level;
kmp_int32 parent_tid;
- kmp_uint32 old_tid;
+ kmp_int32 old_tid;
kmp_uint32 depth;
struct kmp_bstate *parent_bar;
kmp_team_t *team;
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=239057&r1=239056&r2=239057&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_wait_release.h (original)
+++ openmp/trunk/runtime/src/kmp_wait_release.h Thu Jun 4 12:29:13 2015
@@ -459,7 +459,7 @@ class kmp_flag_oncore : public kmp_flag<
#if USE_ITT_BUILD
void *itt_sync_obj; /**< ITT object that must be passed to new flag location. */
#endif
- char& byteref(volatile kmp_uint64* loc, size_t offset) { return ((char *)loc)[offset]; }
+ unsigned char& byteref(volatile kmp_uint64* loc, size_t offset) { return ((unsigned char *)loc)[offset]; }
public:
kmp_flag_oncore(volatile kmp_uint64 *p)
: kmp_flag<kmp_uint64>(p, flag_oncore), num_waiting_threads(0), flag_switch(false) {}
Modified: openmp/trunk/runtime/src/z_Linux_util.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/z_Linux_util.c?rev=239057&r1=239056&r2=239057&view=diff
==============================================================================
--- openmp/trunk/runtime/src/z_Linux_util.c (original)
+++ openmp/trunk/runtime/src/z_Linux_util.c Thu Jun 4 12:29:13 2015
@@ -843,7 +843,7 @@ __kmp_launch_monitor( void *thr )
interval.tv_nsec = 0;
} else {
interval.tv_sec = 0;
- interval.tv_nsec = (NSEC_PER_SEC / __kmp_monitor_wakeups);
+ interval.tv_nsec = (KMP_NSEC_PER_SEC / __kmp_monitor_wakeups);
}
KA_TRACE( 10, ("__kmp_launch_monitor: #2 monitor\n" ) );
@@ -870,9 +870,9 @@ __kmp_launch_monitor( void *thr )
now.tv_sec += interval.tv_sec;
now.tv_nsec += interval.tv_nsec;
- if (now.tv_nsec >= NSEC_PER_SEC) {
+ if (now.tv_nsec >= KMP_NSEC_PER_SEC) {
now.tv_sec += 1;
- now.tv_nsec -= NSEC_PER_SEC;
+ now.tv_nsec -= KMP_NSEC_PER_SEC;
}
status = pthread_mutex_lock( & __kmp_wait_mx.m_mutex );
@@ -2248,14 +2248,14 @@ __kmp_elapsed( double *t )
status = clock_gettime( CLOCK_PROCESS_CPUTIME_ID, &ts );
KMP_CHECK_SYSFAIL_ERRNO( "clock_gettime", status );
- *t = (double) ts.tv_nsec * (1.0 / (double) NSEC_PER_SEC) +
+ *t = (double) ts.tv_nsec * (1.0 / (double) KMP_NSEC_PER_SEC) +
(double) ts.tv_sec;
# else
struct timeval tv;
status = gettimeofday( & tv, NULL );
KMP_CHECK_SYSFAIL_ERRNO( "gettimeofday", status );
- *t = (double) tv.tv_usec * (1.0 / (double) USEC_PER_SEC) +
+ *t = (double) tv.tv_usec * (1.0 / (double) KMP_USEC_PER_SEC) +
(double) tv.tv_sec;
# endif
}
Modified: openmp/trunk/runtime/src/z_Windows_NT_util.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/z_Windows_NT_util.c?rev=239057&r1=239056&r2=239057&view=diff
==============================================================================
--- openmp/trunk/runtime/src/z_Windows_NT_util.c (original)
+++ openmp/trunk/runtime/src/z_Windows_NT_util.c Thu Jun 4 12:29:13 2015
@@ -799,7 +799,7 @@ __kmp_read_cpu_time( void )
sec += KernelTime.dwLowDateTime;
sec += UserTime.dwLowDateTime;
- cpu_time += (sec * 100.0) / NSEC_PER_SEC;
+ cpu_time += (sec * 100.0) / KMP_NSEC_PER_SEC;
}
return cpu_time;
More information about the Openmp-commits
mailing list