From b69469863cb5e902a48e0c3b153221604b31f249 Mon Sep 17 00:00:00 2001 From: Philip Salzmann Date: Fri, 5 Mar 2021 13:29:18 +0100 Subject: [PATCH] Update .clang-format config to sort includes Also run the new configuration on all existing test and util files. (However note that, as not all files fully conform to clang-format, this only adds the changes to includes!). --- .clang-format | 2 +- tests/accessor/accessor_api_buffer.cpp | 2 +- tests/accessor/accessor_api_buffer_common.h | 4 ++-- tests/accessor/accessor_api_buffer_fp16.cpp | 2 +- tests/accessor/accessor_api_buffer_fp64.cpp | 2 +- tests/accessor/accessor_api_common_buffer_local.h | 2 +- tests/accessor/accessor_api_image.cpp | 2 +- tests/accessor/accessor_api_image_common.h | 2 +- tests/accessor/accessor_api_image_fp16.cpp | 2 +- tests/accessor/accessor_api_local.cpp | 2 +- tests/accessor/accessor_api_local_common.h | 4 ++-- tests/accessor/accessor_api_local_fp16.cpp | 2 +- tests/accessor/accessor_api_local_fp64.cpp | 2 +- tests/accessor/accessor_constructors_buffer.cpp | 2 +- .../accessor_constructors_buffer_placeholder.cpp | 2 +- tests/accessor/accessor_constructors_fp16.cpp | 4 ++-- tests/accessor/accessor_constructors_fp64.cpp | 4 ++-- tests/accessor/accessor_constructors_image.cpp | 2 +- tests/accessor/accessor_constructors_local.cpp | 2 +- tests/accessor/accessor_utility.h | 2 +- tests/address_space/address_space.cpp | 2 +- tests/common/common.h | 14 ++++++-------- tests/common/common_vec.h | 10 ++++------ tests/common/macros.h | 2 +- tests/common/main.cpp | 2 +- tests/image/image_api.cpp | 2 +- tests/image/image_api_fp16.cpp | 2 +- tests/image/image_constructors.cpp | 2 +- .../opencl_interop/opencl_interop_constructors.cpp | 2 +- tests/opencl_interop/opencl_interop_get.cpp | 2 +- tests/opencl_interop/opencl_interop_kernel.cpp | 2 +- util/cmdarg.h | 2 +- util/collection.cpp | 2 +- util/collection.h | 2 +- util/executor.cpp | 4 ++-- util/logger.cpp | 2 +- util/math_helper.h | 2 +- util/math_reference.h | 2 +- util/opencl_helper.h | 2 +- util/printer.cpp | 6 +++--- util/printer.h | 2 +- util/selector.h | 2 +- util/stl.h | 2 +- util/test_manager.cpp | 6 +++--- 44 files changed, 61 insertions(+), 65 deletions(-) diff --git a/.clang-format b/.clang-format index bbe846453..63b6eb478 100644 --- a/.clang-format +++ b/.clang-format @@ -58,6 +58,6 @@ CommentPragmas: '^ IWYU pragma:' ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] SpaceBeforeParens: ControlStatements DisableFormat: false -SortIncludes: false +SortIncludes: true ... diff --git a/tests/accessor/accessor_api_buffer.cpp b/tests/accessor/accessor_api_buffer.cpp index ab004a9a1..ad9c5a3ee 100644 --- a/tests/accessor/accessor_api_buffer.cpp +++ b/tests/accessor/accessor_api_buffer.cpp @@ -8,8 +8,8 @@ #include "../common/common.h" #include "./../../util/math_helper.h" -#include "accessor_utility.h" #include "accessor_api_buffer_common.h" +#include "accessor_utility.h" #define TEST_NAME accessor_api_buffer diff --git a/tests/accessor/accessor_api_buffer_common.h b/tests/accessor/accessor_api_buffer_common.h index af14e4ae3..016881db3 100644 --- a/tests/accessor/accessor_api_buffer_common.h +++ b/tests/accessor/accessor_api_buffer_common.h @@ -10,9 +10,9 @@ #include "../common/common.h" #include "./../../util/math_helper.h" -#include "accessor_utility.h" -#include "accessor_api_common_buffer_local.h" #include "accessor_api_common_all.h" +#include "accessor_api_common_buffer_local.h" +#include "accessor_utility.h" namespace { diff --git a/tests/accessor/accessor_api_buffer_fp16.cpp b/tests/accessor/accessor_api_buffer_fp16.cpp index a87b3f1f5..7b9abd5a4 100644 --- a/tests/accessor/accessor_api_buffer_fp16.cpp +++ b/tests/accessor/accessor_api_buffer_fp16.cpp @@ -8,8 +8,8 @@ #include "../common/common.h" #include "./../../util/math_helper.h" -#include "accessor_utility.h" #include "accessor_api_buffer_common.h" +#include "accessor_utility.h" #define TEST_NAME accessor_api_buffer_fp16 diff --git a/tests/accessor/accessor_api_buffer_fp64.cpp b/tests/accessor/accessor_api_buffer_fp64.cpp index 53b8c3475..2a5a77798 100644 --- a/tests/accessor/accessor_api_buffer_fp64.cpp +++ b/tests/accessor/accessor_api_buffer_fp64.cpp @@ -8,8 +8,8 @@ #include "../common/common.h" #include "./../../util/math_helper.h" -#include "accessor_utility.h" #include "accessor_api_buffer_common.h" +#include "accessor_utility.h" #define TEST_NAME accessor_api_buffer_fp64 diff --git a/tests/accessor/accessor_api_common_buffer_local.h b/tests/accessor/accessor_api_common_buffer_local.h index 881c10bbc..e6c259845 100644 --- a/tests/accessor/accessor_api_common_buffer_local.h +++ b/tests/accessor/accessor_api_common_buffer_local.h @@ -13,8 +13,8 @@ #include "../common/common.h" #include "accessor_utility.h" -#include #include +#include #include #include diff --git a/tests/accessor/accessor_api_image.cpp b/tests/accessor/accessor_api_image.cpp index 703577db9..6e2b04700 100644 --- a/tests/accessor/accessor_api_image.cpp +++ b/tests/accessor/accessor_api_image.cpp @@ -8,8 +8,8 @@ #include "../common/common.h" #include "./../../util/math_helper.h" -#include "accessor_utility.h" #include "accessor_api_image_common.h" +#include "accessor_utility.h" #include #include diff --git a/tests/accessor/accessor_api_image_common.h b/tests/accessor/accessor_api_image_common.h index 99a170925..225f11229 100644 --- a/tests/accessor/accessor_api_image_common.h +++ b/tests/accessor/accessor_api_image_common.h @@ -10,8 +10,8 @@ #include "../common/common.h" #include "./../../util/math_helper.h" -#include "accessor_utility.h" #include "accessor_api_common_all.h" +#include "accessor_utility.h" #include #include diff --git a/tests/accessor/accessor_api_image_fp16.cpp b/tests/accessor/accessor_api_image_fp16.cpp index e9f2f5edc..b01f9ab3b 100644 --- a/tests/accessor/accessor_api_image_fp16.cpp +++ b/tests/accessor/accessor_api_image_fp16.cpp @@ -8,8 +8,8 @@ #include "../common/common.h" #include "./../../util/math_helper.h" -#include "accessor_utility.h" #include "accessor_api_image_common.h" +#include "accessor_utility.h" #include #include diff --git a/tests/accessor/accessor_api_local.cpp b/tests/accessor/accessor_api_local.cpp index f42778553..6f17e1df2 100644 --- a/tests/accessor/accessor_api_local.cpp +++ b/tests/accessor/accessor_api_local.cpp @@ -8,8 +8,8 @@ #include "../common/common.h" #include "./../../util/math_helper.h" -#include "accessor_utility.h" #include "accessor_api_local_common.h" +#include "accessor_utility.h" #include #include diff --git a/tests/accessor/accessor_api_local_common.h b/tests/accessor/accessor_api_local_common.h index d99f0736b..d96ab69b3 100644 --- a/tests/accessor/accessor_api_local_common.h +++ b/tests/accessor/accessor_api_local_common.h @@ -10,9 +10,9 @@ #include "../common/common.h" #include "./../../util/math_helper.h" -#include "accessor_utility.h" -#include "accessor_api_common_buffer_local.h" #include "accessor_api_common_all.h" +#include "accessor_api_common_buffer_local.h" +#include "accessor_utility.h" #include #include diff --git a/tests/accessor/accessor_api_local_fp16.cpp b/tests/accessor/accessor_api_local_fp16.cpp index 85a701743..2cd28738f 100644 --- a/tests/accessor/accessor_api_local_fp16.cpp +++ b/tests/accessor/accessor_api_local_fp16.cpp @@ -8,8 +8,8 @@ #include "../common/common.h" #include "./../../util/math_helper.h" -#include "accessor_utility.h" #include "accessor_api_local_common.h" +#include "accessor_utility.h" #include #include diff --git a/tests/accessor/accessor_api_local_fp64.cpp b/tests/accessor/accessor_api_local_fp64.cpp index 54c5613ce..83a39dd35 100644 --- a/tests/accessor/accessor_api_local_fp64.cpp +++ b/tests/accessor/accessor_api_local_fp64.cpp @@ -8,8 +8,8 @@ #include "../common/common.h" #include "./../../util/math_helper.h" -#include "accessor_utility.h" #include "accessor_api_local_common.h" +#include "accessor_utility.h" #include #include diff --git a/tests/accessor/accessor_constructors_buffer.cpp b/tests/accessor/accessor_constructors_buffer.cpp index 0c0756a93..cca871375 100644 --- a/tests/accessor/accessor_constructors_buffer.cpp +++ b/tests/accessor/accessor_constructors_buffer.cpp @@ -9,8 +9,8 @@ #define TEST_NAME accessor_constructors_buffer #include "../common/common.h" -#include "accessor_constructors_utility.h" #include "accessor_constructors_buffer_utility.h" +#include "accessor_constructors_utility.h" namespace TEST_NAMESPACE { diff --git a/tests/accessor/accessor_constructors_buffer_placeholder.cpp b/tests/accessor/accessor_constructors_buffer_placeholder.cpp index ab090c916..6079e5fa0 100644 --- a/tests/accessor/accessor_constructors_buffer_placeholder.cpp +++ b/tests/accessor/accessor_constructors_buffer_placeholder.cpp @@ -9,8 +9,8 @@ #define TEST_NAME accessor_constructors_buffer_placeholder #include "../common/common.h" -#include "accessor_constructors_utility.h" #include "accessor_constructors_buffer_utility.h" +#include "accessor_constructors_utility.h" namespace TEST_NAMESPACE { diff --git a/tests/accessor/accessor_constructors_fp16.cpp b/tests/accessor/accessor_constructors_fp16.cpp index afb3b7258..90bc3fba7 100644 --- a/tests/accessor/accessor_constructors_fp16.cpp +++ b/tests/accessor/accessor_constructors_fp16.cpp @@ -9,10 +9,10 @@ #define TEST_NAME accessor_constructors_fp16 #include "../common/common.h" -#include "accessor_constructors_utility.h" #include "accessor_constructors_buffer_utility.h" -#include "accessor_constructors_local_utility.h" #include "accessor_constructors_image_utility.h" +#include "accessor_constructors_local_utility.h" +#include "accessor_constructors_utility.h" namespace TEST_NAMESPACE { /** tests the constructors for cl::sycl::accessor diff --git a/tests/accessor/accessor_constructors_fp64.cpp b/tests/accessor/accessor_constructors_fp64.cpp index 20a10544f..eaef16c73 100644 --- a/tests/accessor/accessor_constructors_fp64.cpp +++ b/tests/accessor/accessor_constructors_fp64.cpp @@ -9,10 +9,10 @@ #define TEST_NAME accessor_constructors_fp64 #include "../common/common.h" -#include "accessor_constructors_utility.h" #include "accessor_constructors_buffer_utility.h" -#include "accessor_constructors_local_utility.h" #include "accessor_constructors_image_utility.h" +#include "accessor_constructors_local_utility.h" +#include "accessor_constructors_utility.h" namespace TEST_NAMESPACE { diff --git a/tests/accessor/accessor_constructors_image.cpp b/tests/accessor/accessor_constructors_image.cpp index 039c7a1b2..5d8b68598 100644 --- a/tests/accessor/accessor_constructors_image.cpp +++ b/tests/accessor/accessor_constructors_image.cpp @@ -9,8 +9,8 @@ #define TEST_NAME accessor_constructors_image #include "../common/common.h" -#include "accessor_constructors_utility.h" #include "accessor_constructors_image_utility.h" +#include "accessor_constructors_utility.h" namespace TEST_NAMESPACE { diff --git a/tests/accessor/accessor_constructors_local.cpp b/tests/accessor/accessor_constructors_local.cpp index 6773c2695..91ee66ab1 100644 --- a/tests/accessor/accessor_constructors_local.cpp +++ b/tests/accessor/accessor_constructors_local.cpp @@ -9,8 +9,8 @@ #define TEST_NAME accessor_constructors_local #include "../common/common.h" -#include "accessor_constructors_utility.h" #include "accessor_constructors_local_utility.h" +#include "accessor_constructors_utility.h" namespace TEST_NAMESPACE { diff --git a/tests/accessor/accessor_utility.h b/tests/accessor/accessor_utility.h index 905fa6401..50e174998 100644 --- a/tests/accessor/accessor_utility.h +++ b/tests/accessor/accessor_utility.h @@ -12,8 +12,8 @@ #define SYCL_1_2_1_TESTS_ACCESSOR_ACCESSOR_UTILITY_H #include "../common/common.h" -#include #include +#include #include #include diff --git a/tests/address_space/address_space.cpp b/tests/address_space/address_space.cpp index f57346123..7f63ec8c7 100644 --- a/tests/address_space/address_space.cpp +++ b/tests/address_space/address_space.cpp @@ -8,8 +8,8 @@ #include "../common/common.h" -#include #include +#include #include #define EXPECT_EQUALS(lhs, rhs) \ diff --git a/tests/common/common.h b/tests/common/common.h index 51a249aad..7d4602520 100644 --- a/tests/common/common.h +++ b/tests/common/common.h @@ -12,20 +12,18 @@ // include our proxy to the real sycl header #include "sycl.h" -// test framework specific device selector -#include "../common/cts_selector.h" +#include "../../util/math_vector.h" +#include "../../util/proxy.h" +#include "../../util/test_base.h" #include "../common/cts_async_handler.h" +#include "../common/cts_selector.h" #include "../common/get_cts_object.h" -#include "../../util/proxy.h" #include "macros.h" -#include "../../util/test_base.h" -#include "../../util/math_vector.h" - -#include +#include #include +#include #include -#include namespace { diff --git a/tests/common/common_vec.h b/tests/common/common_vec.h index 1ac36a9da..a48cfe6c1 100644 --- a/tests/common/common_vec.h +++ b/tests/common/common_vec.h @@ -12,17 +12,15 @@ // include our proxy to the real sycl header #include "sycl.h" -// test framework specific device selector +#include "../../util/math_vector.h" +#include "../../util/proxy.h" +#include "../../util/test_base.h" #include "../common/common.h" -#include "../common/cts_selector.h" #include "../common/cts_async_handler.h" +#include "../common/cts_selector.h" #include "../common/get_cts_object.h" -#include "../../util/proxy.h" #include "macros.h" -#include "../../util/test_base.h" -#include "../../util/math_vector.h" - #include #include diff --git a/tests/common/macros.h b/tests/common/macros.h index 568c0279b..90fdd7379 100644 --- a/tests/common/macros.h +++ b/tests/common/macros.h @@ -9,9 +9,9 @@ #ifndef __SYCLCTS_TESTS_COMMON_MACROS_H #define __SYCLCTS_TESTS_COMMON_MACROS_H -#include "sycl.h" #include "../../util/opencl_helper.h" #include "../../util/type_names.h" +#include "sycl.h" #define TEST_FILE __FILE__ #define TEST_BUILD_DATE __DATE__ diff --git a/tests/common/main.cpp b/tests/common/main.cpp index 5674e2e5c..6938cad5f 100644 --- a/tests/common/main.cpp +++ b/tests/common/main.cpp @@ -9,8 +9,8 @@ #include #include -#include "./../../util/test_manager.h" #include "./../../util/collection.h" +#include "./../../util/test_manager.h" using namespace sycl_cts::util; diff --git a/tests/image/image_api.cpp b/tests/image/image_api.cpp index ce886ac35..613792798 100644 --- a/tests/image/image_api.cpp +++ b/tests/image/image_api.cpp @@ -6,8 +6,8 @@ // *******************************************************************************/ -#include "image_common.h" #include "../common/common.h" +#include "image_common.h" #define TEST_NAME image_api_core diff --git a/tests/image/image_api_fp16.cpp b/tests/image/image_api_fp16.cpp index 9b2c161dc..09ff02c2f 100644 --- a/tests/image/image_api_fp16.cpp +++ b/tests/image/image_api_fp16.cpp @@ -6,8 +6,8 @@ // *******************************************************************************/ -#include "image_common.h" #include "../common/common.h" +#include "image_common.h" #define TEST_NAME image_api_fp16 diff --git a/tests/image/image_constructors.cpp b/tests/image/image_constructors.cpp index c3546a091..3a64d97c4 100644 --- a/tests/image/image_constructors.cpp +++ b/tests/image/image_constructors.cpp @@ -6,8 +6,8 @@ // *******************************************************************************/ -#include "image_common.h" #include "../common/common.h" +#include "image_common.h" #define TEST_NAME image_constructors diff --git a/tests/opencl_interop/opencl_interop_constructors.cpp b/tests/opencl_interop/opencl_interop_constructors.cpp index 618d000df..61d4a02ba 100644 --- a/tests/opencl_interop/opencl_interop_constructors.cpp +++ b/tests/opencl_interop/opencl_interop_constructors.cpp @@ -6,9 +6,9 @@ // *******************************************************************************/ -#include "../common/common.h" #include "../../util/opencl_helper.h" #include "../../util/test_base_opencl.h" +#include "../common/common.h" #define TEST_NAME opencl_interop_constructors diff --git a/tests/opencl_interop/opencl_interop_get.cpp b/tests/opencl_interop/opencl_interop_get.cpp index f2073a9e7..8e1a56e3f 100644 --- a/tests/opencl_interop/opencl_interop_get.cpp +++ b/tests/opencl_interop/opencl_interop_get.cpp @@ -6,9 +6,9 @@ // *******************************************************************************/ -#include "../common/common.h" #include "../../util/opencl_helper.h" #include "../../util/test_base_opencl.h" +#include "../common/common.h" #define TEST_NAME opencl_interop_get diff --git a/tests/opencl_interop/opencl_interop_kernel.cpp b/tests/opencl_interop/opencl_interop_kernel.cpp index 27a0c3f5e..20e259324 100644 --- a/tests/opencl_interop/opencl_interop_kernel.cpp +++ b/tests/opencl_interop/opencl_interop_kernel.cpp @@ -6,9 +6,9 @@ // *******************************************************************************/ -#include "../common/common.h" #include "../../util/opencl_helper.h" #include "../../util/test_base_opencl.h" +#include "../common/common.h" #define TEST_NAME opencl_interop_kernel diff --git a/util/cmdarg.h b/util/cmdarg.h index 71b2d6dd6..172709c8a 100644 --- a/util/cmdarg.h +++ b/util/cmdarg.h @@ -9,8 +9,8 @@ #ifndef __SYCLCTS_UTIL_CMDARG_H #define __SYCLCTS_UTIL_CMDARG_H -#include "stl.h" #include "singleton.h" +#include "stl.h" namespace sycl_cts { namespace util { diff --git a/util/collection.cpp b/util/collection.cpp index d4181a3cd..4cc18dfe5 100644 --- a/util/collection.cpp +++ b/util/collection.cpp @@ -7,8 +7,8 @@ *******************************************************************************/ #include "collection.h" -#include "printer.h" #include "csv.h" +#include "printer.h" // conformance test suite namespace namespace sycl_cts { diff --git a/util/collection.h b/util/collection.h index 7bb850661..396a20bfb 100644 --- a/util/collection.h +++ b/util/collection.h @@ -9,9 +9,9 @@ #ifndef __SYCLCTS_UTIL_COLLECTION_H #define __SYCLCTS_UTIL_COLLECTION_H +#include "singleton.h" #include "stl.h" #include "test_base.h" -#include "singleton.h" namespace sycl_cts { namespace util { diff --git a/util/executor.cpp b/util/executor.cpp index b97ecb6ce..e1fc29b14 100644 --- a/util/executor.cpp +++ b/util/executor.cpp @@ -7,10 +7,10 @@ *******************************************************************************/ #include "executor.h" -#include "singleton.h" -#include "printer.h" #include "collection.h" #include "logger.h" +#include "printer.h" +#include "singleton.h" namespace sycl_cts { namespace util { diff --git a/util/logger.cpp b/util/logger.cpp index 483f27995..1ced32569 100644 --- a/util/logger.cpp +++ b/util/logger.cpp @@ -10,9 +10,9 @@ #define _CRT_SECURE_NO_WARNINGS #endif -#include #include #include +#include #include "logger.h" #include "printer.h" diff --git a/util/math_helper.h b/util/math_helper.h index cc4c50a63..1932da8ef 100644 --- a/util/math_helper.h +++ b/util/math_helper.h @@ -9,8 +9,8 @@ #ifndef __SYCLCTS_UTIL_MATH_HELPER_H #define __SYCLCTS_UTIL_MATH_HELPER_H -#include "../util/stl.h" #include "../tests/common/sycl.h" +#include "../util/stl.h" #include "./../oclmath/mt19937.h" #include "./math_vector.h" diff --git a/util/math_reference.h b/util/math_reference.h index 95218dc78..8c4167f09 100644 --- a/util/math_reference.h +++ b/util/math_reference.h @@ -9,9 +9,9 @@ #ifndef __SYCLCTS_UTIL_MATH_REFERENCE_H #define __SYCLCTS_UTIL_MATH_REFERENCE_H -#include "./stl.h" #include "../tests/common/sycl.h" #include "./math_helper.h" +#include "./stl.h" namespace reference { /* two argument relational reference */ diff --git a/util/opencl_helper.h b/util/opencl_helper.h index 7f8ef41f4..cd1f1199f 100644 --- a/util/opencl_helper.h +++ b/util/opencl_helper.h @@ -11,8 +11,8 @@ #include -#include "singleton.h" #include "logger.h" +#include "singleton.h" namespace sycl_cts { namespace util { diff --git a/util/printer.cpp b/util/printer.cpp index 67b5367a0..532c54186 100644 --- a/util/printer.cpp +++ b/util/printer.cpp @@ -10,13 +10,13 @@ #define _CRT_SECURE_NO_WARNINGS #endif -#include -#include #include #include +#include +#include -#include "printer.h" #include "logger.h" +#include "printer.h" namespace sycl_cts { namespace util { diff --git a/util/printer.h b/util/printer.h index 13663ee60..82686bdf4 100644 --- a/util/printer.h +++ b/util/printer.h @@ -9,8 +9,8 @@ #ifndef __SYCLCTS_UTIL_PRINTER_H #define __SYCLCTS_UTIL_PRINTER_H -#include "stl.h" #include "singleton.h" +#include "stl.h" #include "test_base.h" namespace sycl_cts { diff --git a/util/selector.h b/util/selector.h index 5bd92a0fc..a679af92c 100644 --- a/util/selector.h +++ b/util/selector.h @@ -9,8 +9,8 @@ #ifndef __SYCLCTS_UTIL_SELECTOR_H #define __SYCLCTS_UTIL_SELECTOR_H -#include "stl.h" #include "singleton.h" +#include "stl.h" namespace sycl_cts { namespace util { diff --git a/util/stl.h b/util/stl.h index ce48f6173..7f02bf1c4 100644 --- a/util/stl.h +++ b/util/stl.h @@ -26,8 +26,8 @@ #include // cout -#include #include +#include // std::sort() #include diff --git a/util/test_manager.cpp b/util/test_manager.cpp index b88a2cee1..597c03766 100644 --- a/util/test_manager.cpp +++ b/util/test_manager.cpp @@ -8,13 +8,13 @@ #include -#include "test_manager.h" +#include "../tests/common/cts_selector.h" #include "cmdarg.h" #include "collection.h" +#include "executor.h" #include "printer.h" #include "selector.h" -#include "executor.h" -#include "../tests/common/cts_selector.h" +#include "test_manager.h" #if defined(_MSC_VER) extern "C" extern long __stdcall IsDebuggerPresent();