Fix warnings in basic suite (#782)

* Fix "ignored typedef" warning

* Fix "returning reference to temporary" warning
This commit is contained in:
James Price
2020-05-20 15:16:18 -04:00
committed by GitHub
parent fe12c4e378
commit 09aa54246f
2 changed files with 7 additions and 6 deletions

View File

@@ -37,6 +37,7 @@
// TODO: pointer-to-half (and its vectors) // TODO: pointer-to-half (and its vectors)
// TODO: union of... // TODO: union of...
#include <algorithm>
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
@@ -595,11 +596,11 @@ static int l_build_type_table(cl_device_id device)
static const TypeInfo& l_find_type( const char* name ) static const TypeInfo& l_find_type( const char* name )
{ {
for ( size_t i = 0; i < num_type_info ; i++ ) { auto itr =
if ( 0 == strcmp( name, type_info[i].get_name_c_str() ) ) return type_info[i]; std::find_if(type_info, type_info + num_type_info,
} [name](TypeInfo& ti) { return ti.get_name() == name; });
assert(0); assert(itr != type_info + num_type_info);
return TypeInfo(); return *itr;
} }

View File

@@ -26,7 +26,7 @@
#include "harness/conversions.h" #include "harness/conversions.h"
#include "harness/typeWrappers.h" #include "harness/typeWrappers.h"
typedef struct work_item_data struct work_item_data
{ {
cl_uint workDim; cl_uint workDim;
cl_uint globalSize[ 3 ]; cl_uint globalSize[ 3 ];