[Openmp-commits] [openmp] r239326 - Remove unused variable warnings by fooling compiler.

Jonathan Peyton jonathan.l.peyton at intel.com
Mon Jun 8 11:56:34 PDT 2015


Author: jlpeyton
Date: Mon Jun  8 13:56:33 2015
New Revision: 239326

URL: http://llvm.org/viewvc/llvm-project?rev=239326&view=rev
Log:
Remove unused variable warnings by fooling compiler.

Some variables are convenient to keep around even if they aren't
really used in a release build.  This is often seen in DEBUG guarded code where the variable
is only used in a DEBUG build.

Patch by Jack Howarth

Modified:
    openmp/trunk/runtime/src/kmp_barrier.cpp
    openmp/trunk/runtime/src/kmp_csupport.c
    openmp/trunk/runtime/src/kmp_gsupport.c
    openmp/trunk/runtime/src/kmp_taskdeps.cpp
    openmp/trunk/runtime/src/kmp_tasking.c
    openmp/trunk/runtime/src/z_Linux_util.c

Modified: openmp/trunk/runtime/src/kmp_barrier.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_barrier.cpp?rev=239326&r1=239325&r2=239326&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_barrier.cpp (original)
+++ openmp/trunk/runtime/src/kmp_barrier.cpp Mon Jun  8 13:56:33 2015
@@ -1237,7 +1237,8 @@ __kmp_barrier(enum barrier_type bt, int
                 }
 #endif
 
-                kmp_task_team_t * task_team = this_thr->th.th_task_team;
+                kmp_task_team_t * task_team;
+                task_team = this_thr->th.th_task_team;
                 KMP_DEBUG_ASSERT(task_team->tt.tt_found_proxy_tasks == TRUE);
                 __kmp_task_team_wait(this_thr, team
                                                USE_ITT_BUILD_ARG(itt_sync_obj));

