[Openmp-commits] [openmp] b3d8479 - [OpenMP] Add void casts to silence unused variable warnings
Martin Storsjö via Openmp-commits
openmp-commits at lists.llvm.org
Fri Feb 12 11:56:15 PST 2021
Author: Martin Storsjö
Date: 2021-02-12T21:55:31+02:00
New Revision: b3d84790faadaff95bd32ae9950205e044f6fce0
URL: https://github.com/llvm/llvm-project/commit/b3d84790faadaff95bd32ae9950205e044f6fce0
DIFF: https://github.com/llvm/llvm-project/commit/b3d84790faadaff95bd32ae9950205e044f6fce0.diff
LOG: [OpenMP] Add void casts to silence unused variable warnings
These variables are used only in certain build configurations,
or marked with a todo comment indicating that they should be
used/checked/reported.
Differential Revision: https://reviews.llvm.org/D96582
Added:
Modified:
openmp/runtime/src/kmp_affinity.cpp
openmp/runtime/src/kmp_atomic.cpp
openmp/runtime/src/kmp_io.cpp
openmp/runtime/src/kmp_tasking.cpp
openmp/runtime/src/z_Windows_NT_util.cpp
Removed:
################################################################################
diff --git a/openmp/runtime/src/kmp_affinity.cpp b/openmp/runtime/src/kmp_affinity.cpp
index a94dbd1e0c35..2fff2c88d271 100644
--- a/openmp/runtime/src/kmp_affinity.cpp
+++ b/openmp/runtime/src/kmp_affinity.cpp
@@ -5059,6 +5059,7 @@ int __kmp_aux_get_affinity(void **mask) {
return retval;
#else
+ (void)retval;
KMP_CPU_COPY((kmp_affin_mask_t *)(*mask), th->th.th_affin_mask);
return 0;
diff --git a/openmp/runtime/src/kmp_atomic.cpp b/openmp/runtime/src/kmp_atomic.cpp
index a9d5257ab2aa..99b4e84dc5ef 100644
--- a/openmp/runtime/src/kmp_atomic.cpp
+++ b/openmp/runtime/src/kmp_atomic.cpp
@@ -2253,6 +2253,7 @@ ATOMIC_CRITICAL_WR(cmplx16, a16_wr, kmp_cmplx128_a16_t, =, 32c,
#define ATOMIC_CMPXCHG_CPT(TYPE_ID, OP_ID, TYPE, BITS, OP, GOMP_FLAG) \
ATOMIC_BEGIN_CPT(TYPE_ID, OP_ID, TYPE, TYPE) \
TYPE new_value; \
+ (void)new_value; \
OP_GOMP_CRITICAL_CPT(TYPE, OP, GOMP_FLAG) \
OP_CMPXCHG_CPT(TYPE, BITS, OP) \
}
@@ -2261,6 +2262,7 @@ ATOMIC_CRITICAL_WR(cmplx16, a16_wr, kmp_cmplx128_a16_t, =, 32c,
#define ATOMIC_FIXED_ADD_CPT(TYPE_ID, OP_ID, TYPE, BITS, OP, GOMP_FLAG) \
ATOMIC_BEGIN_CPT(TYPE_ID, OP_ID, TYPE, TYPE) \
TYPE old_value, new_value; \
+ (void)new_value; \
OP_GOMP_CRITICAL_CPT(TYPE, OP, GOMP_FLAG) \
/* OP used as a sign for subtraction: (lhs-rhs) --> (lhs+-rhs) */ \
old_value = KMP_TEST_THEN_ADD##BITS(lhs, OP rhs); \
@@ -2561,6 +2563,7 @@ ATOMIC_CRITICAL_CPT_MIX(float10, long double, div_cpt, /, fp, _Quad, 10r,
#define ATOMIC_CMPX_L_CPT(TYPE_ID, OP_ID, TYPE, BITS, OP, GOMP_FLAG) \
ATOMIC_BEGIN_CPT(TYPE_ID, OP_ID, TYPE, TYPE) \
TYPE new_value; \
+ (void)new_value; \
OP_GOMP_CRITICAL_L_CPT(= *lhs OP, GOMP_FLAG) \
OP_CMPXCHG_CPT(TYPE, BITS, OP) \
}
@@ -2655,6 +2658,7 @@ ATOMIC_CMPX_L_CPT(fixed8, orl_cpt, kmp_int64, 64, ||,
#define MIN_MAX_COMPXCHG_CPT(TYPE_ID, OP_ID, TYPE, BITS, OP, GOMP_FLAG) \
ATOMIC_BEGIN_CPT(TYPE_ID, OP_ID, TYPE, TYPE) \
TYPE new_value, old_value; \
+ (void)new_value; \
if (*lhs OP rhs) { \
GOMP_MIN_MAX_CRITSECT_CPT(OP, GOMP_FLAG) \
MIN_MAX_CMPXCHG_CPT(TYPE, BITS, OP) \
@@ -2713,6 +2717,7 @@ MIN_MAX_CRITICAL_CPT(float16, min_a16_cpt, Quad_a16_t, >, 16r,
#define ATOMIC_CMPX_EQV_CPT(TYPE_ID, OP_ID, TYPE, BITS, OP, GOMP_FLAG) \
ATOMIC_BEGIN_CPT(TYPE_ID, OP_ID, TYPE, TYPE) \
TYPE new_value; \
+ (void)new_value; \
OP_GOMP_CRITICAL_EQV_CPT(^= (TYPE) ~, GOMP_FLAG) /* send assignment */ \
OP_CMPXCHG_CPT(TYPE, BITS, OP) \
}
@@ -2941,6 +2946,7 @@ ATOMIC_CRITICAL_CPT(cmplx16, div_a16_cpt, kmp_cmplx128_a16_t, /, 32c,
#define ATOMIC_CMPXCHG_CPT_REV(TYPE_ID, OP_ID, TYPE, BITS, OP, GOMP_FLAG) \
ATOMIC_BEGIN_CPT(TYPE_ID, OP_ID, TYPE, TYPE) \
TYPE new_value; \
+ (void)new_value; \
OP_GOMP_CRITICAL_CPT_REV(TYPE, OP, GOMP_FLAG) \
OP_CMPXCHG_CPT_REV(TYPE, BITS, OP) \
}
@@ -3261,6 +3267,7 @@ ATOMIC_CRITICAL_CPT_REV_MIX(float10, long double, div_cpt_rev, /, fp, _Quad,
#define ATOMIC_CMPXCHG_SWP(TYPE_ID, TYPE, BITS, GOMP_FLAG) \
ATOMIC_BEGIN_SWP(TYPE_ID, TYPE) \
TYPE old_value; \
+ (void)old_value; \
GOMP_CRITICAL_SWP(GOMP_FLAG) \
CMPXCHG_SWP(TYPE, BITS) \
}
diff --git a/openmp/runtime/src/kmp_io.cpp b/openmp/runtime/src/kmp_io.cpp
index 4e6ea6a38a33..2379162c209c 100644
--- a/openmp/runtime/src/kmp_io.cpp
+++ b/openmp/runtime/src/kmp_io.cpp
@@ -101,6 +101,7 @@ static void __kmp_redirect_output(void) {
DWORD err = GetLastError();
// TODO: output error somehow (maybe message box)
+ (void)err;
__kmp_stdout = NULL;
} else {
@@ -112,6 +113,7 @@ static void __kmp_redirect_output(void) {
DWORD err = GetLastError();
// TODO: output error somehow (maybe message box)
+ (void)err;
__kmp_stderr = NULL;
} else {
diff --git a/openmp/runtime/src/kmp_tasking.cpp b/openmp/runtime/src/kmp_tasking.cpp
index 876cd2505c77..dde7a9640ef3 100644
--- a/openmp/runtime/src/kmp_tasking.cpp
+++ b/openmp/runtime/src/kmp_tasking.cpp
@@ -4157,6 +4157,7 @@ class kmp_taskloop_bounds_t {
}
}
#else
+ (void)taskdata;
retval = *(kmp_int64 *)((char *)task + lower_offset);
#endif // defined(KMP_GOMP_COMPAT)
return retval;
diff --git a/openmp/runtime/src/z_Windows_NT_util.cpp b/openmp/runtime/src/z_Windows_NT_util.cpp
index 2e9484b2d175..429ffb6c2a2e 100644
--- a/openmp/runtime/src/z_Windows_NT_util.cpp
+++ b/openmp/runtime/src/z_Windows_NT_util.cpp
@@ -671,6 +671,7 @@ void __kmp_runtime_initialize(void) {
BOOL ret = GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
GET_MODULE_HANDLE_EX_FLAG_PIN,
(LPCTSTR)&__kmp_serial_initialize, &h);
+ (void)ret;
KMP_DEBUG_ASSERT2(h && ret, "OpenMP RTL cannot find itself loaded");
SetErrorMode(err_mode); // Restore error mode
KA_TRACE(10, ("__kmp_runtime_initialize: dynamic library pinned\n"));
@@ -830,6 +831,7 @@ void __kmp_runtime_initialize(void) {
__kmp_xproc = info.dwNumberOfProcessors;
}
#else
+ (void)kernel32;
GetSystemInfo(&info);
__kmp_xproc = info.dwNumberOfProcessors;
#endif /* KMP_GROUP_AFFINITY */
More information about the Openmp-commits
mailing list