[Openmp-commits] [openmp] f8d081c - [OpenMP][libomp] Allow unused-but-set warnings

Jonathan Peyton via Openmp-commits openmp-commits at lists.llvm.org
Mon Oct 3 08:26:00 PDT 2022


Author: Jonathan Peyton
Date: 2022-10-03T10:24:33-05:00
New Revision: f8d081c1a51c53f356c1871d3fdb499a4fd5bbdf

URL: https://github.com/llvm/llvm-project/commit/f8d081c1a51c53f356c1871d3fdb499a4fd5bbdf
DIFF: https://github.com/llvm/llvm-project/commit/f8d081c1a51c53f356c1871d3fdb499a4fd5bbdf.diff

LOG: [OpenMP][libomp] Allow unused-but-set warnings

Only a few remaining which are taken care of by this patch.

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

Added: 
    

Modified: 
    openmp/runtime/cmake/LibompHandleFlags.cmake
    openmp/runtime/cmake/config-ix.cmake
    openmp/runtime/src/kmp_affinity.cpp
    openmp/runtime/src/z_Linux_util.cpp

Removed: 
    


################################################################################
diff  --git a/openmp/runtime/cmake/LibompHandleFlags.cmake b/openmp/runtime/cmake/LibompHandleFlags.cmake
index 6643ea392f80a..74643291737ea 100644
--- a/openmp/runtime/cmake/LibompHandleFlags.cmake
+++ b/openmp/runtime/cmake/LibompHandleFlags.cmake
@@ -35,7 +35,6 @@ function(libomp_get_cxxflags cxxflags)
   libomp_append(flags_local -Wno-stringop-truncation LIBOMP_HAVE_WNO_STRINGOP_TRUNCATION_FLAG)
   libomp_append(flags_local -Wno-switch LIBOMP_HAVE_WNO_SWITCH_FLAG)
   libomp_append(flags_local -Wno-uninitialized LIBOMP_HAVE_WNO_UNINITIALIZED_FLAG)
-  libomp_append(flags_local -Wno-unused-but-set-variable LIBOMP_HAVE_WNO_UNUSED_BUT_SET_VARIABLE_FLAG)
   libomp_append(flags_local -Wno-return-type-c-linkage LIBOMP_HAVE_WNO_RETURN_TYPE_C_LINKAGE_FLAG)
   libomp_append(flags_local -Wno-cast-qual LIBOMP_HAVE_WNO_CAST_QUAL_FLAG)
   libomp_append(flags_local -Wno-int-to-void-pointer-cast LIBOMP_HAVE_WNO_INT_TO_VOID_POINTER_CAST_FLAG)

diff  --git a/openmp/runtime/cmake/config-ix.cmake b/openmp/runtime/cmake/config-ix.cmake
index 356366e4f9e79..a57cbf9d2ef59 100644
--- a/openmp/runtime/cmake/config-ix.cmake
+++ b/openmp/runtime/cmake/config-ix.cmake
@@ -58,7 +58,6 @@ check_cxx_compiler_flag(-Wstringop-overflow=0 LIBOMP_HAVE_WSTRINGOP_OVERFLOW_FLA
 check_cxx_compiler_flag(-Wno-stringop-truncation LIBOMP_HAVE_WNO_STRINGOP_TRUNCATION_FLAG)
 check_cxx_compiler_flag(-Wno-switch LIBOMP_HAVE_WNO_SWITCH_FLAG)
 check_cxx_compiler_flag(-Wno-uninitialized LIBOMP_HAVE_WNO_UNINITIALIZED_FLAG)
-check_cxx_compiler_flag(-Wno-unused-but-set-variable LIBOMP_HAVE_WNO_UNUSED_BUT_SET_VARIABLE_FLAG)
 check_cxx_compiler_flag(-Wno-return-type-c-linkage LIBOMP_HAVE_WNO_RETURN_TYPE_C_LINKAGE_FLAG)
 check_cxx_compiler_flag(-Wno-cast-qual LIBOMP_HAVE_WNO_CAST_QUAL_FLAG)
 check_cxx_compiler_flag(-Wno-int-to-void-pointer-cast LIBOMP_HAVE_WNO_INT_TO_VOID_POINTER_CAST_FLAG)

diff  --git a/openmp/runtime/src/kmp_affinity.cpp b/openmp/runtime/src/kmp_affinity.cpp
index 817b7ae881005..f9d3578c634f8 100644
--- a/openmp/runtime/src/kmp_affinity.cpp
+++ b/openmp/runtime/src/kmp_affinity.cpp
@@ -3301,7 +3301,6 @@ static bool __kmp_affinity_create_cpuinfo_map(int *line,
   for (i = 0; i < num_avail; ++i) {
     unsigned os = threadInfo[i][osIdIndex];
     int src_index;
-    int dst_index = 0;
     kmp_hw_thread_t &hw_thread = __kmp_topology->at(i);
     hw_thread.clear();
     hw_thread.os_id = os;
@@ -3318,7 +3317,6 @@ static bool __kmp_affinity_create_cpuinfo_map(int *line,
       } else if (src_index == threadIdIndex) {
         hw_thread.ids[threadLevel] = threadInfo[i][src_index];
       }
-      dst_index++;
     }
   }
 

diff  --git a/openmp/runtime/src/z_Linux_util.cpp b/openmp/runtime/src/z_Linux_util.cpp
index 9389dbe376025..6fd2f34a68da9 100644
--- a/openmp/runtime/src/z_Linux_util.cpp
+++ b/openmp/runtime/src/z_Linux_util.cpp
@@ -2242,8 +2242,9 @@ int __kmp_get_load_balance(int max) {
   int stat_file = -1;
   int stat_path_fixed_len;
 
+#ifdef KMP_DEBUG
   int total_processes = 0; // Total number of processes in system.
-  int total_threads = 0; // Total number of threads in system.
+#endif
 
   double call_time = 0.0;
 
@@ -2290,7 +2291,9 @@ int __kmp_get_load_balance(int max) {
     // process' directory.
     if (proc_entry->d_type == DT_DIR && isdigit(proc_entry->d_name[0])) {
 
+#ifdef KMP_DEBUG
       ++total_processes;
+#endif
       // Make sure init process is the very first in "/proc", so we can replace
       // strcmp( proc_entry->d_name, "1" ) == 0 with simpler total_processes ==
       // 1. We are going to check that total_processes == 1 => d_name == "1" is
@@ -2331,7 +2334,6 @@ int __kmp_get_load_balance(int max) {
         while (task_entry != NULL) {
           // It is a directory and name starts with a digit.
           if (proc_entry->d_type == DT_DIR && isdigit(task_entry->d_name[0])) {
-            ++total_threads;
 
             // Construct complete stat file path. Easiest way would be:
             //  __kmp_str_buf_print( & stat_path, "%s/%s/stat", task_path.str,


        


More information about the Openmp-commits mailing list