diff options
author | Jonathan Peyton <jonathan.l.peyton@intel.com> | 2015-06-04 17:29:13 +0000 |
---|---|---|
committer | Jonathan Peyton <jonathan.l.peyton@intel.com> | 2015-06-04 17:29:13 +0000 |
commit | 1e7a1ddcee54477d84ed286e4a3932db0fd682a5 (patch) | |
tree | 6db0e013c4a93e8c053e7e49de63790fa9bf47b7 /openmp/runtime/src | |
parent | 185579bf0cc4bb44fade923231d8db65535b5dd6 (diff) | |
download | bcm5719-llvm-1e7a1ddcee54477d84ed286e4a3932db0fd682a5.tar.gz bcm5719-llvm-1e7a1ddcee54477d84ed286e4a3932db0fd682a5.zip |
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.
llvm-svn: 239057
Diffstat (limited to 'openmp/runtime/src')
-rw-r--r-- | openmp/runtime/src/kmp.h | 11 | ||||
-rw-r--r-- | openmp/runtime/src/kmp_wait_release.h | 2 | ||||
-rw-r--r-- | openmp/runtime/src/z_Linux_util.c | 10 | ||||
-rw-r--r-- | openmp/runtime/src/z_Windows_NT_util.c | 2 |
4 files changed, 10 insertions, 15 deletions
diff --git a/openmp/runtime/src/kmp.h b/openmp/runtime/src/kmp.h index d9aee8c4955..d003146af00 100644 --- a/openmp/runtime/src/kmp.h +++ b/openmp/runtime/src/kmp.h @@ -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_bstate { 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; diff --git a/openmp/runtime/src/kmp_wait_release.h b/openmp/runtime/src/kmp_wait_release.h index 31d76a1df87..dde1763a73a 100644 --- a/openmp/runtime/src/kmp_wait_release.h +++ b/openmp/runtime/src/kmp_wait_release.h @@ -459,7 +459,7 @@ class kmp_flag_oncore : public kmp_flag<kmp_uint64> { #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) {} diff --git a/openmp/runtime/src/z_Linux_util.c b/openmp/runtime/src/z_Linux_util.c index 55f9bdfc610..c624c9d9f09 100644 --- a/openmp/runtime/src/z_Linux_util.c +++ b/openmp/runtime/src/z_Linux_util.c @@ -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 } diff --git a/openmp/runtime/src/z_Windows_NT_util.c b/openmp/runtime/src/z_Windows_NT_util.c index d60f3c50905..bfeb1b18b63 100644 --- a/openmp/runtime/src/z_Windows_NT_util.c +++ b/openmp/runtime/src/z_Windows_NT_util.c @@ -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; |