Skip to content

Commit

Permalink
[SYCL][COMPAT][E2E] Removes std++20 usage from syclcompat e2e tests (#…
Browse files Browse the repository at this point in the history
…14916)

Removes c++20 features from the e2e tests to avoid introducing c++20 in
SYCLcompat by accident

Signed-off-by: Alberto Cabrera <alberto.cabrera@codeplay.com>
  • Loading branch information
Alcpz authored Aug 19, 2024
1 parent 0f5ee07 commit fd47adf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
21 changes: 11 additions & 10 deletions sycl/test-e2e/syclcompat/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,22 @@

constexpr double ERROR_TOLERANCE = 1e-5;

// Typed call helper
// Iterates over all types and calls Functor f for each of them
template <typename Functor, template <typename...> class Container,
typename... Ts>
void for_each_type_call(Functor &&f, Container<Ts...> *) {
(f.template operator()<Ts>(), ...);
template <typename Tuple, typename Func, std::size_t... Is>
void for_each_type_call(Func &&f, std::index_sequence<Is...>) {
(f(std::integral_constant<std::size_t, Is>{}), ...);
}

template <typename tuple, typename Functor>
void instantiate_all_types(Functor &&f) {
for_each_type_call(f, static_cast<tuple *>(nullptr));
template <typename Tuple, typename Func> void instantiate_all_types(Func &&f) {
for_each_type_call<Tuple>(
std::forward<Func>(f),
std::make_index_sequence<std::tuple_size_v<Tuple>>{});
}

#define INSTANTIATE_ALL_TYPES(tuple, f) \
instantiate_all_types<tuple>([]<typename T>() { f<T>(); });
instantiate_all_types<tuple>([](auto index) { \
using T = std::tuple_element_t<decltype(index)::value, tuple>; \
f<T>(); \
});

using value_type_list =
std::tuple<int, unsigned int, short, unsigned short, long, unsigned long,
Expand Down
2 changes: 1 addition & 1 deletion sycl/test-e2e/syclcompat/lit.local.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ for substitution in config.substitutions:
if substitution[0] == "%clangxx":
original_clangxx=substitution[1]
config.substitutions.insert(0,
("%clangxx", original_clangxx + ' -Wno-error=c++20-extensions -Wno-error=#warnings -Wno-error=deprecated-declarations'))
("%clangxx", original_clangxx + ' -Wno-error=#warnings -Wno-error=deprecated-declarations'))

0 comments on commit fd47adf

Please sign in to comment.