diff --git a/CMakeLists.txt b/CMakeLists.txt index 5cfef6b332..6037c6b888 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,7 +104,6 @@ if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?Clang" # Enable more warnings if not doing a release build. add_cxx_flag_if_supported(-Wall) endif() - add_cxx_flag_if_supported(-Wno-narrowing) add_cxx_flag_if_supported(-Wno-format) add_cxx_flag_if_supported(-Wno-error=cpp) # Allow #warning directive add_cxx_flag_if_supported(-Wno-unknown-pragmas) # Issue #785 diff --git a/test_common/harness/kernelHelpers.cpp b/test_common/harness/kernelHelpers.cpp index 633b05e5c7..7aadda1b73 100644 --- a/test_common/harness/kernelHelpers.cpp +++ b/test_common/harness/kernelHelpers.cpp @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 The Khronos Group Inc. +// Copyright (c) 2017, 2021 The Khronos Group Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -1626,7 +1626,7 @@ Version get_device_cl_c_version(cl_device_id device) &opencl_c_version_size_in_bytes); test_error_ret(error, "clGetDeviceInfo failed for CL_DEVICE_OPENCL_C_VERSION\n", - (Version{ -1, 0 })); + (Version{ 0, 0 })); std::string opencl_c_version(opencl_c_version_size_in_bytes, '\0'); error = @@ -1635,13 +1635,13 @@ Version get_device_cl_c_version(cl_device_id device) test_error_ret(error, "clGetDeviceInfo failed for CL_DEVICE_OPENCL_C_VERSION\n", - (Version{ -1, 0 })); + (Version{ 0, 0 })); // Scrape out the major, minor pair from the string. auto major = opencl_c_version[opencl_c_version.find('.') - 1]; auto minor = opencl_c_version[opencl_c_version.find('.') + 1]; - return Version{ major - '0', minor - '0' }; + return Version{ (uint)(major - '0'), (uint)(minor - '0') }; } Version get_device_latest_cl_c_version(cl_device_id device) @@ -1659,7 +1659,7 @@ Version get_device_latest_cl_c_version(cl_device_id device) &opencl_c_all_versions_size_in_bytes); test_error_ret( error, "clGetDeviceInfo failed for CL_DEVICE_OPENCL_C_ALL_VERSIONS", - (Version{ -1, 0 })); + (Version{ 0, 0 })); std::vector name_versions( opencl_c_all_versions_size_in_bytes / sizeof(cl_name_version)); error = clGetDeviceInfo(device, CL_DEVICE_OPENCL_C_ALL_VERSIONS, @@ -1667,7 +1667,7 @@ Version get_device_latest_cl_c_version(cl_device_id device) name_versions.data(), nullptr); test_error_ret( error, "clGetDeviceInfo failed for CL_DEVICE_OPENCL_C_ALL_VERSIONS", - (Version{ -1, 0 })); + (Version{ 0, 0 })); Version max_supported_cl_c_version{}; for (const auto &name_version : name_versions) @@ -1695,7 +1695,7 @@ Version get_max_OpenCL_C_for_context(cl_context context) auto error = clGetContextInfo(context, CL_CONTEXT_DEVICES, 0, nullptr, &devices_size_in_bytes); test_error_ret(error, "clGetDeviceInfo failed for CL_CONTEXT_DEVICES", - (Version{ -1, 0 })); + (Version{ 0, 0 })); std::vector devices(devices_size_in_bytes / sizeof(cl_device_id)); error = clGetContextInfo(context, CL_CONTEXT_DEVICES, devices_size_in_bytes, diff --git a/test_common/harness/rounding_mode.cpp b/test_common/harness/rounding_mode.cpp index 191c04d929..cb13db6b47 100644 --- a/test_common/harness/rounding_mode.cpp +++ b/test_common/harness/rounding_mode.cpp @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 The Khronos Group Inc. +// Copyright (c) 2017, 2021 The Khronos Group Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -240,7 +240,7 @@ void UnFlushToZero(void *p) #if defined(__i386__) || defined(__x86_64__) || defined(_MSC_VER) union { void *p; - int i; + uint i; } u = { p }; _mm_setcsr(u.i); #elif defined(__arm__) || defined(__aarch64__) diff --git a/test_common/harness/testHarness.h b/test_common/harness/testHarness.h index b266db80f4..fd36bda0d4 100644 --- a/test_common/harness/testHarness.h +++ b/test_common/harness/testHarness.h @@ -1,5 +1,5 @@ // -// Copyright (c) 2017-2019 The Khronos Group Inc. +// Copyright (c) 2017-2021 The Khronos Group Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ class Version { public: Version(): m_major(0), m_minor(0) {} - Version(int major, int minor): m_major(major), m_minor(minor) {} + Version(uint major, uint minor): m_major(major), m_minor(minor) {} bool operator>(const Version &rhs) const { return to_int() > rhs.to_int(); } bool operator<(const Version &rhs) const { return to_int() < rhs.to_int(); } bool operator<=(const Version &rhs) const @@ -49,8 +49,8 @@ class Version { } private: - int m_major; - int m_minor; + uint m_major; + uint m_minor; }; Version get_device_cl_version(cl_device_id device); diff --git a/test_conformance/CMakeLists.txt b/test_conformance/CMakeLists.txt index 1f1970afd8..498f3a3d06 100644 --- a/test_conformance/CMakeLists.txt +++ b/test_conformance/CMakeLists.txt @@ -1,6 +1,10 @@ # Remember current source directory (`test_conformance'). set( CLConf_Install_Base_Dir "${CMAKE_CURRENT_SOURCE_DIR}" ) +if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?Clang") + add_cxx_flag_if_supported(-Wno-narrowing) +endif() + set(HARNESS_LIB harness) add_subdirectory( allocations )