Index: pstl/.clang-format =================================================================== --- pstl/.clang-format +++ pstl/.clang-format @@ -15,3 +15,6 @@ # Disable formatting options which may break tests. SortIncludes: false ReflowComments: false + +# Indent preprocessor directives +IndentPPDirectives: AfterHash Index: pstl/include/pstl/algorithm =================================================================== --- pstl/include/pstl/algorithm +++ pstl/include/pstl/algorithm @@ -14,11 +14,11 @@ #if __PSTL_EXECUTION_POLICIES_DEFINED // If has already been included, pull in implementations -#include "internal/glue_algorithm_impl.h" +# include "internal/glue_algorithm_impl.h" #else // Otherwise just pull in forward declarations -#include "internal/glue_algorithm_defs.h" -#define __PSTL_ALGORITHM_FORWARD_DECLARED 1 +# include "internal/glue_algorithm_defs.h" +# define __PSTL_ALGORITHM_FORWARD_DECLARED 1 #endif #endif /* __PSTL_algorithm */ Index: pstl/include/pstl/execution =================================================================== --- pstl/include/pstl/execution +++ pstl/include/pstl/execution @@ -16,21 +16,21 @@ #define __PSTL_EXECUTION_POLICIES_DEFINED 1 #if __PSTL_ALGORITHM_FORWARD_DECLARED -#include "internal/glue_algorithm_impl.h" +# include "internal/glue_algorithm_impl.h" #endif #if __PSTL_MEMORY_FORWARD_DECLARED -#include "internal/glue_memory_impl.h" +# include "internal/glue_memory_impl.h" #endif #if __PSTL_NUMERIC_FORWARD_DECLARED -#include "internal/glue_numeric_impl.h" +# include "internal/glue_numeric_impl.h" #endif #if __PSTL_CPP17_EXECUTION_POLICIES_PRESENT __PSTL_PRAGMA_MESSAGE_POLICIES("The execution policies are defined in the namespace __pstl::execution") #else -#include "internal/glue_execution_defs.h" +# include "internal/glue_execution_defs.h" __PSTL_PRAGMA_MESSAGE_POLICIES( "The execution policies are injected into the standard namespace std::execution") #endif Index: pstl/include/pstl/internal/algorithm_impl.h =================================================================== --- pstl/include/pstl/internal/algorithm_impl.h +++ pstl/include/pstl/internal/algorithm_impl.h @@ -21,8 +21,8 @@ #include "unseq_backend_simd.h" #if __PSTL_USE_PAR_POLICIES -#include "parallel_backend.h" -#include "parallel_impl.h" +# include "parallel_backend.h" +# include "parallel_impl.h" #endif namespace __pstl @@ -2180,11 +2180,11 @@ _ForwardIterator __j1 = __first + (__j - __d_first); // 1. Copy elements from input to output -#if !__PSTL_ICC_18_OMP_SIMD_BROKEN +# if !__PSTL_ICC_18_OMP_SIMD_BROKEN brick_copy(__i1, __j1, __i, __is_vector); -#else +# else std::copy(__i1, __j1, __i); -#endif +# endif // 2. Sort elements in output sequence std::sort(__i, __j, __comp); }, Index: pstl/include/pstl/internal/glue_execution_defs.h =================================================================== --- pstl/include/pstl/internal/glue_execution_defs.h +++ pstl/include/pstl/internal/glue_execution_defs.h @@ -19,12 +19,12 @@ // Type trait using __pstl::execution::is_execution_policy; #if __PSTL_CPP14_VARIABLE_TEMPLATES_PRESENT -#if __INTEL_COMPILER +# if __INTEL_COMPILER template constexpr bool is_execution_policy_v = is_execution_policy::value; -#else +# else using __pstl::execution::is_execution_policy_v; -#endif +# endif #endif namespace execution Index: pstl/include/pstl/internal/numeric_impl.h =================================================================== --- pstl/include/pstl/internal/numeric_impl.h +++ pstl/include/pstl/internal/numeric_impl.h @@ -19,7 +19,7 @@ #include "unseq_backend_simd.h" #if __PSTL_USE_PAR_POLICIES -#include "parallel_backend.h" +# include "parallel_backend.h" #endif namespace __pstl Index: pstl/include/pstl/internal/parallel_backend.h =================================================================== --- pstl/include/pstl/internal/parallel_backend.h +++ pstl/include/pstl/internal/parallel_backend.h @@ -11,7 +11,7 @@ #define __PSTL_parallel_backend_H #if __PSTL_PAR_BACKEND_TBB -#include "parallel_backend_tbb.h" +# include "parallel_backend_tbb.h" #else __PSTL_PRAGMA_MESSAGE("Parallel backend was not specified"); #endif Index: pstl/include/pstl/internal/parallel_backend_tbb.h =================================================================== --- pstl/include/pstl/internal/parallel_backend_tbb.h +++ pstl/include/pstl/internal/parallel_backend_tbb.h @@ -26,7 +26,7 @@ #include #if TBB_INTERFACE_VERSION < 10000 -#error Intel(R) Threading Building Blocks 2018 is required; older versions are not supported. +# error Intel(R) Threading Building Blocks 2018 is required; older versions are not supported. #endif namespace __pstl Index: pstl/include/pstl/internal/pstl_config.h =================================================================== --- pstl/include/pstl/internal/pstl_config.h +++ pstl/include/pstl/internal/pstl_config.h @@ -16,35 +16,35 @@ // Check the user-defined macro for parallel policies #if defined(PSTL_USE_PARALLEL_POLICIES) -#undef __PSTL_USE_PAR_POLICIES -#define __PSTL_USE_PAR_POLICIES PSTL_USE_PARALLEL_POLICIES +# undef __PSTL_USE_PAR_POLICIES +# define __PSTL_USE_PAR_POLICIES PSTL_USE_PARALLEL_POLICIES // Check the internal macro for parallel policies #elif !defined(__PSTL_USE_PAR_POLICIES) -#define __PSTL_USE_PAR_POLICIES 1 +# define __PSTL_USE_PAR_POLICIES 1 #endif #if __PSTL_USE_PAR_POLICIES -#if !defined(__PSTL_PAR_BACKEND_TBB) -#define __PSTL_PAR_BACKEND_TBB 1 -#endif +# if !defined(__PSTL_PAR_BACKEND_TBB) +# define __PSTL_PAR_BACKEND_TBB 1 +# endif #else -#undef __PSTL_PAR_BACKEND_TBB +# undef __PSTL_PAR_BACKEND_TBB #endif // Check the user-defined macro for warnings #if defined(PSTL_USAGE_WARNINGS) -#undef __PSTL_USAGE_WARNINGS -#define __PSTL_USAGE_WARNINGS PSTL_USAGE_WARNINGS +# undef __PSTL_USAGE_WARNINGS +# define __PSTL_USAGE_WARNINGS PSTL_USAGE_WARNINGS // Check the internal macro for warnings #elif !defined(__PSTL_USAGE_WARNINGS) -#define __PSTL_USAGE_WARNINGS 0 +# define __PSTL_USAGE_WARNINGS 0 #endif // Portability "#pragma" definition #ifdef _MSC_VER -#define __PSTL_PRAGMA(x) __pragma(x) +# define __PSTL_PRAGMA(x) __pragma(x) #else -#define __PSTL_PRAGMA(x) _Pragma(#x) +# define __PSTL_PRAGMA(x) _Pragma(# x) #endif #define __PSTL_STRING_AUX(x) #x @@ -57,38 +57,38 @@ #if __clang__ // according to clang documentation, version can be vendor specific -#define __PSTL_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) +# define __PSTL_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) #endif // Enable SIMD for compilers that support OpenMP 4.0 #if (_OPENMP >= 201307) || (__INTEL_COMPILER >= 1600) || (!defined(__INTEL_COMPILER) && __PSTL_GCC_VERSION >= 40900) -#define __PSTL_PRAGMA_SIMD __PSTL_PRAGMA(omp simd) -#define __PSTL_PRAGMA_DECLARE_SIMD __PSTL_PRAGMA(omp declare simd) -#define __PSTL_PRAGMA_SIMD_REDUCTION(PRM) __PSTL_PRAGMA(omp simd reduction(PRM)) +# define __PSTL_PRAGMA_SIMD __PSTL_PRAGMA(omp simd) +# define __PSTL_PRAGMA_DECLARE_SIMD __PSTL_PRAGMA(omp declare simd) +# define __PSTL_PRAGMA_SIMD_REDUCTION(PRM) __PSTL_PRAGMA(omp simd reduction(PRM)) #elif !defined(_MSC_VER) //#pragma simd -#define __PSTL_PRAGMA_SIMD __PSTL_PRAGMA(simd) -#define __PSTL_PRAGMA_DECLARE_SIMD -#define __PSTL_PRAGMA_SIMD_REDUCTION(PRM) __PSTL_PRAGMA(simd reduction(PRM)) +# define __PSTL_PRAGMA_SIMD __PSTL_PRAGMA(simd) +# define __PSTL_PRAGMA_DECLARE_SIMD +# define __PSTL_PRAGMA_SIMD_REDUCTION(PRM) __PSTL_PRAGMA(simd reduction(PRM)) #else //no simd -#define __PSTL_PRAGMA_SIMD -#define __PSTL_PRAGMA_DECLARE_SIMD -#define __PSTL_PRAGMA_SIMD_REDUCTION(PRM) +# define __PSTL_PRAGMA_SIMD +# define __PSTL_PRAGMA_DECLARE_SIMD +# define __PSTL_PRAGMA_SIMD_REDUCTION(PRM) #endif //Enable SIMD #if (__INTEL_COMPILER) -#define __PSTL_PRAGMA_FORCEINLINE __PSTL_PRAGMA(forceinline) +# define __PSTL_PRAGMA_FORCEINLINE __PSTL_PRAGMA(forceinline) #else -#define __PSTL_PRAGMA_FORCEINLINE +# define __PSTL_PRAGMA_FORCEINLINE #endif #if (__INTEL_COMPILER >= 1900) -#define __PSTL_PRAGMA_SIMD_SCAN(PRM) __PSTL_PRAGMA(omp simd reduction(inscan, PRM)) -#define __PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM) __PSTL_PRAGMA(omp scan inclusive(PRM)) -#define __PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM) __PSTL_PRAGMA(omp scan exclusive(PRM)) +# define __PSTL_PRAGMA_SIMD_SCAN(PRM) __PSTL_PRAGMA(omp simd reduction(inscan, PRM)) +# define __PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM) __PSTL_PRAGMA(omp scan inclusive(PRM)) +# define __PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM) __PSTL_PRAGMA(omp scan exclusive(PRM)) #else -#define __PSTL_PRAGMA_SIMD_SCAN(PRM) -#define __PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM) -#define __PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM) +# define __PSTL_PRAGMA_SIMD_SCAN(PRM) +# define __PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM) +# define __PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM) #endif // Should be defined to 1 for environments with a vendor implementation of C++17 execution policies @@ -106,25 +106,25 @@ #define __PSTL_MONOTONIC_PRESENT (__INTEL_COMPILER >= 1800) #if (__INTEL_COMPILER >= 1900 || !defined(__INTEL_COMPILER) && __PSTL_GCC_VERSION >= 40900 || _OPENMP >= 201307) -#define __PSTL_UDR_PRESENT 1 +# define __PSTL_UDR_PRESENT 1 #else -#define __PSTL_UDR_PRESENT 0 +# define __PSTL_UDR_PRESENT 0 #endif #define __PSTL_UDS_PRESENT (__INTEL_COMPILER >= 1900 && __INTEL_COMPILER_BUILD_DATE >= 20180626) #if __PSTL_EARLYEXIT_PRESENT -#define __PSTL_PRAGMA_SIMD_EARLYEXIT __PSTL_PRAGMA(omp simd early_exit) +# define __PSTL_PRAGMA_SIMD_EARLYEXIT __PSTL_PRAGMA(omp simd early_exit) #else -#define __PSTL_PRAGMA_SIMD_EARLYEXIT +# define __PSTL_PRAGMA_SIMD_EARLYEXIT #endif #if __PSTL_MONOTONIC_PRESENT -#define __PSTL_PRAGMA_SIMD_ORDERED_MONOTONIC(PRM) __PSTL_PRAGMA(omp ordered simd monotonic(PRM)) -#define __PSTL_PRAGMA_SIMD_ORDERED_MONOTONIC_2ARGS(PRM1, PRM2) __PSTL_PRAGMA(omp ordered simd monotonic(PRM1, PRM2)) +# define __PSTL_PRAGMA_SIMD_ORDERED_MONOTONIC(PRM) __PSTL_PRAGMA(omp ordered simd monotonic(PRM)) +# define __PSTL_PRAGMA_SIMD_ORDERED_MONOTONIC_2ARGS(PRM1, PRM2) __PSTL_PRAGMA(omp ordered simd monotonic(PRM1, PRM2)) #else -#define __PSTL_PRAGMA_SIMD_ORDERED_MONOTONIC(PRM) -#define __PSTL_PRAGMA_SIMD_ORDERED_MONOTONIC_2ARGS(PRM1, PRM2) +# define __PSTL_PRAGMA_SIMD_ORDERED_MONOTONIC(PRM) +# define __PSTL_PRAGMA_SIMD_ORDERED_MONOTONIC_2ARGS(PRM1, PRM2) #endif // Declaration of reduction functor, where @@ -135,35 +135,35 @@ // omp_priv - refers to the private copy of the initial value // omp_orig - refers to the original variable to be reduced #define __PSTL_PRAGMA_DECLARE_REDUCTION(NAME, OP) \ - __PSTL_PRAGMA(omp declare reduction(NAME : OP : omp_out(omp_in)) initializer(omp_priv = omp_orig)) + __PSTL_PRAGMA(omp declare reduction(NAME:OP : omp_out(omp_in)) initializer(omp_priv = omp_orig)) #if (__INTEL_COMPILER >= 1600) -#define __PSTL_PRAGMA_VECTOR_UNALIGNED __PSTL_PRAGMA(vector unaligned) +# define __PSTL_PRAGMA_VECTOR_UNALIGNED __PSTL_PRAGMA(vector unaligned) #else -#define __PSTL_PRAGMA_VECTOR_UNALIGNED +# define __PSTL_PRAGMA_VECTOR_UNALIGNED #endif // Check the user-defined macro to use non-temporal stores #if defined(PSTL_USE_NONTEMPORAL_STORES) && (__INTEL_COMPILER >= 1600) -#define __PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED __PSTL_PRAGMA(vector nontemporal) +# define __PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED __PSTL_PRAGMA(vector nontemporal) #else -#define __PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED +# define __PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED #endif #if _MSC_VER || __INTEL_COMPILER //the preprocessors don't type a message location -#define __PSTL_PRAGMA_LOCATION __FILE__ ":" __PSTL_STRING(__LINE__) ": [Parallel STL message]: " +# define __PSTL_PRAGMA_LOCATION __FILE__ ":" __PSTL_STRING(__LINE__) ": [Parallel STL message]: " #else -#define __PSTL_PRAGMA_LOCATION " [Parallel STL message]: " +# define __PSTL_PRAGMA_LOCATION " [Parallel STL message]: " #endif #define __PSTL_PRAGMA_MESSAGE_IMPL(x) __PSTL_PRAGMA(message(__PSTL_STRING_CONCAT(__PSTL_PRAGMA_LOCATION, x))) #if __PSTL_USAGE_WARNINGS -#define __PSTL_PRAGMA_MESSAGE(x) __PSTL_PRAGMA_MESSAGE_IMPL(x) -#define __PSTL_PRAGMA_MESSAGE_POLICIES(x) __PSTL_PRAGMA_MESSAGE_IMPL(x) +# define __PSTL_PRAGMA_MESSAGE(x) __PSTL_PRAGMA_MESSAGE_IMPL(x) +# define __PSTL_PRAGMA_MESSAGE_POLICIES(x) __PSTL_PRAGMA_MESSAGE_IMPL(x) #else -#define __PSTL_PRAGMA_MESSAGE(x) -#define __PSTL_PRAGMA_MESSAGE_POLICIES(x) +# define __PSTL_PRAGMA_MESSAGE(x) +# define __PSTL_PRAGMA_MESSAGE_POLICIES(x) #endif // broken macros Index: pstl/include/pstl/memory =================================================================== --- pstl/include/pstl/memory +++ pstl/include/pstl/memory @@ -14,11 +14,11 @@ #if __PSTL_EXECUTION_POLICIES_DEFINED // If has already been included, pull in implementations -#include "internal/glue_memory_impl.h" +# include "internal/glue_memory_impl.h" #else // Otherwise just pull in forward declarations -#include "internal/glue_memory_defs.h" -#define __PSTL_MEMORY_FORWARD_DECLARED 1 +# include "internal/glue_memory_defs.h" +# define __PSTL_MEMORY_FORWARD_DECLARED 1 #endif #endif /* __PSTL_memory */ Index: pstl/include/pstl/numeric =================================================================== --- pstl/include/pstl/numeric +++ pstl/include/pstl/numeric @@ -14,11 +14,11 @@ #if __PSTL_EXECUTION_POLICIES_DEFINED // If has already been included, pull in implementations -#include "internal/glue_numeric_impl.h" +# include "internal/glue_numeric_impl.h" #else // Otherwise just pull in forward declarations -#include "internal/glue_numeric_defs.h" -#define __PSTL_NUMERIC_FORWARD_DECLARED 1 +# include "internal/glue_numeric_defs.h" +# define __PSTL_NUMERIC_FORWARD_DECLARED 1 #endif #endif /* __PSTL_numeric */