From: Daniel Arndt Date: Wed, 12 Dec 2018 22:50:23 +0000 (+0100) Subject: Avoid C-style casts in cpu/compiler_feature checks X-Git-Tag: v9.1.0-rc1~493^2~3 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=03ea14365f811e39c4c328d38f96105821610a37;p=dealii.git Avoid C-style casts in cpu/compiler_feature checks --- 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)