[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
This commit is contained in:
Martin Storsjö 2021-02-12 11:34:51 +02:00
parent 3f9519b768
commit b3d84790fa
5 changed files with 13 additions and 0 deletions

View File

@ -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;

View File

@ -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) \
}

View File

@ -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 {

View File

@ -4157,6 +4157,7 @@ public:
}
}
#else
(void)taskdata;
retval = *(kmp_int64 *)((char *)task + lower_offset);
#endif // defined(KMP_GOMP_COMPAT)
return retval;

View File

@ -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 */