Enable -Werror for GCC/Clang builds (#786)

* Enable -Werror for GCC/Clang builds

Fixes many of the errors this produces, and disables a handful that
didn't have solutions that were obvious (to me).

* Check for `-W*` flags empirically

* Remove cl_APPLE_fp64_basic_ops support

* Undo NAN conversion fix

* Add comments to warning override flags

* Remove unneeded STRINGIFY definition

* Fix tautological compare issue in basic

* Use ABS_ERROR macro in image tests

* Use fabs for ABS_ERROR macro

* Move ABS_ERROR definition to common header
This commit is contained in:
James Price
2020-05-27 14:13:11 -04:00
committed by GitHub
parent 094cc04e16
commit 944b0a8178
27 changed files with 398 additions and 367 deletions

View File

@@ -274,20 +274,16 @@ public:
if (CL_SUCCESS != error)
throw Exceptions::TestError("clGetSupportedImageFormats failed\n", error);
std::auto_ptr<cl_image_format> supportedFormats(new cl_image_format[actualNumFormats]);
error = clGetSupportedImageFormats(
context,
flags,
m_desc.image_type,
actualNumFormats,
supportedFormats.get(),
NULL);
std::vector<cl_image_format> supportedFormats(actualNumFormats);
error = clGetSupportedImageFormats(context, flags, m_desc.image_type,
actualNumFormats,
supportedFormats.data(), NULL);
if (CL_SUCCESS != error)
throw Exceptions::TestError("clGetSupportedImageFormats failed\n", error);
for (size_t i=0; i<actualNumFormats; ++i)
{
cl_image_format curFormat = supportedFormats.get()[i];
cl_image_format curFormat = supportedFormats[i];
if(imgFormat.image_channel_order == curFormat.image_channel_order &&
imgFormat.image_channel_data_type == curFormat.image_channel_data_type)

View File

@@ -147,8 +147,8 @@ static void get_spir_version(cl_device_id device, std::vector<float>& versions)
cl_int err;
size_t size = 0;
if (err = clGetDeviceInfo(device, CL_DEVICE_SPIR_VERSIONS, sizeof(version),
(void*)version, &size))
if ((err = clGetDeviceInfo(device, CL_DEVICE_SPIR_VERSIONS, sizeof(version),
(void *)version, &size)))
{
log_error( "Error: failed to obtain SPIR version at %s:%d (err = %d)\n",
__FILE__, __LINE__, err );

View File

@@ -268,7 +268,7 @@ static bool run_test(cl_context context, cl_command_queue queue, cl_program clpr
{
WorkSizeInfo ws;
TestResult cl_result;
std::auto_ptr<TestResult> bc_result;
std::unique_ptr<TestResult> bc_result;
// first, run the single CL test
{
// make sure that the kernel will be released before the program