[NFC] Fix some sign-compare warnings (#1670)

In `os_helpers.cpp`, the preceding `if` already handles negative
values, so cast to unsigned.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
This commit is contained in:
Sven van Haastregt
2023-03-12 11:06:55 +00:00
committed by GitHub
parent 5297ecd673
commit 9798a96a9f
5 changed files with 8 additions and 10 deletions

View File

@@ -283,7 +283,7 @@ std::string exe_path()
exit(2); exit(2);
}; // if }; // if
if (len < path.size()) if (static_cast<size_t>(len) < path.size())
{ {
// We got the path. // We got the path.
path.resize(len); path.resize(len);

View File

@@ -1362,8 +1362,7 @@ int test_computeinfo(cl_device_id deviceID, cl_context context,
else else
{ {
// print device info // print device info
int onInfo; for (size_t onInfo = 0;
for (onInfo = 0;
onInfo < sizeof(device_infos) / sizeof(device_infos[0]); onInfo++) onInfo < sizeof(device_infos) / sizeof(device_infos[0]); onInfo++)
{ {
log_info("Getting device IDs for %s devices\n", log_info("Getting device IDs for %s devices\n",
@@ -1390,9 +1389,8 @@ int test_computeinfo(cl_device_id deviceID, cl_context context,
test_error(err, "clGetDeviceIDs failed"); test_error(err, "clGetDeviceIDs failed");
} }
int onDevice; for (size_t onDevice = 0;
for (onDevice = 0; onDevice < device_infos[onInfo].num_devices; onDevice < device_infos[onInfo].num_devices; onDevice++)
onDevice++)
{ {
log_info("%s Device %d of %d Info:\n", log_info("%s Device %d of %d Info:\n",
device_infos[onInfo].device_type_name, onDevice + 1, device_infos[onInfo].device_type_name, onDevice + 1,

View File

@@ -390,7 +390,7 @@ int test_device_partition_type_support(cl_device_id parentDevice, const cl_devic
} else { } else {
test_error_ret( err, "Unable to get device partition properties (1)", -1 ); test_error_ret( err, "Unable to get device partition properties (1)", -1 );
}; };
for ( int i = 0; i < supportedProps.size(); i++) for (size_t i = 0; i < supportedProps.size(); i++)
{ {
if (supportedProps[i] == partitionType) if (supportedProps[i] == partitionType)
{ {

View File

@@ -6890,7 +6890,7 @@ int main (int argc, const char* argv[])
cl_uint size_t_width = 0; // device address bits (32 or 64). cl_uint size_t_width = 0; // device address bits (32 or 64).
cl_int err; cl_int err;
int failed = 0; int failed = 0;
int ntests = 0; size_t ntests = 0;
custom_cout atf_info; custom_cout atf_info;
custom_cerr atf_error; custom_cerr atf_error;
override_buff atf_cout(std::cout, atf_info); override_buff atf_cout(std::cout, atf_info);

View File

@@ -41,7 +41,7 @@ TEST_SPIRV_FUNC(get_program_il)
std::vector<unsigned char> spirv_binary = readSPIRV(spvName); std::vector<unsigned char> spirv_binary = readSPIRV(spvName);
int file_bytes = spirv_binary.size(); size_t file_bytes = spirv_binary.size();
if (file_bytes == 0) if (file_bytes == 0)
{ {
test_fail("ERROR: SPIRV file %s not found!\n", spvName); test_fail("ERROR: SPIRV file %s not found!\n", spvName);
@@ -102,4 +102,4 @@ TEST_SPIRV_FUNC(get_program_il)
} }
return 0; return 0;
} }