From 03ea14365f811e39c4c328d38f96105821610a37 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Wed, 12 Dec 2018 23:50:23 +0100 Subject: [PATCH] Avoid C-style casts in cpu/compiler_feature checks --- cmake/checks/check_01_cpu_features.cmake | 24 +++++++++---------- cmake/checks/check_02_compiler_features.cmake | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cmake/checks/check_01_cpu_features.cmake b/cmake/checks/check_01_cpu_features.cmake index 5404df016c..f69c1ee268 100644 --- a/cmake/checks/check_01_cpu_features.cmake +++ b/cmake/checks/check_01_cpu_features.cmake @@ -87,14 +87,14 @@ IF(DEAL_II_ALLOW_PLATFORM_INTROSPECTION) __m128d * data = reinterpret_cast<__m128d*>(_mm_malloc (2*vector_bytes, vector_bytes)); double * ptr = reinterpret_cast(&a); - ptr[0] = (volatile double)(1.0); + ptr[0] = static_cast(1.0); for (int i=1; i(2.25)); data[0] = _mm_add_pd (a, b); data[1] = _mm_mul_pd (b, data[0]); ptr = reinterpret_cast(&data[1]); - unsigned int return_value = 0; + int return_value = 0; if (ptr[0] != 7.3125) return_value = 1; for (int i=1; i(_mm_malloc (2*vector_bytes, vector_bytes)); double * ptr = reinterpret_cast(&a); - ptr[0] = (volatile double)(1.0); + ptr[0] = static_cast(1.0); for (int i=1; i(2.25)); data[0] = _mm256_add_pd (a, b); data[1] = _mm256_mul_pd (b, data[0]); ptr = reinterpret_cast(&data[1]); - unsigned int return_value = 0; + int return_value = 0; if (ptr[0] != 7.3125) return_value = 1; for (int i=1; i(_mm_malloc (2*vector_bytes, vector_bytes)); double * ptr = reinterpret_cast(&a); - ptr[0] = (volatile double)(1.0); + ptr[0] = static_cast(1.0); for (int i=1; i(&data[1]); - unsigned int return_value = 0; + int return_value = 0; if (ptr[0] != 7.3125) return_value = 1; for (int i=1; i(&a); - ptr[0] = (volatile double)(1.0); + ptr[0] = static_cast(1.0); for (int i=1; i(2.25)); data1 = vec_add (a, b); data2 = vec_mul (b, data1); ptr = reinterpret_cast(&data2); - unsigned int return_value = 0; + int return_value = 0; if (ptr[0] != 7.3125) return_value += 1; for (int i=1; i(-1.0)); data1 = vec_abs(vec_mul (b, data2)); vec_vsx_st(data1, 0, ptr); b = vec_vsx_ld(0, ptr); diff --git a/cmake/checks/check_02_compiler_features.cmake b/cmake/checks/check_02_compiler_features.cmake index 984ed8ddd5..1b48a3c8d6 100644 --- a/cmake/checks/check_02_compiler_features.cmake +++ b/cmake/checks/check_02_compiler_features.cmake @@ -118,8 +118,8 @@ CHECK_CXX_COMPILER_BUG( # CHECK_CXX_SOURCE_COMPILES( " - bool f() {} - int main(){ if (__builtin_expect(f(),false)) ; } + bool f() { return true; } + int main(){ if (__builtin_expect(f(),false)) {} } " DEAL_II_HAVE_BUILTIN_EXPECT) -- 2.39.5