OpenMP RTL cleanup: eliminated warnings with -Wcast-qual.
Changes are: replaced C-style casts with cons_cast and reinterpret_cast;
type of several counters changed to signed; type of parameters of 32-bit and
64-bit AND and OR intrinsics changes to unsigned; changed files formatted
using clang-format version 3.8.1.
Differential Revision: https://reviews.llvm.org/D34759
llvm-svn: 307020
diff --git a/openmp/runtime/src/z_Linux_util.cpp b/openmp/runtime/src/z_Linux_util.cpp
index 914275a..e2643bf 100644
--- a/openmp/runtime/src/z_Linux_util.cpp
+++ b/openmp/runtime/src/z_Linux_util.cpp
@@ -1460,7 +1460,8 @@
th->th.th_active = FALSE;
if (th->th.th_active_in_pool) {
th->th.th_active_in_pool = FALSE;
- KMP_TEST_THEN_DEC32((kmp_int32 *)&__kmp_thread_pool_active_nth);
+ KMP_TEST_THEN_DEC32(
+ CCAST(kmp_int32 *, &__kmp_thread_pool_active_nth));
KMP_DEBUG_ASSERT(TCR_4(__kmp_thread_pool_active_nth) >= 0);
}
deactivated = TRUE;
@@ -1516,7 +1517,7 @@
if (deactivated) {
th->th.th_active = TRUE;
if (TCR_4(th->th.th_in_pool)) {
- KMP_TEST_THEN_INC32((kmp_int32 *)&__kmp_thread_pool_active_nth);
+ KMP_TEST_THEN_INC32(CCAST(kmp_int32 *, &__kmp_thread_pool_active_nth));
th->th.th_active_in_pool = TRUE;
}
}
@@ -1568,7 +1569,7 @@
KMP_CHECK_SYSFAIL("pthread_mutex_lock", status);
if (!flag) { // coming from __kmp_null_resume_wrapper
- flag = (C *)th->th.th_sleep_loc;
+ flag = (C *)CCAST(void *, th->th.th_sleep_loc);
}
// First, check if the flag is null or its type has changed. If so, someone
@@ -1801,8 +1802,8 @@
mach_msg_type_number_t num = HOST_BASIC_INFO_COUNT;
rc = host_info(mach_host_self(), HOST_BASIC_INFO, (host_info_t)&info, &num);
if (rc == 0 && num == HOST_BASIC_INFO_COUNT) {
-// Cannot use KA_TRACE() here because this code works before trace support is
-// initialized.
+ // Cannot use KA_TRACE() here because this code works before trace support
+ // is initialized.
r = info.avail_cpus;
} else {
KMP_WARNING(CantGetNumAvailCPU);
@@ -2315,7 +2316,8 @@
#endif // USE_LOAD_BALANCE
-#if !(KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_MIC || ((KMP_OS_LINUX || KMP_OS_DARWIN) && KMP_ARCH_AARCH64) || KMP_ARCH_PPC64)
+#if !(KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_MIC || \
+ ((KMP_OS_LINUX || KMP_OS_DARWIN) && KMP_ARCH_AARCH64) || KMP_ARCH_PPC64)
// we really only need the case with 1 argument, because CLANG always build
// a struct of pointers to shared variables referenced in the outlined function