From 4fbcd96e7f568605e8391c96d49f181853e4e939 Mon Sep 17 00:00:00 2001 From: Ankit Goyal <2864326+layog@users.noreply.github.com> Date: Wed, 20 May 2020 18:46:19 +0530 Subject: [PATCH] Remove "C" linkages (#781) * Remove extern C linkages * Update crc32 to cpp and remove extern C linkage --- test_common/CMakeLists.txt | 2 +- test_common/harness/ThreadPool.h | 8 -- test_common/harness/clImageHelper.h | 8 -- test_common/harness/conversions.h | 8 -- test_common/harness/crc32.c | 104 ------------------ test_common/harness/crc32.cpp | 101 +++++++++++++++++ test_common/harness/crc32.h | 8 -- test_common/harness/deviceInfo.h | 8 -- test_common/harness/errorHelpers.h | 8 -- test_common/harness/kernelHelpers.h | 8 -- test_common/harness/mt19937.h | 8 -- test_common/harness/os_helpers.h | 8 -- test_common/harness/rounding_mode.h | 8 -- test_common/harness/testHarness.h | 7 -- test_common/harness/typeWrappers.h | 3 - test_conformance/api/test_api_min_max.cpp | 2 - .../api/test_create_context_from_type.cpp | 2 - .../api/test_kernel_arg_changes.cpp | 2 - .../api/test_kernel_arg_multi_setup.cpp | 2 - test_conformance/api/test_kernels.cpp | 2 - test_conformance/api/test_mem_object_info.cpp | 2 - test_conformance/api/test_native_kernel.cpp | 2 - test_conformance/atomics/test_atomics.cpp | 2 - .../atomics/test_indexed_cases.cpp | 2 - test_conformance/c11_atomics/common.h | 2 - .../commonfns/test_smoothstepf.cpp | 4 +- test_conformance/compiler/test_compile.cpp | 2 - .../compiler/test_preprocessor.cpp | 2 - test_conformance/conversions/Sleep.cpp | 8 -- test_conformance/conversions/Sleep.h | 8 -- test_conformance/device_execution/procs.h | 8 -- test_conformance/gl/GLEW/GL/eglew.h | 8 -- test_conformance/gl/GLEW/GL/glew.h | 8 -- test_conformance/gl/GLEW/GL/glxew.h | 8 -- test_conformance/gl/GLEW/GL/wglew.h | 8 -- test_conformance/gl/test_buffers.cpp | 2 - test_conformance/gl/test_images_2D.cpp | 2 - test_conformance/gl/test_images_3D.cpp | 2 - test_conformance/gl/test_images_depth.cpp | 2 - .../gl/test_images_getinfo_common.cpp | 2 - .../gl/test_images_read_common.cpp | 2 - .../gl/test_images_write_common.cpp | 2 - test_conformance/gl/test_renderbuffer.cpp | 2 - .../gl/test_renderbuffer_info.cpp | 2 - test_conformance/gles/test_buffers.cpp | 2 - test_conformance/gles/test_images_2D.cpp | 2 - test_conformance/gles/test_images_2D_info.cpp | 2 - test_conformance/gles/test_images_3D.cpp | 2 - test_conformance/gles/test_images_3D_info.cpp | 2 - test_conformance/gles/test_renderbuffer.cpp | 2 - .../gles/test_renderbuffer_info.cpp | 2 - .../math_brute_force/FunctionList.cpp | 6 - .../math_brute_force/FunctionList.h | 8 -- test_conformance/math_brute_force/Utility.h | 10 -- test_conformance/math_brute_force/binary.cpp | 14 +-- .../math_brute_force/binaryOperator.cpp | 8 +- .../math_brute_force/binary_i.cpp | 6 +- .../math_brute_force/binary_two_results_i.cpp | 7 +- test_conformance/math_brute_force/i_unary.cpp | 6 +- .../math_brute_force/macro_binary.cpp | 6 +- .../math_brute_force/macro_unary.cpp | 6 +- test_conformance/math_brute_force/mad.cpp | 5 +- test_conformance/math_brute_force/ternary.cpp | 6 +- test_conformance/math_brute_force/unary.cpp | 6 +- .../math_brute_force/unary_two_results.cpp | 7 +- .../math_brute_force/unary_two_results_i.cpp | 7 +- test_conformance/math_brute_force/unary_u.cpp | 6 +- .../relationals/test_comparisons_double.cpp | 2 - .../relationals/test_comparisons_float.cpp | 4 +- .../relationals/test_relationals.cpp | 2 - .../relationals/test_shuffles.cpp | 2 - test_conformance/spir/datagen.cpp | 32 ------ test_conformance/spir/run_services.cpp | 3 +- test_conformance/subgroups/procs.h | 8 -- 74 files changed, 140 insertions(+), 440 deletions(-) delete mode 100644 test_common/harness/crc32.c create mode 100644 test_common/harness/crc32.cpp diff --git a/test_common/CMakeLists.txt b/test_common/CMakeLists.txt index c78e05c2..e890a673 100644 --- a/test_common/CMakeLists.txt +++ b/test_common/CMakeLists.txt @@ -6,7 +6,7 @@ set(HARNESS_SOURCES harness/conversions.cpp harness/rounding_mode.cpp harness/msvc9.c - harness/crc32.c + harness/crc32.cpp harness/errorHelpers.cpp harness/genericThread.cpp harness/imageHelpers.cpp diff --git a/test_common/harness/ThreadPool.h b/test_common/harness/ThreadPool.h index 7c392306..2fa9c7b5 100644 --- a/test_common/harness/ThreadPool.h +++ b/test_common/harness/ThreadPool.h @@ -22,10 +22,6 @@ #include #endif -#if defined(__cplusplus) - extern "C" { -#endif - // // An atomic add operator cl_int ThreadPool_AtomicAdd( volatile cl_int *a, cl_int b ); // returns old value @@ -68,9 +64,5 @@ cl_uint GetThreadCount( void ); // otherwise the behavior is indefined. It may not be called from a TPFuncPtr. void SetThreadCount( int count ); -#ifdef __cplusplus - } /* extern "C" */ -#endif - #endif /* THREAD_POOL_H */ diff --git a/test_common/harness/clImageHelper.h b/test_common/harness/clImageHelper.h index b09b7bd4..dfa05ca6 100644 --- a/test_common/harness/clImageHelper.h +++ b/test_common/harness/clImageHelper.h @@ -25,10 +25,6 @@ #include #include "errorHelpers.h" -#ifdef __cplusplus -extern "C" { -#endif - // helper function to replace clCreateImage2D , to make the existing code use // the functions of version 1.2 and veriosn 1.1 respectively @@ -283,8 +279,4 @@ extern "C" { } -#ifdef __cplusplus -} -#endif - #endif diff --git a/test_common/harness/conversions.h b/test_common/harness/conversions.h index a9dd6dcf..50f2838a 100644 --- a/test_common/harness/conversions.h +++ b/test_common/harness/conversions.h @@ -25,10 +25,6 @@ #include #include -#if defined(__cplusplus) -extern "C" { -#endif - /* Note: the next three all have to match in size and order!! */ enum ExplicitTypes @@ -122,10 +118,6 @@ static inline int IsHalfSubnormal( cl_half x ) return ( ( x & 0x7fffU ) - 1U ) < 0x03ffU; } -#if defined(__cplusplus) -} -#endif - #endif // _conversions_h diff --git a/test_common/harness/crc32.c b/test_common/harness/crc32.c deleted file mode 100644 index a34be300..00000000 --- a/test_common/harness/crc32.c +++ /dev/null @@ -1,104 +0,0 @@ -/*- - * COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or - * code or tables extracted from it, as desired without restriction. - * - * First, the polynomial itself and its table of feedback terms. The - * polynomial is - * X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 - * - * Note that we take it "backwards" and put the highest-order term in - * the lowest-order bit. The X^32 term is "implied"; the LSB is the - * X^31 term, etc. The X^0 term (usually shown as "+1") results in - * the MSB being 1 - * - * Note that the usual hardware shift register implementation, which - * is what we're using (we're merely optimizing it by doing eight-bit - * chunks at a time) shifts bits into the lowest-order term. In our - * implementation, that means shifting towards the right. Why do we - * do it this way? Because the calculated CRC must be transmitted in - * order from highest-order term to lowest-order term. UARTs transmit - * characters in order from LSB to MSB. By storing the CRC this way - * we hand it to the UART in the order low-byte to high-byte; the UART - * sends each low-bit to hight-bit; and the result is transmission bit - * by bit from highest- to lowest-order term without requiring any bit - * shuffling on our part. Reception works similarly - * - * The feedback terms table consists of 256, 32-bit entries. Notes - * - * The table can be generated at runtime if desired; code to do so - * is shown later. It might not be obvious, but the feedback - * terms simply represent the results of eight shift/xor opera - * tions for all combinations of data and CRC register values - * - * The values must be right-shifted by eight bits by the "updcrc - * logic; the shift must be unsigned (bring in zeroes). On some - * hardware you could probably optimize the shift in assembler by - * using byte-swap instructions - * polynomial $edb88320 - * - * - * CRC32 code derived from work by Gary S. Brown. - */ - -#include "crc32.h" - -static uint32_t crc32_tab[] = { - 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, - 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, - 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, - 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, - 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, - 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, - 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, - 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, - 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, - 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, - 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, - 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, - 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, - 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, - 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, - 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, - 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, - 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, - 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, - 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, - 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, - 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, - 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, - 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, - 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, - 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, - 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, - 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, - 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, - 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, - 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, - 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, - 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, - 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, - 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, - 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, - 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, - 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, - 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, - 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, - 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, - 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, - 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d -}; - -uint32_t -crc32(const void *buf, size_t size) -{ - const uint8_t *p; - - p = (const uint8_t*)buf; - uint32_t crc = ~0U; - - while (size--) - crc = crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8); - - return crc ^ ~0U; -} - diff --git a/test_common/harness/crc32.cpp b/test_common/harness/crc32.cpp new file mode 100644 index 00000000..e2d1bc27 --- /dev/null +++ b/test_common/harness/crc32.cpp @@ -0,0 +1,101 @@ +/*- + * COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or + * code or tables extracted from it, as desired without restriction. + * + * First, the polynomial itself and its table of feedback terms. The + * polynomial is + * X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 + * + * Note that we take it "backwards" and put the highest-order term in + * the lowest-order bit. The X^32 term is "implied"; the LSB is the + * X^31 term, etc. The X^0 term (usually shown as "+1") results in + * the MSB being 1 + * + * Note that the usual hardware shift register implementation, which + * is what we're using (we're merely optimizing it by doing eight-bit + * chunks at a time) shifts bits into the lowest-order term. In our + * implementation, that means shifting towards the right. Why do we + * do it this way? Because the calculated CRC must be transmitted in + * order from highest-order term to lowest-order term. UARTs transmit + * characters in order from LSB to MSB. By storing the CRC this way + * we hand it to the UART in the order low-byte to high-byte; the UART + * sends each low-bit to hight-bit; and the result is transmission bit + * by bit from highest- to lowest-order term without requiring any bit + * shuffling on our part. Reception works similarly + * + * The feedback terms table consists of 256, 32-bit entries. Notes + * + * The table can be generated at runtime if desired; code to do so + * is shown later. It might not be obvious, but the feedback + * terms simply represent the results of eight shift/xor opera + * tions for all combinations of data and CRC register values + * + * The values must be right-shifted by eight bits by the "updcrc + * logic; the shift must be unsigned (bring in zeroes). On some + * hardware you could probably optimize the shift in assembler by + * using byte-swap instructions + * polynomial $edb88320 + * + * + * CRC32 code derived from work by Gary S. Brown. + */ + +#include "crc32.h" + +static uint32_t crc32_tab[] = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, + 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, + 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, + 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, + 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, + 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, + 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, + 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, + 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, + 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, + 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, + 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, + 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, + 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, + 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, + 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, + 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, + 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, + 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, + 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, + 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, + 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, + 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, + 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, + 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, + 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, + 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, + 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, + 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, + 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, + 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d +}; + +uint32_t crc32(const void *buf, size_t size) +{ + const uint8_t *p; + + p = (const uint8_t *)buf; + uint32_t crc = ~0U; + + while (size--) crc = crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8); + + return crc ^ ~0U; +} diff --git a/test_common/harness/crc32.h b/test_common/harness/crc32.h index 745ba90e..1913063e 100644 --- a/test_common/harness/crc32.h +++ b/test_common/harness/crc32.h @@ -21,14 +21,6 @@ executed between Khronos and the recipient. #include #include -#ifdef __cplusplus -extern "C" { -#endif - uint32_t crc32(const void *buf, size_t size); -#ifdef __cplusplus -} -#endif - #endif diff --git a/test_common/harness/deviceInfo.h b/test_common/harness/deviceInfo.h index ca12d80b..d4432ea8 100644 --- a/test_common/harness/deviceInfo.h +++ b/test_common/harness/deviceInfo.h @@ -23,17 +23,9 @@ #include -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - /* Determines if an extension is supported by a device. */ int is_extension_available(cl_device_id device, const char *extensionName); -#ifdef __cplusplus -} -#endif // __cplusplus - /* Returns a string containing the supported extensions list for a device. */ std::string get_device_extensions_string(cl_device_id device); diff --git a/test_common/harness/errorHelpers.h b/test_common/harness/errorHelpers.h index b66edd6b..727c213d 100644 --- a/test_common/harness/errorHelpers.h +++ b/test_common/harness/errorHelpers.h @@ -24,10 +24,6 @@ #include #endif #include -#ifdef __cplusplus -extern "C" { -#endif - #define LOWER_IS_BETTER 0 #define HIGHER_IS_BETTER 1 @@ -150,10 +146,6 @@ static int vlog_win32(const char *format, ...) #endif -#ifdef __cplusplus -} -#endif - #endif // _errorHelpers_h diff --git a/test_common/harness/kernelHelpers.h b/test_common/harness/kernelHelpers.h index e871df49..e97ec1e0 100644 --- a/test_common/harness/kernelHelpers.h +++ b/test_common/harness/kernelHelpers.h @@ -40,10 +40,6 @@ #include "deviceInfo.h" #include "harness/alloc.h" -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - /* * The below code is intended to be used at the top of kernels that appear inline in files to set line and file info for the kernel: * @@ -177,8 +173,4 @@ cl_device_fp_config get_default_rounding_mode( cl_device_id device ); /* Prints out the standard device header for all tests given the device to print for */ extern int printDeviceHeader( cl_device_id device ); -#ifdef __cplusplus -} -#endif // __cplusplus - #endif // _kernelHelpers_h diff --git a/test_common/harness/mt19937.h b/test_common/harness/mt19937.h index 5a9f7559..85786e7b 100644 --- a/test_common/harness/mt19937.h +++ b/test_common/harness/mt19937.h @@ -55,10 +55,6 @@ #include #endif -#ifdef __cplusplus - extern "C" { -#endif - /* * Interfaces here have been modified from original sources so that they * are safe to call reentrantly, so long as a different MTdata is used @@ -92,10 +88,6 @@ double genrand_real3( MTdata /*data*/); double genrand_res53( MTdata /*data*/ ); -#ifdef __cplusplus - } -#endif - #ifdef __cplusplus #include diff --git a/test_common/harness/os_helpers.h b/test_common/harness/os_helpers.h index 21625841..7c4463f9 100644 --- a/test_common/harness/os_helpers.h +++ b/test_common/harness/os_helpers.h @@ -37,17 +37,9 @@ // C interface. // ------------------------------------------------------------------------------------------------- -#ifdef __cplusplus - extern "C" { -#endif // __cplusplus - char * get_err_msg( int err ); // Returns system error message. Subject to free. char * get_dir_sep(); // Returns dir separator. Subject to free. char * get_exe_path(); // Returns path of current executable. Subject to free. char * get_exe_dir(); // Returns dir of current executable. Subject to free. -#ifdef __cplusplus - } // extern "C" -#endif // __cplusplus - #endif // __os_helpers_h__ diff --git a/test_common/harness/rounding_mode.h b/test_common/harness/rounding_mode.h index b7eb9758..8c0e8a13 100644 --- a/test_common/harness/rounding_mode.h +++ b/test_common/harness/rounding_mode.h @@ -51,19 +51,11 @@ typedef enum kTypeCount }Type; -#ifdef __cplusplus -extern "C" { -#endif - extern RoundingMode set_round( RoundingMode r, Type outType ); extern RoundingMode get_round( void ); extern void *FlushToZero( void ); extern void UnFlushToZero( void *p); -#ifdef __cplusplus -} -#endif - #endif /* __ROUNDING_MODE_H__ */ diff --git a/test_common/harness/testHarness.h b/test_common/harness/testHarness.h index e0067698..7132e771 100644 --- a/test_common/harness/testHarness.h +++ b/test_common/harness/testHarness.h @@ -48,10 +48,6 @@ private: Version get_device_cl_version(cl_device_id device); -#ifdef __cplusplus -extern "C" { -#endif - #define ADD_TEST(fn) \ { \ test_##fn, #fn, Version(1, 0) \ @@ -152,9 +148,6 @@ extern int gIsOpenCL_C_1_0_Device; // This is set to 1 if the device suppor void memset_pattern4(void *, const void *, size_t); #endif -#ifdef __cplusplus -} -#endif extern void PrintArch(void); diff --git a/test_common/harness/typeWrappers.h b/test_common/harness/typeWrappers.h index d767a99d..384493ff 100644 --- a/test_common/harness/typeWrappers.h +++ b/test_common/harness/typeWrappers.h @@ -29,9 +29,6 @@ #include "errorHelpers.h" #include "kernelHelpers.h" -extern "C" cl_uint gReSeed; -extern "C" cl_uint gRandomSeed; - /* cl_context wrapper */ class clContextWrapper diff --git a/test_conformance/api/test_api_min_max.cpp b/test_conformance/api/test_api_min_max.cpp index de0c791a..15ba859d 100644 --- a/test_conformance/api/test_api_min_max.cpp +++ b/test_conformance/api/test_api_min_max.cpp @@ -19,8 +19,6 @@ #include #include -extern cl_uint gRandomSeed; - const char *sample_single_param_kernel[] = { "__kernel void sample_test(__global int *src)\n" "{\n" diff --git a/test_conformance/api/test_create_context_from_type.cpp b/test_conformance/api/test_create_context_from_type.cpp index 202b6945..bbc2c866 100644 --- a/test_conformance/api/test_create_context_from_type.cpp +++ b/test_conformance/api/test_create_context_from_type.cpp @@ -22,8 +22,6 @@ #include "harness/conversions.h" -extern cl_uint gRandomSeed; - int test_create_context_from_type(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { int error; diff --git a/test_conformance/api/test_kernel_arg_changes.cpp b/test_conformance/api/test_kernel_arg_changes.cpp index b7aba632..d85ae99b 100644 --- a/test_conformance/api/test_kernel_arg_changes.cpp +++ b/test_conformance/api/test_kernel_arg_changes.cpp @@ -15,8 +15,6 @@ // #include "testBase.h" -extern "C" { extern cl_uint gRandomSeed;} - // This test is designed to stress changing kernel arguments between execute calls (that are asynchronous and thus // potentially overlapping) to make sure each kernel gets the right arguments diff --git a/test_conformance/api/test_kernel_arg_multi_setup.cpp b/test_conformance/api/test_kernel_arg_multi_setup.cpp index dbf2eed6..92c039e1 100644 --- a/test_conformance/api/test_kernel_arg_multi_setup.cpp +++ b/test_conformance/api/test_kernel_arg_multi_setup.cpp @@ -27,8 +27,6 @@ const char *multi_arg_kernel_source_pattern = " dst3[tid] = src3[tid];\n" "}\n"; -extern cl_uint gRandomSeed; - #define MAX_ERROR_TOLERANCE 0.0005f int test_multi_arg_set(cl_device_id device, cl_context context, cl_command_queue queue, diff --git a/test_conformance/api/test_kernels.cpp b/test_conformance/api/test_kernels.cpp index b191f202..993a72fb 100644 --- a/test_conformance/api/test_kernels.cpp +++ b/test_conformance/api/test_kernels.cpp @@ -17,8 +17,6 @@ #include "harness/typeWrappers.h" #include "harness/conversions.h" -extern cl_uint gRandomSeed; - const char *sample_single_test_kernel[] = { "__kernel void sample_test(__global float *src, __global int *dst)\n" "{\n" diff --git a/test_conformance/api/test_mem_object_info.cpp b/test_conformance/api/test_mem_object_info.cpp index fa0a34c7..ccfeaafa 100644 --- a/test_conformance/api/test_mem_object_info.cpp +++ b/test_conformance/api/test_mem_object_info.cpp @@ -17,8 +17,6 @@ #include "harness/typeWrappers.h" #include "harness/testHarness.h" -extern cl_uint gRandomSeed; - #define TEST_MEM_OBJECT_PARAM( mem, paramName, val, expected, name, type, cast ) \ error = clGetMemObjectInfo( mem, paramName, sizeof( val ), &val, &size ); \ diff --git a/test_conformance/api/test_native_kernel.cpp b/test_conformance/api/test_native_kernel.cpp index 49a13f94..50505e22 100644 --- a/test_conformance/api/test_native_kernel.cpp +++ b/test_conformance/api/test_native_kernel.cpp @@ -21,8 +21,6 @@ #include "harness/conversions.h" -extern cl_uint gRandomSeed; - static void CL_CALLBACK test_native_kernel_fn( void *userData ) { struct arg_struct { diff --git a/test_conformance/atomics/test_atomics.cpp b/test_conformance/atomics/test_atomics.cpp index 7f200fc6..24bf974a 100644 --- a/test_conformance/atomics/test_atomics.cpp +++ b/test_conformance/atomics/test_atomics.cpp @@ -23,8 +23,6 @@ #define LONG_TEST_VALUE 515154531254381446LL -extern cl_uint gRandomSeed; - const char *atomic_global_pattern[] = { "__kernel void test_atomic_fn(volatile __global %s *destMemory, __global %s *oldValues)\n" "{\n" diff --git a/test_conformance/atomics/test_indexed_cases.cpp b/test_conformance/atomics/test_indexed_cases.cpp index bb4be5b7..9a27d076 100644 --- a/test_conformance/atomics/test_indexed_cases.cpp +++ b/test_conformance/atomics/test_indexed_cases.cpp @@ -16,8 +16,6 @@ #include "testBase.h" #include "harness/conversions.h" -extern cl_uint gRandomSeed; - const char * atomic_index_source = "#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics : enable\n" "// Counter keeps track of which index in counts we are using.\n" diff --git a/test_conformance/c11_atomics/common.h b/test_conformance/c11_atomics/common.h index 0a22ee3e..c45e1aa5 100644 --- a/test_conformance/c11_atomics/common.h +++ b/test_conformance/c11_atomics/common.h @@ -66,8 +66,6 @@ extern bool gDebug; // print OpenCL kernel code extern int gInternalIterations; // internal test iterations for atomic operation, sufficient to verify atomicity extern int gMaxDeviceThreads; // maximum number of threads executed on OCL device -extern cl_uint gRandomSeed; - extern const char *get_memory_order_type_name(TExplicitMemoryOrderType orderType); extern const char *get_memory_scope_type_name(TExplicitMemoryScopeType scopeType); diff --git a/test_conformance/commonfns/test_smoothstepf.cpp b/test_conformance/commonfns/test_smoothstepf.cpp index 118fa895..7d708de7 100644 --- a/test_conformance/commonfns/test_smoothstepf.cpp +++ b/test_conformance/commonfns/test_smoothstepf.cpp @@ -48,8 +48,8 @@ static const char *smoothstep4_kernel_code = #define MAX_ERR (1e-5f) -extern "C" float -verify_smoothstep(float *edge0, float *edge1, float *x, float *outptr, int n, int veclen) +float verify_smoothstep(float *edge0, float *edge1, float *x, float *outptr, + int n, int veclen) { float r, t, delta, max_err = 0.0f; int i, j; diff --git a/test_conformance/compiler/test_compile.cpp b/test_conformance/compiler/test_compile.cpp index 536ea49c..f3ee4312 100644 --- a/test_conformance/compiler/test_compile.cpp +++ b/test_conformance/compiler/test_compile.cpp @@ -22,8 +22,6 @@ #endif #include "harness/conversions.h" -extern cl_uint gRandomSeed; - #define MAX_LINE_SIZE_IN_PROGRAM 1024 #define MAX_LOG_SIZE_IN_PROGRAM 2048 diff --git a/test_conformance/compiler/test_preprocessor.cpp b/test_conformance/compiler/test_preprocessor.cpp index 74ebcb09..7308950a 100644 --- a/test_conformance/compiler/test_preprocessor.cpp +++ b/test_conformance/compiler/test_preprocessor.cpp @@ -16,8 +16,6 @@ #include "testBase.h" #include "harness/os_helpers.h" -extern cl_uint gRandomSeed; - const char *define_kernel_code[] = { " #define VALUE\n" "__kernel void define_test(__global int *src, __global int *dstA, __global int *dstB)\n" diff --git a/test_conformance/conversions/Sleep.cpp b/test_conformance/conversions/Sleep.cpp index 8ed6ef34..ff61f928 100644 --- a/test_conformance/conversions/Sleep.cpp +++ b/test_conformance/conversions/Sleep.cpp @@ -104,17 +104,9 @@ } #else /* not __APPLE__ */ -#if defined(__cplusplus) -extern "C" { -#endif - void PreventSleep( void ) {} void ResumeSleep( void ) {} -#if defined(__cplusplus) -} -#endif //__cplusplus - #endif diff --git a/test_conformance/conversions/Sleep.h b/test_conformance/conversions/Sleep.h index 195e886f..f983a32f 100644 --- a/test_conformance/conversions/Sleep.h +++ b/test_conformance/conversions/Sleep.h @@ -16,17 +16,9 @@ #ifndef SLEEP_H #define SLEEP_H -#if defined(__cplusplus) -extern "C" { -#endif - void PreventSleep( void ); void ResumeSleep( void ); -#if defined(__cplusplus) -} -#endif //__cplusplus - #endif /* SLEEP_H */ diff --git a/test_conformance/device_execution/procs.h b/test_conformance/device_execution/procs.h index 11fcec9a..8f668ed1 100644 --- a/test_conformance/device_execution/procs.h +++ b/test_conformance/device_execution/procs.h @@ -15,10 +15,6 @@ // #include "harness/testHarness.h" -#ifdef __cplusplus -extern "C" { -#endif - extern int test_device_info(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements); extern int test_device_queue(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements); extern int test_execute_block(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements); @@ -33,8 +29,4 @@ extern int test_host_queue_order(cl_device_id device, cl_context context, cl_com extern int test_execution_stress(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements); -#ifdef __cplusplus -} -#endif - diff --git a/test_conformance/gl/GLEW/GL/eglew.h b/test_conformance/gl/GLEW/GL/eglew.h index b5694ad4..c38ec5c7 100644 --- a/test_conformance/gl/GLEW/GL/eglew.h +++ b/test_conformance/gl/GLEW/GL/eglew.h @@ -108,10 +108,6 @@ #include -#ifdef __cplusplus -extern "C" { -#endif - typedef int32_t EGLint; typedef unsigned int EGLBoolean; @@ -2611,8 +2607,4 @@ GLEWAPI GLboolean GLEWAPIENTRY eglewIsSupported (const char *name); GLEWAPI GLboolean GLEWAPIENTRY eglewGetExtension (const char *name); -#ifdef __cplusplus -} -#endif - #endif /* __eglew_h__ */ diff --git a/test_conformance/gl/GLEW/GL/glew.h b/test_conformance/gl/GLEW/GL/glew.h index b5b6987f..ab48adf2 100644 --- a/test_conformance/gl/GLEW/GL/glew.h +++ b/test_conformance/gl/GLEW/GL/glew.h @@ -266,10 +266,6 @@ typedef _W64 int ptrdiff_t; #define GLEW_VAR_EXPORT GLEWAPI #define GLEW_FUN_EXPORT GLEWAPI -#ifdef __cplusplus -extern "C" { -#endif - /* ----------------------------- GL_VERSION_1_1 ---------------------------- */ #ifndef GL_VERSION_1_1 @@ -23661,10 +23657,6 @@ GLEWAPI GLboolean GLEWAPIENTRY glewGetExtension (const char *name); GLEWAPI const GLubyte * GLEWAPIENTRY glewGetErrorString (GLenum error); GLEWAPI const GLubyte * GLEWAPIENTRY glewGetString (GLenum name); -#ifdef __cplusplus -} -#endif - #ifdef GLEW_APIENTRY_DEFINED #undef GLEW_APIENTRY_DEFINED #undef APIENTRY diff --git a/test_conformance/gl/GLEW/GL/glxew.h b/test_conformance/gl/GLEW/GL/glxew.h index 7e39c2fd..160134b1 100644 --- a/test_conformance/gl/GLEW/GL/glxew.h +++ b/test_conformance/gl/GLEW/GL/glxew.h @@ -100,10 +100,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - /* ---------------------------- GLX_VERSION_1_0 --------------------------- */ #ifndef GLX_VERSION_1_0 @@ -1768,8 +1764,4 @@ GLEWAPI GLboolean GLEWAPIENTRY glxewIsSupported (const char *name); GLEWAPI GLboolean GLEWAPIENTRY glxewGetExtension (const char *name); -#ifdef __cplusplus -} -#endif - #endif /* __glxew_h__ */ diff --git a/test_conformance/gl/GLEW/GL/wglew.h b/test_conformance/gl/GLEW/GL/wglew.h index 2097c0f0..57e82c35 100644 --- a/test_conformance/gl/GLEW/GL/wglew.h +++ b/test_conformance/gl/GLEW/GL/wglew.h @@ -85,10 +85,6 @@ # endif #endif -#ifdef __cplusplus -extern "C" { -#endif - /* -------------------------- WGL_3DFX_multisample ------------------------- */ #ifndef WGL_3DFX_multisample @@ -1438,10 +1434,6 @@ GLEWAPI GLboolean GLEWAPIENTRY wglewIsSupported (const char *name); GLEWAPI GLboolean GLEWAPIENTRY wglewGetExtension (const char *name); -#ifdef __cplusplus -} -#endif - #undef GLEWAPI #endif /* __wglew_h__ */ diff --git a/test_conformance/gl/test_buffers.cpp b/test_conformance/gl/test_buffers.cpp index 1a2f2cca..f11590fb 100644 --- a/test_conformance/gl/test_buffers.cpp +++ b/test_conformance/gl/test_buffers.cpp @@ -21,8 +21,6 @@ #include #endif -extern "C" { extern cl_uint gRandomSeed; }; - static const char *bufferKernelPattern = "__kernel void sample_test( __global %s%s *source, __global %s%s *clDest, __global %s%s *glDest )\n" "{\n" diff --git a/test_conformance/gl/test_images_2D.cpp b/test_conformance/gl/test_images_2D.cpp index 5af48ea8..fbff31c4 100644 --- a/test_conformance/gl/test_images_2D.cpp +++ b/test_conformance/gl/test_images_2D.cpp @@ -26,8 +26,6 @@ using namespace std; -extern "C" { extern cl_uint gRandomSeed; } - #pragma mark - #pragma mark _2D read tests diff --git a/test_conformance/gl/test_images_3D.cpp b/test_conformance/gl/test_images_3D.cpp index a8c80f6e..8abaa096 100644 --- a/test_conformance/gl/test_images_3D.cpp +++ b/test_conformance/gl/test_images_3D.cpp @@ -26,8 +26,6 @@ using namespace std; -extern "C" { extern cl_uint gRandomSeed; }; - #pragma mark - #pragma mark _3D read test diff --git a/test_conformance/gl/test_images_depth.cpp b/test_conformance/gl/test_images_depth.cpp index 09152850..f6cded47 100644 --- a/test_conformance/gl/test_images_depth.cpp +++ b/test_conformance/gl/test_images_depth.cpp @@ -27,8 +27,6 @@ using namespace std; -extern "C" { extern cl_uint gRandomSeed; } - #pragma mark - #pragma mark _2D depth read tests diff --git a/test_conformance/gl/test_images_getinfo_common.cpp b/test_conformance/gl/test_images_getinfo_common.cpp index bc21496a..345b5950 100644 --- a/test_conformance/gl/test_images_getinfo_common.cpp +++ b/test_conformance/gl/test_images_getinfo_common.cpp @@ -23,8 +23,6 @@ #include #endif -extern "C" { extern cl_uint gRandomSeed; }; - extern int supportsHalf(cl_context context, bool* supports_half); static int test_image_info( cl_context context, cl_command_queue queue, diff --git a/test_conformance/gl/test_images_read_common.cpp b/test_conformance/gl/test_images_read_common.cpp index 1d3f4ccd..112c7891 100644 --- a/test_conformance/gl/test_images_read_common.cpp +++ b/test_conformance/gl/test_images_read_common.cpp @@ -23,8 +23,6 @@ #include #endif -extern "C" { extern cl_uint gRandomSeed; }; - extern int supportsHalf(cl_context context, bool* supports_half); extern int supportsMsaa(cl_context context, bool* supports_msaa); extern int supportsDepth(cl_context context, bool* supports_depth); diff --git a/test_conformance/gl/test_images_write_common.cpp b/test_conformance/gl/test_images_write_common.cpp index 1076a172..cd48df47 100644 --- a/test_conformance/gl/test_images_write_common.cpp +++ b/test_conformance/gl/test_images_write_common.cpp @@ -24,8 +24,6 @@ #include #endif -extern "C" { extern cl_uint gRandomSeed; }; - #pragma mark - #pragma mark Write test kernels diff --git a/test_conformance/gl/test_renderbuffer.cpp b/test_conformance/gl/test_renderbuffer.cpp index c7f6e702..d75b4e84 100644 --- a/test_conformance/gl/test_renderbuffer.cpp +++ b/test_conformance/gl/test_renderbuffer.cpp @@ -52,8 +52,6 @@ gluCheckExtension(const GLubyte *extension, const GLubyte *extensions) #endif -extern "C" { extern cl_uint gRandomSeed; }; - // This is defined in the write common code: extern int test_cl_image_write( cl_context context, cl_command_queue queue, GLenum target, cl_mem clImage, size_t width, size_t height, size_t depth, diff --git a/test_conformance/gl/test_renderbuffer_info.cpp b/test_conformance/gl/test_renderbuffer_info.cpp index 61a8adfa..bb5ce848 100644 --- a/test_conformance/gl/test_renderbuffer_info.cpp +++ b/test_conformance/gl/test_renderbuffer_info.cpp @@ -21,8 +21,6 @@ #include #endif -extern "C" {extern cl_uint gRandomSeed;}; - static int test_renderbuffer_object_info( cl_context context, cl_command_queue queue, GLsizei width, GLsizei height, GLenum attachment, GLenum format, GLenum internalFormat, diff --git a/test_conformance/gles/test_buffers.cpp b/test_conformance/gles/test_buffers.cpp index 8abab0d1..a2d67322 100644 --- a/test_conformance/gles/test_buffers.cpp +++ b/test_conformance/gles/test_buffers.cpp @@ -24,8 +24,6 @@ #include #endif -extern "C" { extern cl_uint gRandomSeed; }; - static const char *bufferKernelPattern = "__kernel void sample_test( __global %s%s *source, __global %s%s *clDest, __global %s%s *glDest )\n" "{\n" diff --git a/test_conformance/gles/test_images_2D.cpp b/test_conformance/gles/test_images_2D.cpp index f2c66fd7..c1a17fc8 100644 --- a/test_conformance/gles/test_images_2D.cpp +++ b/test_conformance/gles/test_images_2D.cpp @@ -17,8 +17,6 @@ #include "gl_headers.h" -extern "C" { extern cl_uint gRandomSeed; } - static const char *imageReadKernelPattern = "#pragma OPENCL EXTENSION cl_khr_fp16 : enable\n" /* added support for half floats */ "__kernel void sample_test( read_only image2d_t source, sampler_t sampler, __global %s4 *results )\n" diff --git a/test_conformance/gles/test_images_2D_info.cpp b/test_conformance/gles/test_images_2D_info.cpp index ce6717e6..857ab203 100644 --- a/test_conformance/gles/test_images_2D_info.cpp +++ b/test_conformance/gles/test_images_2D_info.cpp @@ -17,8 +17,6 @@ #include "gl_headers.h" -extern "C" {extern cl_uint gRandomSeed;}; - static int test_image_read( cl_context context, cl_command_queue queue, GLenum glTarget, GLuint glTexture, size_t imageWidth, size_t imageHeight, cl_image_format *outFormat, ExplicitType *outType, void **outResultBuffer ) diff --git a/test_conformance/gles/test_images_3D.cpp b/test_conformance/gles/test_images_3D.cpp index 7babc91e..9bfb2a59 100644 --- a/test_conformance/gles/test_images_3D.cpp +++ b/test_conformance/gles/test_images_3D.cpp @@ -17,8 +17,6 @@ #include "gl_headers.h" -extern "C" { extern cl_uint gRandomSeed; }; - static const char *imageReadKernelPattern = "__kernel void sample_test( read_only image3d_t source, sampler_t sampler, __global %s4 *results )\n" "{\n" diff --git a/test_conformance/gles/test_images_3D_info.cpp b/test_conformance/gles/test_images_3D_info.cpp index f2e98c01..a93985ee 100644 --- a/test_conformance/gles/test_images_3D_info.cpp +++ b/test_conformance/gles/test_images_3D_info.cpp @@ -16,8 +16,6 @@ #include "gl_headers.h" #include "testBase.h" -extern "C" {extern cl_uint gRandomSeed;}; - static int test_image_read( cl_context context, cl_command_queue queue, GLenum glTarget, GLuint glTexture, size_t imageWidth, size_t imageHeight, size_t imageDepth, cl_image_format *outFormat, ExplicitType *outType, void **outResultBuffer ) { diff --git a/test_conformance/gles/test_renderbuffer.cpp b/test_conformance/gles/test_renderbuffer.cpp index b4c6f148..20127aca 100644 --- a/test_conformance/gles/test_renderbuffer.cpp +++ b/test_conformance/gles/test_renderbuffer.cpp @@ -18,8 +18,6 @@ #include "gl_headers.h" -extern "C" { extern cl_uint gRandomSeed; }; - extern int test_cl_image_write( cl_context context, cl_command_queue queue, cl_mem clImage, size_t imageWidth, size_t imageHeight, cl_image_format *outFormat, ExplicitType *outType, void **outSourceBuffer, MTdata d ); diff --git a/test_conformance/gles/test_renderbuffer_info.cpp b/test_conformance/gles/test_renderbuffer_info.cpp index 4724187d..78331bc8 100644 --- a/test_conformance/gles/test_renderbuffer_info.cpp +++ b/test_conformance/gles/test_renderbuffer_info.cpp @@ -16,8 +16,6 @@ #include "gl_headers.h" #include "testBase.h" -extern "C" {extern cl_uint gRandomSeed;}; - static int test_renderbuffer_object_info( cl_context context, cl_command_queue queue, GLsizei width, GLsizei height, GLenum attachment, GLenum rbFormat, GLenum rbType, diff --git a/test_conformance/math_brute_force/FunctionList.cpp b/test_conformance/math_brute_force/FunctionList.cpp index 2f54d9bc..30ee551f 100644 --- a/test_conformance/math_brute_force/FunctionList.cpp +++ b/test_conformance/math_brute_force/FunctionList.cpp @@ -59,9 +59,6 @@ #define HALF_ENTRY( _name, _ulp, _embedded_ulp, _rmode, _type ) { "half_" STRINGIFY(_name), "half_" STRINGIFY(_name), {(void*)reference_##_name}, {NULL}, {NULL}, _ulp, _ulp, _embedded_ulp, INFINITY, _rmode, RELAXED_OFF, _type } #define OPERATOR_ENTRY(_name, _operator, _ulp, _embedded_ulp, _rmode, _type) { STRINGIFY(_name), _operator, {(void*)reference_##_name}, {(void*)reference_##_name##l}, {NULL}, _ulp, _ulp, _embedded_ulp, INFINITY, _rmode, RELAXED_OFF, _type } -#if defined( __cplusplus ) - extern "C" { -#endif extern const vtbl _unary; // float foo( float ) extern const vtbl _unary_u; // float foo( uint ), double foo( ulong ) extern const vtbl _i_unary; // int foo( float ) @@ -76,9 +73,6 @@ extern const vtbl _unary_two_results; // float foo( float, float * ) extern const vtbl _unary_two_results_i; // float foo( float, int * ) extern const vtbl _binary_two_results_i; // float foo( float, float, int * ) extern const vtbl _mad_tbl; // float mad( float, float, float ) -#if defined( __cplusplus) - } -#endif #define unaryF &_unary #define i_unaryF &_i_unary diff --git a/test_conformance/math_brute_force/FunctionList.h b/test_conformance/math_brute_force/FunctionList.h index bb3fab16..b2b0ec07 100644 --- a/test_conformance/math_brute_force/FunctionList.h +++ b/test_conformance/math_brute_force/FunctionList.h @@ -30,10 +30,6 @@ #include "harness/mt19937.h" -#ifdef __cplusplus -extern "C" { -#endif - typedef union fptr { void *p; @@ -97,10 +93,6 @@ extern const Func functionList[]; extern const size_t functionListCount; -#ifdef __cplusplus -} -#endif - #endif diff --git a/test_conformance/math_brute_force/Utility.h b/test_conformance/math_brute_force/Utility.h index 55ef5a09..9c14910b 100644 --- a/test_conformance/math_brute_force/Utility.h +++ b/test_conformance/math_brute_force/Utility.h @@ -90,16 +90,10 @@ extern cl_device_fp_config gDoubleCapabilities; #define scalbnl( _a, _i ) ldexpl( _a, _i ) #endif -#ifdef __cplusplus -extern "C" { -#endif float Abs_Error( float test, double reference ); float Ulp_Error( float test, double reference ); //float Ulp_Error_Half( float test, double reference ); float Bruteforce_Ulp_Error_Double( double test, long double reference ); -#ifdef __cplusplus -} //extern "C" -#endif uint64_t GetTime( void ); double SubtractTime( uint64_t endTime, uint64_t startTime ); @@ -230,11 +224,7 @@ static inline void Force64BitFPUPrecision(void) #endif } -#ifdef __cplusplus -extern "C" -#else extern -#endif void memset_pattern4(void *dest, const void *src_pattern, size_t bytes ); typedef union diff --git a/test_conformance/math_brute_force/binary.cpp b/test_conformance/math_brute_force/binary.cpp index 561a7274..4155a411 100644 --- a/test_conformance/math_brute_force/binary.cpp +++ b/test_conformance/math_brute_force/binary.cpp @@ -28,15 +28,13 @@ int TestFunc_Double_Double_Double_common(const Func *f, MTdata, int isNextafter) const float twoToMinus126 = MAKE_HEX_FLOAT(0x1p-126f, 1, -126); const double twoToMinus1022 = MAKE_HEX_DOUBLE(0x1p-1022, 1, -1022); -#if defined( __cplusplus ) - extern "C" -#endif -const vtbl _binary = { "binary", TestFunc_Float_Float_Float, TestFunc_Double_Double_Double }; +extern const vtbl _binary = { "binary", TestFunc_Float_Float_Float, + TestFunc_Double_Double_Double }; -#if defined( __cplusplus ) - extern "C" -#endif -const vtbl _binary_nextafter = { "binary_nextafter", TestFunc_Float_Float_Float_nextafter, TestFunc_Double_Double_Double_nextafter }; +extern const vtbl _binary_nextafter = { + "binary_nextafter", TestFunc_Float_Float_Float_nextafter, + TestFunc_Double_Double_Double_nextafter +}; static int BuildKernel( const char *name, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p ); diff --git a/test_conformance/math_brute_force/binaryOperator.cpp b/test_conformance/math_brute_force/binaryOperator.cpp index 222327b1..7676625c 100644 --- a/test_conformance/math_brute_force/binaryOperator.cpp +++ b/test_conformance/math_brute_force/binaryOperator.cpp @@ -21,11 +21,9 @@ int TestFunc_Float_Float_Float_Operator(const Func *f, MTdata); int TestFunc_Double_Double_Double_Operator(const Func *f, MTdata); -#if defined(__cplusplus) - extern "C" -#endif - -const vtbl _binary_operator = { "binaryOperator", TestFunc_Float_Float_Float_Operator, TestFunc_Double_Double_Double_Operator }; +extern const vtbl _binary_operator = { "binaryOperator", + TestFunc_Float_Float_Float_Operator, + TestFunc_Double_Double_Double_Operator }; static int BuildKernel( const char *name, const char *operator_symbol, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p ); static int BuildKernelDouble( const char *name, const char *operator_symbol, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p ); diff --git a/test_conformance/math_brute_force/binary_i.cpp b/test_conformance/math_brute_force/binary_i.cpp index 0ecbd8c0..a29a876d 100644 --- a/test_conformance/math_brute_force/binary_i.cpp +++ b/test_conformance/math_brute_force/binary_i.cpp @@ -22,10 +22,8 @@ int TestFunc_Float_Float_Int(const Func *f, MTdata); int TestFunc_Double_Double_Int(const Func *f, MTdata); -#if defined( __cplusplus) - extern "C" -#endif -const vtbl _binary_i = { "binary_i", TestFunc_Float_Float_Int, TestFunc_Double_Double_Int }; +extern const vtbl _binary_i = { "binary_i", TestFunc_Float_Float_Int, + TestFunc_Double_Double_Int }; static int BuildKernel( const char *name, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p ); static int BuildKernelDouble( const char *name, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p ); diff --git a/test_conformance/math_brute_force/binary_two_results_i.cpp b/test_conformance/math_brute_force/binary_two_results_i.cpp index b1e80ede..91cebf56 100644 --- a/test_conformance/math_brute_force/binary_two_results_i.cpp +++ b/test_conformance/math_brute_force/binary_two_results_i.cpp @@ -24,10 +24,9 @@ int TestFunc_FloatI_Float_Float(const Func *f, MTdata); int TestFunc_DoubleI_Double_Double(const Func *f, MTdata); -#if defined( __cplusplus ) - extern "C" -#endif -const vtbl _binary_two_results_i = { "binary_two_results_i", TestFunc_FloatI_Float_Float, TestFunc_DoubleI_Double_Double }; +extern const vtbl _binary_two_results_i = { "binary_two_results_i", + TestFunc_FloatI_Float_Float, + TestFunc_DoubleI_Double_Double }; static int BuildKernel( const char *name, int vectorSize, cl_kernel *k, cl_program *p ); static int BuildKernelDouble( const char *name, int vectorSize, cl_kernel *k, cl_program *p ); diff --git a/test_conformance/math_brute_force/i_unary.cpp b/test_conformance/math_brute_force/i_unary.cpp index e41d5d82..75b9424a 100644 --- a/test_conformance/math_brute_force/i_unary.cpp +++ b/test_conformance/math_brute_force/i_unary.cpp @@ -21,10 +21,8 @@ int TestFunc_Int_Float(const Func *f, MTdata); int TestFunc_Int_Double(const Func *f, MTdata); -#if defined( __cplusplus) - extern "C" -#endif -const vtbl _i_unary = { "i_unary", TestFunc_Int_Float, TestFunc_Int_Double }; +extern const vtbl _i_unary = { "i_unary", TestFunc_Int_Float, + TestFunc_Int_Double }; static int BuildKernel( const char *name, int vectorSize, cl_kernel *k, cl_program *p ); diff --git a/test_conformance/math_brute_force/macro_binary.cpp b/test_conformance/math_brute_force/macro_binary.cpp index 4bbfc506..0670990f 100644 --- a/test_conformance/math_brute_force/macro_binary.cpp +++ b/test_conformance/math_brute_force/macro_binary.cpp @@ -21,10 +21,8 @@ int TestMacro_Int_Float_Float(const Func *f, MTdata); int TestMacro_Int_Double_Double(const Func *f, MTdata); -#if defined( __cplusplus) -extern "C" -#endif -const vtbl _macro_binary = { "macro_binary", TestMacro_Int_Float_Float, TestMacro_Int_Double_Double }; +extern const vtbl _macro_binary = { "macro_binary", TestMacro_Int_Float_Float, + TestMacro_Int_Double_Double }; static int BuildKernel( const char *name, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p ); static int BuildKernelDouble( const char *name, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p ); diff --git a/test_conformance/math_brute_force/macro_unary.cpp b/test_conformance/math_brute_force/macro_unary.cpp index ebe0c6b6..c8d125b5 100644 --- a/test_conformance/math_brute_force/macro_unary.cpp +++ b/test_conformance/math_brute_force/macro_unary.cpp @@ -21,10 +21,8 @@ int TestMacro_Int_Float(const Func *f, MTdata); int TestMacro_Int_Double(const Func *f, MTdata); -#if defined( __cplusplus) - extern "C" -#endif -const vtbl _macro_unary = { "macro_unary", TestMacro_Int_Float, TestMacro_Int_Double }; +extern const vtbl _macro_unary = { "macro_unary", TestMacro_Int_Float, + TestMacro_Int_Double }; static int BuildKernel( const char *name, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p ); static int BuildKernelDouble( const char *name, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p ); diff --git a/test_conformance/math_brute_force/mad.cpp b/test_conformance/math_brute_force/mad.cpp index 652ab360..5eeae35a 100644 --- a/test_conformance/math_brute_force/mad.cpp +++ b/test_conformance/math_brute_force/mad.cpp @@ -21,10 +21,7 @@ int TestFunc_mad(const Func *f, MTdata); int TestFunc_mad_Double(const Func *f, MTdata); -#if defined( __cplusplus) - extern "C" -#endif -const vtbl _mad_tbl = { "ternary", TestFunc_mad, TestFunc_mad_Double }; +extern const vtbl _mad_tbl = { "ternary", TestFunc_mad, TestFunc_mad_Double }; static int BuildKernel( const char *name, int vectorSize, cl_kernel *k, cl_program *p ); static int BuildKernelDouble( const char *name, int vectorSize, cl_kernel *k, cl_program *p ); diff --git a/test_conformance/math_brute_force/ternary.cpp b/test_conformance/math_brute_force/ternary.cpp index 8ac48d64..1bd7d889 100644 --- a/test_conformance/math_brute_force/ternary.cpp +++ b/test_conformance/math_brute_force/ternary.cpp @@ -24,10 +24,8 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata); int TestFunc_Double_Double_Double_Double(const Func *f, MTdata); -#if defined( __cplusplus) -extern "C" -#endif -const vtbl _ternary = { "ternary", TestFunc_Float_Float_Float_Float, TestFunc_Double_Double_Double_Double }; +extern const vtbl _ternary = { "ternary", TestFunc_Float_Float_Float_Float, + TestFunc_Double_Double_Double_Double }; static int BuildKernel( const char *name, int vectorSize, cl_kernel *k, cl_program *p ); static int BuildKernelDouble( const char *name, int vectorSize, cl_kernel *k, cl_program *p ); diff --git a/test_conformance/math_brute_force/unary.cpp b/test_conformance/math_brute_force/unary.cpp index 776175ff..a979d07c 100644 --- a/test_conformance/math_brute_force/unary.cpp +++ b/test_conformance/math_brute_force/unary.cpp @@ -25,10 +25,8 @@ int TestFunc_Float_Float(const Func *f, MTdata); int TestFunc_Double_Double(const Func *f, MTdata); -#if defined( __cplusplus) - extern "C" -#endif -const vtbl _unary = { "unary", TestFunc_Float_Float, TestFunc_Double_Double }; +extern const vtbl _unary = { "unary", TestFunc_Float_Float, + TestFunc_Double_Double }; static int BuildKernel( const char *name, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p ); static int BuildKernelDouble( const char *name, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p ); diff --git a/test_conformance/math_brute_force/unary_two_results.cpp b/test_conformance/math_brute_force/unary_two_results.cpp index 26756edf..a2197413 100644 --- a/test_conformance/math_brute_force/unary_two_results.cpp +++ b/test_conformance/math_brute_force/unary_two_results.cpp @@ -21,10 +21,9 @@ int TestFunc_Float2_Float(const Func *f, MTdata); int TestFunc_Double2_Double(const Func *f, MTdata); -#if defined(__cplusplus) - extern "C" -#endif -const vtbl _unary_two_results = { "unary_two_results", TestFunc_Float2_Float, TestFunc_Double2_Double }; +extern const vtbl _unary_two_results = { "unary_two_results", + TestFunc_Float2_Float, + TestFunc_Double2_Double }; static int BuildKernel( const char *name, int vectorSize, cl_kernel *k, cl_program *p ); static int BuildKernelDouble( const char *name, int vectorSize, cl_kernel *k, cl_program *p ); diff --git a/test_conformance/math_brute_force/unary_two_results_i.cpp b/test_conformance/math_brute_force/unary_two_results_i.cpp index cdd24f8e..f5cc1e34 100644 --- a/test_conformance/math_brute_force/unary_two_results_i.cpp +++ b/test_conformance/math_brute_force/unary_two_results_i.cpp @@ -22,10 +22,9 @@ int TestFunc_FloatI_Float(const Func *f, MTdata); int TestFunc_DoubleI_Double(const Func *f, MTdata); -#if defined(__cplusplus) - extern "C" -#endif -const vtbl _unary_two_results_i = { "unary_two_results_i", TestFunc_FloatI_Float, TestFunc_DoubleI_Double }; +extern const vtbl _unary_two_results_i = { "unary_two_results_i", + TestFunc_FloatI_Float, + TestFunc_DoubleI_Double }; static int BuildKernel( const char *name, int vectorSize, cl_kernel *k, cl_program *p ); static int BuildKernelDouble( const char *name, int vectorSize, cl_kernel *k, cl_program *p ); diff --git a/test_conformance/math_brute_force/unary_u.cpp b/test_conformance/math_brute_force/unary_u.cpp index 336fdd24..690b6e75 100644 --- a/test_conformance/math_brute_force/unary_u.cpp +++ b/test_conformance/math_brute_force/unary_u.cpp @@ -21,10 +21,8 @@ int TestFunc_Float_UInt(const Func *f, MTdata); int TestFunc_Double_ULong(const Func *f, MTdata); -#if defined( __cplusplus) - extern "C" -#endif -const vtbl _unary_u = { "unary_u", TestFunc_Float_UInt, TestFunc_Double_ULong }; +extern const vtbl _unary_u = { "unary_u", TestFunc_Float_UInt, + TestFunc_Double_ULong }; static int BuildKernel( const char *name, int vectorSize, cl_kernel *k, cl_program *p ); diff --git a/test_conformance/relationals/test_comparisons_double.cpp b/test_conformance/relationals/test_comparisons_double.cpp index a2f272cf..9dc737fd 100644 --- a/test_conformance/relationals/test_comparisons_double.cpp +++ b/test_conformance/relationals/test_comparisons_double.cpp @@ -17,8 +17,6 @@ #include "harness/conversions.h" #include "harness/typeWrappers.h" -extern "C" { extern cl_uint gRandomSeed; }; - #define TEST_SIZE 512 const char *equivTestKernelPattern_double = diff --git a/test_conformance/relationals/test_comparisons_float.cpp b/test_conformance/relationals/test_comparisons_float.cpp index 965d6151..e8178d84 100644 --- a/test_conformance/relationals/test_comparisons_float.cpp +++ b/test_conformance/relationals/test_comparisons_float.cpp @@ -17,8 +17,6 @@ #include "harness/conversions.h" #include "harness/typeWrappers.h" -extern "C" { extern cl_uint gRandomSeed;}; - #define TEST_SIZE 512 const char *equivTestKernelPattern_float = @@ -63,7 +61,7 @@ const char *equivTestKernelPatternLessGreater_float3 = "}\n"; typedef bool (*equivVerifyFn)( float inDataA, float inDataB ); -extern "C" { extern int gInfNanSupport; }; +extern int gInfNanSupport; int IsFloatInfinity(float x) { diff --git a/test_conformance/relationals/test_relationals.cpp b/test_conformance/relationals/test_relationals.cpp index 09c202d9..70952409 100644 --- a/test_conformance/relationals/test_relationals.cpp +++ b/test_conformance/relationals/test_relationals.cpp @@ -38,8 +38,6 @@ const char *anyAllTestKernelPatternVload = #define TEST_SIZE 512 -extern "C" {extern cl_uint gRandomSeed;}; - typedef int (*anyAllVerifyFn)( ExplicitType vecType, unsigned int vecSize, void *inData ); int test_any_all_kernel(cl_context context, cl_command_queue queue, diff --git a/test_conformance/relationals/test_shuffles.cpp b/test_conformance/relationals/test_shuffles.cpp index 7e72d87a..c784b650 100644 --- a/test_conformance/relationals/test_shuffles.cpp +++ b/test_conformance/relationals/test_shuffles.cpp @@ -36,8 +36,6 @@ enum ShuffleMode kBuiltInDualInputFnMode }; -extern "C" { extern cl_uint gRandomSeed;}; - static const char *shuffleKernelPattern[3] = { "__kernel void sample_test( __global %s%s *source, __global %s%s *dest )\n" "{\n" diff --git a/test_conformance/spir/datagen.cpp b/test_conformance/spir/datagen.cpp index 15e38160..ffd05c35 100644 --- a/test_conformance/spir/datagen.cpp +++ b/test_conformance/spir/datagen.cpp @@ -93,38 +93,6 @@ void DataGenerator::setArgGenerator(const KernelArgInfo& argInfo, m_argGenerators[argInfo.getTypeName()] = pGen; } -float get_random_float(float low, float high, MTdata d) -{ - float t = (float)((double)genrand_int32(d) / (double)0xFFFFFFFF); - return (1.0f - t) * low + t * high; -} - -double get_random_double(double low, double high, MTdata d) -{ - cl_ulong u = (cl_ulong) genrand_int32(d) | ((cl_ulong) genrand_int32(d) << 32 ); - double t = (double) u * MAKE_HEX_DOUBLE( 0x1.0p-64, 0x1, -64); - return (1.0f - t) * low + t * high; -} - -size_t get_random_size_t(size_t low, size_t high, MTdata d) -{ - enum { N = sizeof(size_t)/sizeof(int) }; - - union { - int word[N]; - size_t size; - } u; - - for (unsigned i=0; i != N; ++i) { - u.word[i] = genrand_int32(d); - } - - assert(low <= high && "Invalid random number range specified"); - size_t range = high - low; - - return (range) ? low + ((u.size - low) % range) : low; -} - size_t get_random_int32(int low, int high, MTdata d) { int v = genrand_int32(d); diff --git a/test_conformance/spir/run_services.cpp b/test_conformance/spir/run_services.cpp index 8ecea449..257dbff7 100644 --- a/test_conformance/spir/run_services.cpp +++ b/test_conformance/spir/run_services.cpp @@ -100,7 +100,8 @@ void get_kernel_name (const char *test_name, std::string &kernel_name) kernel_name.assign(temp_str); } -extern "C" void CL_CALLBACK notify_callback(const char *errInfo, const void *privateInfo, size_t cb, void *userData); +void CL_CALLBACK notify_callback(const char* errInfo, const void* privateInfo, + size_t cb, void* userData); void create_context_and_queue(cl_device_id device, cl_context *out_context, cl_command_queue *out_queue) { diff --git a/test_conformance/subgroups/procs.h b/test_conformance/subgroups/procs.h index f10ef8cf..e3713770 100644 --- a/test_conformance/subgroups/procs.h +++ b/test_conformance/subgroups/procs.h @@ -26,10 +26,6 @@ extern MTdata gMTdata; -#ifdef __cplusplus -extern "C" { -#endif - extern int test_sub_group_info(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements); extern int test_work_item_functions(cl_device_id device, cl_context context, @@ -41,8 +37,4 @@ extern int test_barrier_functions(cl_device_id device, cl_context context, extern int test_pipe_functions(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements); -#ifdef __cplusplus -} -#endif - #endif /*_procs_h*/