Modified: openmp/trunk/runtime/src/kmp_csupport.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_csupport.c?rev=239326&r1=239325&r2=239326&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_csupport.c (original)
+++ openmp/trunk/runtime/src/kmp_csupport.c Mon Jun  8 13:56:33 2015
@@ -2148,7 +2148,8 @@ __kmpc_unset_nest_lock( ident_t *loc, km
     __kmp_itt_lock_releasing( lck );
 #endif /* USE_ITT_BUILD */
 
-    int release_status = RELEASE_NESTED_LOCK( lck, gtid );
+    int release_status;
+    release_status = RELEASE_NESTED_LOCK( lck, gtid );
 #if OMPT_SUPPORT && OMPT_BLAME
     if (ompt_status == ompt_status_track_callback) {
         if (release_status == KMP_LOCK_RELEASED) {

Modified: openmp/trunk/runtime/src/kmp_gsupport.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_gsupport.c?rev=239326&r1=239325&r2=239326&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_gsupport.c (original)
+++ openmp/trunk/runtime/src/kmp_gsupport.c Mon Jun  8 13:56:33 2015
@@ -476,7 +476,9 @@ void
 xexpand(KMP_API_NAME_GOMP_PARALLEL_END)(void)
 {
     int gtid = __kmp_get_gtid();
-    kmp_info_t *thr = __kmp_threads[gtid];
+    kmp_info_t *thr;
+
+    thr = __kmp_threads[gtid];
 
     MKLOC(loc, "GOMP_parallel_end");
     KA_TRACE(20, ("GOMP_parallel_end: T#%d\n", gtid));

Modified: openmp/trunk/runtime/src/kmp_taskdeps.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_taskdeps.cpp?rev=239326&r1=239325&r2=239326&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_taskdeps.cpp (original)
+++ openmp/trunk/runtime/src/kmp_taskdeps.cpp Mon Jun  8 13:56:33 2015
@@ -287,8 +287,9 @@ __kmp_check_deps ( kmp_int32 gtid, kmp_d
                    kmp_int32 ndeps_noalias, kmp_depend_info_t *noalias_dep_list )
 {
     int i;
+    kmp_taskdata_t * taskdata;
 
-    kmp_taskdata_t * taskdata = KMP_TASK_TO_TASKDATA(task);
+    taskdata = KMP_TASK_TO_TASKDATA(task);
     KA_TRACE(20, ("__kmp_check_deps: T#%d checking dependencies for task %p : %d possibly aliased dependencies, %d non-aliased depedencies : dep_barrier=%d .\n", gtid, taskdata, ndeps, ndeps_noalias, dep_barrier ) );
 
     // Filter deps in dep_list

Modified: openmp/trunk/runtime/src/kmp_tasking.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_tasking.c?rev=239326&r1=239325&r2=239326&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_tasking.c (original)
+++ openmp/trunk/runtime/src/kmp_tasking.c Mon Jun  8 13:56:33 2015
@@ -1274,9 +1274,10 @@ __kmp_omp_task( kmp_int32 gtid, kmp_task
 kmp_int32
 __kmpc_omp_task( ident_t *loc_ref, kmp_int32 gtid, kmp_task_t * new_task)
 {
-    kmp_taskdata_t * new_taskdata = KMP_TASK_TO_TASKDATA(new_task);
+    kmp_taskdata_t * new_taskdata;
     kmp_int32 res;
 
+    new_taskdata = KMP_TASK_TO_TASKDATA(new_task);
     KA_TRACE(10, ("__kmpc_omp_task(enter): T#%d loc=%p task=%p\n",
                   gtid, loc_ref, new_taskdata ) );
 
@@ -1636,7 +1637,9 @@ __kmp_steal_task( kmp_info_t *victim, km
         // We need to un-mark this victim as a finished victim.  This must be done before
         // releasing the lock, or else other threads (starting with the master victim)
         // might be prematurely released from the barrier!!!
-        kmp_uint32 count = KMP_TEST_THEN_INC32( (kmp_int32 *)unfinished_threads );
+        kmp_uint32 count;
+
+        count = KMP_TEST_THEN_INC32( (kmp_int32 *)unfinished_threads );
 
         KA_TRACE(20, ("__kmp_steal_task: T#%d inc unfinished_threads to %d: task_team=%p\n",
                       gtid, count + 1, task_team) );
@@ -1744,7 +1747,9 @@ static inline int __kmp_execute_tasks_te
         // been done.  This decrement might be to the spin location, and
         // result in the termination condition being satisfied.
         if (! *thread_finished) {
-            kmp_uint32 count = KMP_TEST_THEN_DEC32( (kmp_int32 *)unfinished_threads ) - 1;
+            kmp_uint32 count;
+
+            count = KMP_TEST_THEN_DEC32( (kmp_int32 *)unfinished_threads ) - 1;
             KA_TRACE(20, ("__kmp_execute_tasks_template(dec #1): T#%d dec unfinished_threads to %d task_team=%p\n",
                           gtid, count, task_team) );
             *thread_finished = TRUE;
@@ -1825,7 +1830,9 @@ static inline int __kmp_execute_tasks_te
             // been done.  This decrement might be to the spin location, and
             // result in the termination condition being satisfied.
             if (! *thread_finished) {
-                kmp_uint32 count = KMP_TEST_THEN_DEC32( (kmp_int32 *)unfinished_threads ) - 1;
+                kmp_uint32 count;
+
+                count = KMP_TEST_THEN_DEC32( (kmp_int32 *)unfinished_threads ) - 1;
                 KA_TRACE(20, ("__kmp_execute_tasks_template(dec #2): T#%d dec unfinished_threads to %d "
                               "task_team=%p\n", gtid, count, task_team) );
                 *thread_finished = TRUE;
@@ -1938,7 +1945,9 @@ static inline int __kmp_execute_tasks_te
             // been done.  This decrement might be to the spin location, and
             // result in the termination condition being satisfied.
             if (! *thread_finished) {
-                kmp_uint32 count = KMP_TEST_THEN_DEC32( (kmp_int32 *)unfinished_threads ) - 1;
+                kmp_uint32 count;
+
+                count = KMP_TEST_THEN_DEC32( (kmp_int32 *)unfinished_threads ) - 1;
                 KA_TRACE(20, ("__kmp_execute_tasks_template(dec #3): T#%d dec unfinished_threads to %d; "
                               "task_team=%p\n",
                               gtid, count, task_team) );
@@ -1996,13 +2005,14 @@ int __kmp_execute_tasks_oncore(kmp_info_
 static void
 __kmp_enable_tasking( kmp_task_team_t *task_team, kmp_info_t *this_thr )
 {
-    kmp_team_t *team = this_thr->th.th_team;
+    kmp_team_t *team;
     kmp_thread_data_t *threads_data;
     int nthreads, i, is_init_thread;
 
     KA_TRACE( 10, ( "__kmp_enable_tasking(enter): T#%d\n",
                     __kmp_gtid_from_thread( this_thr ) ) );
 
+    team = this_thr->th.th_team;
     KMP_DEBUG_ASSERT(task_team != NULL);
     KMP_DEBUG_ASSERT(team != NULL);
 

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=239326&r1=239325&r2=239326&view=diff
==============================================================================
--- openmp/trunk/runtime/src/z_Linux_util.c (original)
+++ openmp/trunk/runtime/src/z_Linux_util.c Mon Jun  8 13:56:33 2015
@@ -1114,9 +1114,11 @@ __kmp_create_monitor( kmp_info_t *th )
     pthread_attr_t      thread_attr;
     size_t              size;
     int                 status;
-    int                 caller_gtid = __kmp_get_gtid();
+    int                 caller_gtid;
     int                 auto_adj_size = FALSE;
 
+    caller_gtid = __kmp_get_gtid();
+
     KA_TRACE( 10, ("__kmp_create_monitor: try to create monitor\n" ) );
 
     KMP_MB();       /* Flush all pending memory write invalidates.  */





More information about the Openmp-commits mailing list