From 080f5081e8e84b6ff57570edc500a60f1e89a152 Mon Sep 17 00:00:00 2001 From: Ben Ashbaugh Date: Wed, 23 Oct 2024 21:33:26 -0700 Subject: [PATCH] remove using namespace std and use std namespace explicitly --- test_common/harness/parseParameters.cpp | 2 -- test_conformance/api/test_clone_kernel.cpp | 2 -- test_conformance/api/test_queue_hint.cpp | 5 ----- .../api/test_queue_properties.cpp | 1 - test_conformance/gl/test_image_methods.cpp | 17 +++++++-------- test_conformance/gl/test_images_1D.cpp | 6 ++---- test_conformance/gl/test_images_1Darray.cpp | 5 ++--- test_conformance/gl/test_images_2D.cpp | 14 +++++-------- test_conformance/gl/test_images_2Darray.cpp | 8 +++---- test_conformance/gl/test_images_3D.cpp | 11 +++------- test_conformance/gl/test_images_depth.cpp | 21 ++++++++----------- .../gl/test_images_multisample.cpp | 12 +++++------ test_conformance/spirv_new/main.cpp | 7 +++---- 13 files changed, 40 insertions(+), 71 deletions(-) diff --git a/test_common/harness/parseParameters.cpp b/test_common/harness/parseParameters.cpp index 2fc31d26ea..2949938114 100644 --- a/test_common/harness/parseParameters.cpp +++ b/test_common/harness/parseParameters.cpp @@ -25,8 +25,6 @@ #include #include -using namespace std; - #define DEFAULT_COMPILATION_PROGRAM "cl_offline_compiler" #define DEFAULT_SPIRV_VALIDATOR "spirv-val" diff --git a/test_conformance/api/test_clone_kernel.cpp b/test_conformance/api/test_clone_kernel.cpp index cc95c9b055..8cf88b3fc4 100644 --- a/test_conformance/api/test_clone_kernel.cpp +++ b/test_conformance/api/test_clone_kernel.cpp @@ -20,8 +20,6 @@ #include #include -using namespace std; - const char *clone_kernel_test_img[] = { "__kernel void img_read_kernel(read_only image2d_t img, sampler_t sampler, __global int* outbuf)\n" diff --git a/test_conformance/api/test_queue_hint.cpp b/test_conformance/api/test_queue_hint.cpp index 558ca1aa3f..8e9b686980 100644 --- a/test_conformance/api/test_queue_hint.cpp +++ b/test_conformance/api/test_queue_hint.cpp @@ -19,11 +19,6 @@ #include #include -using namespace std; -/* - -*/ - const char *queue_hint_test_kernel[] = { "__kernel void vec_cpy(__global int *src, __global int *dst)\n" "{\n" diff --git a/test_conformance/api/test_queue_properties.cpp b/test_conformance/api/test_queue_properties.cpp index 768bd5deab..a60211a2ec 100644 --- a/test_conformance/api/test_queue_properties.cpp +++ b/test_conformance/api/test_queue_properties.cpp @@ -22,7 +22,6 @@ #include #include -using namespace std; /* The test against cl_khr_create_command_queue extension. It validates if devices with Opencl 1.X can use clCreateCommandQueueWithPropertiesKHR function. Based on device capabilities test will create queue with NULL properties, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE property and diff --git a/test_conformance/gl/test_image_methods.cpp b/test_conformance/gl/test_image_methods.cpp index 1bf8f561f5..66db163b1f 100644 --- a/test_conformance/gl/test_image_methods.cpp +++ b/test_conformance/gl/test_image_methods.cpp @@ -17,8 +17,6 @@ #include -using namespace std; - struct image_kernel_data { cl_int width; @@ -383,17 +381,18 @@ int test_image_methods_depth(cl_device_id device, cl_context context, glGetIntegerv(GL_MAX_RECTANGLE_TEXTURE_SIZE_EXT, &maxTextureRectangleSize); glGetIntegerv(GL_MAX_ARRAY_TEXTURE_LAYERS, &maxTextureLayers); - size = min(maxTextureSize, maxTextureRectangleSize); + size = std::min(maxTextureSize, maxTextureRectangleSize); RandomSeed seed(gRandomSeed); // Generate some random sizes (within reasonable ranges) for (size_t i = 0; i < nsizes; i++) { - sizes[i].width = random_in_range(2, min(size, 1 << (i + 4)), seed); - sizes[i].height = random_in_range(2, min(size, 1 << (i + 4)), seed); + sizes[i].width = random_in_range(2, std::min(size, 1 << (i + 4)), seed); + sizes[i].height = + random_in_range(2, std::min(size, 1 << (i + 4)), seed); sizes[i].depth = - random_in_range(2, min(maxTextureLayers, 1 << (i + 4)), seed); + random_in_range(2, std::min(maxTextureLayers, 1 << (i + 4)), seed); } for (size_t i = 0; i < nsizes; i++) @@ -440,11 +439,11 @@ int test_image_methods_multisample(cl_device_id device, cl_context context, for (size_t i = 0; i < nsizes; i++) { sizes[i].width = - random_in_range(2, min(maxTextureSize, 1 << (i + 4)), seed); + random_in_range(2, std::min(maxTextureSize, 1 << (i + 4)), seed); sizes[i].height = - random_in_range(2, min(maxTextureSize, 1 << (i + 4)), seed); + random_in_range(2, std::min(maxTextureSize, 1 << (i + 4)), seed); sizes[i].depth = - random_in_range(2, min(maxTextureLayers, 1 << (i + 4)), seed); + random_in_range(2, std::min(maxTextureLayers, 1 << (i + 4)), seed); } glEnable(GL_MULTISAMPLE); diff --git a/test_conformance/gl/test_images_1D.cpp b/test_conformance/gl/test_images_1D.cpp index 4ccf86bccf..895e13a751 100644 --- a/test_conformance/gl/test_images_1D.cpp +++ b/test_conformance/gl/test_images_1D.cpp @@ -24,8 +24,6 @@ #endif #include -using namespace std; - void calc_test_size_descriptors(sizevec_t* sizes, size_t nsizes) { // Need to limit array size according to GL device properties @@ -33,14 +31,14 @@ void calc_test_size_descriptors(sizevec_t* sizes, size_t nsizes) glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize); glGetIntegerv(GL_MAX_TEXTURE_BUFFER_SIZE, &maxTextureBufferSize); - size = min(maxTextureSize, maxTextureBufferSize); + size = std::min(maxTextureSize, maxTextureBufferSize); RandomSeed seed(gRandomSeed); // Generate some random sizes (within reasonable ranges) for (size_t i = 0; i < nsizes; i++) { - sizes[i].width = random_in_range(2, min(size, 1 << (i + 4)), seed); + sizes[i].width = random_in_range(2, std::min(size, 1 << (i + 4)), seed); sizes[i].height = 1; sizes[i].depth = 1; } diff --git a/test_conformance/gl/test_images_1Darray.cpp b/test_conformance/gl/test_images_1Darray.cpp index daa2efa8b1..d64e840462 100644 --- a/test_conformance/gl/test_images_1Darray.cpp +++ b/test_conformance/gl/test_images_1Darray.cpp @@ -24,7 +24,6 @@ #endif #include -using namespace std; void calc_1D_array_size_descriptors(sizevec_t* sizes, size_t nsizes) { // Need to limit array size according to GL device properties @@ -38,9 +37,9 @@ void calc_1D_array_size_descriptors(sizevec_t* sizes, size_t nsizes) for (size_t i = 0; i < nsizes; i++) { sizes[i].width = - random_in_range(2, min(maxTextureSize, 1 << (i + 4)), seed); + random_in_range(2, std::min(maxTextureSize, 1 << (i + 4)), seed); sizes[i].height = - random_in_range(2, min(maxTextureLayers, 1 << (i + 4)), seed); + random_in_range(2, std::min(maxTextureLayers, 1 << (i + 4)), seed); sizes[i].depth = 1; } } diff --git a/test_conformance/gl/test_images_2D.cpp b/test_conformance/gl/test_images_2D.cpp index 63ea31e2fd..cbdf3b9af3 100644 --- a/test_conformance/gl/test_images_2D.cpp +++ b/test_conformance/gl/test_images_2D.cpp @@ -24,11 +24,6 @@ #endif #include -using namespace std; - -#pragma mark - -#pragma mark _2D read tests - void calc_2D_test_size_descriptors(sizevec_t* sizes, size_t nsizes) { // Need to limit array size according to GL device properties @@ -37,15 +32,16 @@ void calc_2D_test_size_descriptors(sizevec_t* sizes, size_t nsizes) glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize); glGetIntegerv(GL_MAX_RECTANGLE_TEXTURE_SIZE_EXT, &maxTextureRectangleSize); - size = min(maxTextureSize, maxTextureRectangleSize); + size = std::min(maxTextureSize, maxTextureRectangleSize); RandomSeed seed(gRandomSeed); // Generate some random sizes (within reasonable ranges) for (size_t i = 0; i < nsizes; i++) { - sizes[i].width = random_in_range(2, min(size, 1 << (i + 4)), seed); - sizes[i].height = random_in_range(2, min(size, 1 << (i + 4)), seed); + sizes[i].width = random_in_range(2, std::min(size, 1 << (i + 4)), seed); + sizes[i].height = + random_in_range(2, std::min(size, 1 << (i + 4)), seed); sizes[i].depth = 1; } } @@ -63,7 +59,7 @@ void calc_cube_test_size_descriptors(sizevec_t* sizes, size_t nsizes) for (size_t i = 0; i < nsizes; i++) { sizes[i].width = sizes[i].height = - random_in_range(2, min(maxQubeMapSize, 1 << (i + 4)), seed); + random_in_range(2, std::min(maxQubeMapSize, 1 << (i + 4)), seed); sizes[i].depth = 1; } } diff --git a/test_conformance/gl/test_images_2Darray.cpp b/test_conformance/gl/test_images_2Darray.cpp index 20ca71447c..c851ca302b 100644 --- a/test_conformance/gl/test_images_2Darray.cpp +++ b/test_conformance/gl/test_images_2Darray.cpp @@ -24,8 +24,6 @@ #endif #include -using namespace std; - void calc_2D_array_size_descriptors(sizevec_t* sizes, size_t nsizes) { // Need to limit array size according to GL device properties @@ -39,11 +37,11 @@ void calc_2D_array_size_descriptors(sizevec_t* sizes, size_t nsizes) for (size_t i = 0; i < nsizes; i++) { sizes[i].width = - random_in_range(2, min(maxTextureSize, 1 << (i + 4)), seed); + random_in_range(2, std::min(maxTextureSize, 1 << (i + 4)), seed); sizes[i].height = - random_in_range(2, min(maxTextureSize, 1 << (i + 4)), seed); + random_in_range(2, std::min(maxTextureSize, 1 << (i + 4)), seed); sizes[i].depth = - random_in_range(2, min(maxTextureLayers, 1 << (i + 4)), seed); + random_in_range(2, std::min(maxTextureLayers, 1 << (i + 4)), seed); } } diff --git a/test_conformance/gl/test_images_3D.cpp b/test_conformance/gl/test_images_3D.cpp index 220cd0ca04..68036a1a22 100644 --- a/test_conformance/gl/test_images_3D.cpp +++ b/test_conformance/gl/test_images_3D.cpp @@ -24,11 +24,6 @@ #endif #include -using namespace std; - -#pragma mark - -#pragma mark _3D read test - void calc_3D_size_descriptors(sizevec_t* sizes, size_t nsizes) { // Need to limit array size according to GL device properties @@ -41,11 +36,11 @@ void calc_3D_size_descriptors(sizevec_t* sizes, size_t nsizes) for (size_t i = 0; i < nsizes; i++) { sizes[i].width = - random_in_range(2, min(maxTextureSize, 1 << (i + 4)), seed); + random_in_range(2, std::min(maxTextureSize, 1 << (i + 4)), seed); sizes[i].height = - random_in_range(2, min(maxTextureSize, 1 << (i + 4)), seed); + random_in_range(2, std::min(maxTextureSize, 1 << (i + 4)), seed); sizes[i].depth = - random_in_range(2, min(maxTextureSize, 1 << (i + 4)), seed); + random_in_range(2, std::min(maxTextureSize, 1 << (i + 4)), seed); } } diff --git a/test_conformance/gl/test_images_depth.cpp b/test_conformance/gl/test_images_depth.cpp index 05265cc62d..743d004fce 100644 --- a/test_conformance/gl/test_images_depth.cpp +++ b/test_conformance/gl/test_images_depth.cpp @@ -25,11 +25,6 @@ #include -using namespace std; - -#pragma mark - -#pragma mark _2D depth read tests - void calc_depth_size_descriptors(sizevec_t* sizes, size_t nsizes) { // Need to limit texture size according to GL device properties @@ -37,15 +32,16 @@ void calc_depth_size_descriptors(sizevec_t* sizes, size_t nsizes) glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize); glGetIntegerv(GL_MAX_RECTANGLE_TEXTURE_SIZE_EXT, &maxTextureRectangleSize); - size = min(maxTextureSize, maxTextureRectangleSize); + size = std::min(maxTextureSize, maxTextureRectangleSize); RandomSeed seed(gRandomSeed); // Generate some random sizes (within reasonable ranges) for (size_t i = 0; i < nsizes; i++) { - sizes[i].width = random_in_range(2, min(size, 1 << (i + 4)), seed); - sizes[i].height = random_in_range(2, min(size, 1 << (i + 4)), seed); + sizes[i].width = random_in_range(2, std::min(size, 1 << (i + 4)), seed); + sizes[i].height = + random_in_range(2, std::min(size, 1 << (i + 4)), seed); sizes[i].depth = 1; } } @@ -59,17 +55,18 @@ void calc_depth_array_size_descriptors(sizevec_t* sizes, size_t nsizes) glGetIntegerv(GL_MAX_RECTANGLE_TEXTURE_SIZE_EXT, &maxTextureRectangleSize); glGetIntegerv(GL_MAX_ARRAY_TEXTURE_LAYERS, &maxTextureLayers); - size = min(maxTextureSize, maxTextureRectangleSize); + size = std::min(maxTextureSize, maxTextureRectangleSize); RandomSeed seed(gRandomSeed); // Generate some random sizes (within reasonable ranges) for (size_t i = 0; i < nsizes; i++) { - sizes[i].width = random_in_range(2, min(size, 1 << (i + 4)), seed); - sizes[i].height = random_in_range(2, min(size, 1 << (i + 4)), seed); + sizes[i].width = random_in_range(2, std::min(size, 1 << (i + 4)), seed); + sizes[i].height = + random_in_range(2, std::min(size, 1 << (i + 4)), seed); sizes[i].depth = - random_in_range(2, min(maxTextureLayers, 1 << (i + 4)), seed); + random_in_range(2, std::min(maxTextureLayers, 1 << (i + 4)), seed); } } diff --git a/test_conformance/gl/test_images_multisample.cpp b/test_conformance/gl/test_images_multisample.cpp index bfb04ab6e0..d104937b42 100644 --- a/test_conformance/gl/test_images_multisample.cpp +++ b/test_conformance/gl/test_images_multisample.cpp @@ -25,8 +25,6 @@ #include -using namespace std; - void calc_2D_multisample_size_descriptors(sizevec_t* sizes, size_t nsizes) { // Need to limit texture size according to GL device properties @@ -39,9 +37,9 @@ void calc_2D_multisample_size_descriptors(sizevec_t* sizes, size_t nsizes) for (size_t i = 0; i < nsizes; i++) { sizes[i].width = - random_in_range(2, min(maxTextureSize, 1 << (i + 4)), seed); + random_in_range(2, std::min(maxTextureSize, 1 << (i + 4)), seed); sizes[i].height = - random_in_range(2, min(maxTextureSize, 1 << (i + 4)), seed); + random_in_range(2, std::min(maxTextureSize, 1 << (i + 4)), seed); sizes[i].depth = 1; } } @@ -59,11 +57,11 @@ void calc_2D_array_multisample_size_descriptors(sizevec_t* sizes, size_t nsizes) for (size_t i = 0; i < nsizes; i++) { sizes[i].width = - random_in_range(2, min(maxTextureSize, 1 << (i + 4)), seed); + random_in_range(2, std::min(maxTextureSize, 1 << (i + 4)), seed); sizes[i].height = - random_in_range(2, min(maxTextureSize, 1 << (i + 4)), seed); + random_in_range(2, std::min(maxTextureSize, 1 << (i + 4)), seed); sizes[i].depth = - random_in_range(2, min(maxTextureLayers, 1 << (i + 4)), seed); + random_in_range(2, std::min(maxTextureLayers, 1 << (i + 4)), seed); } } diff --git a/test_conformance/spirv_new/main.cpp b/test_conformance/spirv_new/main.cpp index fc3c0bec7f..2df19dd591 100644 --- a/test_conformance/spirv_new/main.cpp +++ b/test_conformance/spirv_new/main.cpp @@ -42,16 +42,15 @@ const std::string spvVersionSkipArg = "--skip-spirv-version-check"; std::vector readBinary(const char *file_name) { - using namespace std; - - ifstream file(file_name, ios::in | ios::binary | ios::ate); + std::ifstream file(file_name, + std::ios::in | std::ios::binary | std::ios::ate); std::vector tmpBuffer(0); if (file.is_open()) { size_t size = file.tellg(); tmpBuffer.resize(size); - file.seekg(0, ios::beg); + file.seekg(0, std::ios::beg); file.read(&tmpBuffer[0], size); file.close(); } else {