[Openmp-commits] [openmp] r239330 - Remove unused variable warnings by adding proper macro guards.

Jonathan Peyton jonathan.l.peyton at intel.com
Mon Jun 8 12:25:25 PDT 2015


Author: jlpeyton
Date: Mon Jun  8 14:25:25 2015
New Revision: 239330

URL: http://llvm.org/viewvc/llvm-project?rev=239330&view=rev
Log:
Remove unused variable warnings by adding proper macro guards.

As an ongoing effort to sanitize the openmp code, these changes remove unused variables
by adding proper macros around both variables and functions.

Patch by Jack Howarth

Modified:
    openmp/trunk/runtime/src/kmp_dispatch.cpp
    openmp/trunk/runtime/src/kmp_environment.c
    openmp/trunk/runtime/src/kmp_error.c
    openmp/trunk/runtime/src/kmp_runtime.c
    openmp/trunk/runtime/src/kmp_settings.c
    openmp/trunk/runtime/src/kmp_taskq.c
    openmp/trunk/runtime/src/kmp_utility.c
    openmp/trunk/runtime/src/z_Linux_util.c

Modified: openmp/trunk/runtime/src/kmp_dispatch.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_dispatch.cpp?rev=239330&r1=239329&r2=239330&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_dispatch.cpp (original)
+++ openmp/trunk/runtime/src/kmp_dispatch.cpp Mon Jun  8 14:25:25 2015
@@ -1380,7 +1380,9 @@ __kmp_dispatch_next(
     typedef typename traits_t< T >::unsigned_t  UT;
     typedef typename traits_t< T >::signed_t    ST;
     typedef typename traits_t< T >::floating_t  DBL;
+#if ( KMP_STATIC_STEAL_ENABLED && KMP_ARCH_X86_64 )
     static const int ___kmp_size_type = sizeof( UT );
+#endif
 
     int                                   status;
     dispatch_private_info_template< T > * pr;

Modified: openmp/trunk/runtime/src/kmp_environment.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_environment.c?rev=239330&r1=239329&r2=239330&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_environment.c (original)
+++ openmp/trunk/runtime/src/kmp_environment.c Mon Jun  8 14:25:25 2015
@@ -370,6 +370,7 @@ ___kmp_env_blk_parse_string(
     It is not clear how empty environment is represented. "\x00\x00"?
 */
 
+#if KMP_OS_WINDOWS
 static
 void
 ___kmp_env_blk_parse_windows(
@@ -436,7 +437,7 @@ ___kmp_env_blk_parse_windows(
     block->count = count;
 
 }; // ___kmp_env_blk_parse_windows
-
+#endif
 
 
 /*

Modified: openmp/trunk/runtime/src/kmp_error.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_error.c?rev=239330&r1=239329&r2=239330&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_error.c (original)
+++ openmp/trunk/runtime/src/kmp_error.c Mon Jun  8 14:25:25 2015
@@ -206,6 +206,7 @@ __kmp_free_cons_stack( void * ptr ) {
 }
 
 
+#if KMP_DEBUG
 static void
 dump_cons_stack( int gtid, struct cons_header * p ) {
     int i;
@@ -224,6 +225,7 @@ dump_cons_stack( int gtid, struct cons_h
     __kmp_debug_printf( "%s", buffer.str );
     __kmp_str_buf_free( & buffer );
 }
+#endif
 
 void
 __kmp_push_parallel( int gtid, ident_t const * ident )

Modified: openmp/trunk/runtime/src/kmp_runtime.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_runtime.c?rev=239330&r1=239329&r2=239330&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_runtime.c (original)
+++ openmp/trunk/runtime/src/kmp_runtime.c Mon Jun  8 14:25:25 2015
@@ -71,7 +71,9 @@ void __kmp_cleanup( void );
 
 static void __kmp_initialize_info( kmp_info_t *, kmp_team_t *, int tid, int gtid );
 static void __kmp_initialize_team( kmp_team_t * team, int new_nproc, kmp_internal_control_t * new_icvs, ident_t * loc );
+#if OMP_40_ENABLED && KMP_AFFINITY_SUPPORTED
 static void __kmp_partition_places( kmp_team_t *team );
+#endif
 static void __kmp_do_serial_initialize( void );
 void __kmp_fork_barrier( int gtid, int tid );
 void __kmp_join_barrier( int gtid );
@@ -83,7 +85,9 @@ static int __kmp_load_balance_nproc( kmp
 #endif
 
 static int __kmp_expand_threads(int nWish, int nNeed);
+#if KMP_OS_WINDOWS
 static int __kmp_unregister_root_other_thread( int gtid );
+#endif
 static void __kmp_unregister_library( void ); // called by __kmp_internal_end()
 static void __kmp_reap_thread( kmp_info_t * thread, int is_root );
 static kmp_info_t *__kmp_thread_pool_insert_pt = NULL;
@@ -3961,6 +3965,7 @@ __kmp_unregister_root_current_thread( in
     __kmp_release_bootstrap_lock( &__kmp_forkjoin_lock );
 }
 
+#if KMP_OS_WINDOWS
 /* __kmp_forkjoin_lock must be already held
    Unregisters a root thread that is not the current thread.  Returns the number of
    __kmp_threads entries freed as a result.
@@ -3981,6 +3986,7 @@ __kmp_unregister_root_other_thread( int
     KC_TRACE( 10, ("__kmp_unregister_root_other_thread: T#%d unregistered\n", gtid ));
     return r;
 }
+#endif
 
 #if KMP_DEBUG
 void __kmp_task_info() {

Modified: openmp/trunk/runtime/src/kmp_settings.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_settings.c?rev=239330&r1=239329&r2=239330&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_settings.c (original)
+++ openmp/trunk/runtime/src/kmp_settings.c Mon Jun  8 14:25:25 2015
@@ -42,6 +42,7 @@ __kmp_convert_to_double( char const * s
     return result;
 }
 
+#ifdef KMP_DEBUG
 static unsigned int
 __kmp_readstr_with_sentinel(char *dest, char const * src, size_t len, char sentinel) {
     unsigned int i;
@@ -54,6 +55,7 @@ __kmp_readstr_with_sentinel(char *dest,
     *dest = '\0';
     return i;
 }
+#endif
 
 static int
 __kmp_match_with_sentinel( char const * a, char const * b, size_t len, char sentinel ) {
@@ -349,6 +351,7 @@ __kmp_stg_parse_size(
     }; // if
 } // __kmp_stg_parse_size
 
+#if KMP_AFFINITY_SUPPORTED
 static void
 __kmp_stg_parse_str(
     char const *      name,
@@ -358,7 +361,7 @@ __kmp_stg_parse_str(
     KMP_INTERNAL_FREE( (void *) * out );
     * out = __kmp_str_format( "%s", value );
 } // __kmp_stg_parse_str
-
+#endif
 
 static void
 __kmp_stg_parse_int(
@@ -402,6 +405,7 @@ __kmp_stg_parse_int(
 } // __kmp_stg_parse_int
 
 
+#if KMP_DEBUG_ADAPTIVE_LOCKS
 static void
 __kmp_stg_parse_file(
     char const * name,
@@ -420,6 +424,7 @@ __kmp_stg_parse_file(
     KMP_INTERNAL_FREE(t);
     * out = __kmp_str_format( "%s", buffer );
 } // __kmp_stg_parse_file
+#endif
 
 #ifdef KMP_DEBUG
 static char * par_range_to_print = NULL;

Modified: openmp/trunk/runtime/src/kmp_taskq.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_taskq.c?rev=239330&r1=239329&r2=239330&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_taskq.c (original)
+++ openmp/trunk/runtime/src/kmp_taskq.c Mon Jun  8 14:25:25 2015
@@ -119,6 +119,8 @@ __kmp_taskq_check_ordered( kmp_int32 gti
     }
 }
 
+#ifdef KMP_DEBUG
+
 static void
 __kmp_dump_TQF(kmp_int32 flags)
 {
@@ -377,6 +379,7 @@ __kmp_dump_task_queue_tree( kmp_taskq_t
 
     __kmp_printf("\n");
 }
+#endif
 
 /* --------------------------------------------------------------------------- */
 

Modified: openmp/trunk/runtime/src/kmp_utility.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_utility.c?rev=239330&r1=239329&r2=239330&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_utility.c (original)
+++ openmp/trunk/runtime/src/kmp_utility.c Mon Jun  8 14:25:25 2015
@@ -30,7 +30,9 @@ static const char *unknown = "unknown";
 /* the debugging package has not been initialized yet, and only "0" will print   */
 /* debugging output since the environment variables have not been read.          */
 
+#ifdef KMP_DEBUG
 static int trace_level = 5;
+#endif
 
 /*
  * LOG_ID_BITS  = ( 1 + floor( log_2( max( log_per_phy - 1, 1 ))))
@@ -136,7 +138,9 @@ __kmp_query_cpuid( kmp_cpuinfo_t *p )
     struct kmp_cpuid buf;
     int max_arg;
     int log_per_phy;
+#ifdef KMP_DEBUG
     int cflush_size;
+#endif
 
     p->initialized = 1;
 

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=239330&r1=239329&r2=239330&view=diff
==============================================================================
--- openmp/trunk/runtime/src/z_Linux_util.c (original)
+++ openmp/trunk/runtime/src/z_Linux_util.c Mon Jun  8 14:25:25 2015
@@ -683,7 +683,9 @@ __kmp_launch_worker( void *thr )
     sigset_t    new_set, old_set;
 #endif /* KMP_BLOCK_SIGNALS */
     void *exit_val;
+#if KMP_OS_LINUX || KMP_OS_FREEBSD
     void *padding = 0;
+#endif
     int gtid;
     int error;
 





More information about the Openmp-commits mailing list