Skip to content

Commit d871541

Browse files
[SYCL] Fix min and max builtins on Windows (#8752)
Tests for min and max builtins fail on Windows with recent changes. This is due to these being defined as macros, causing their use inside the generators to fail. This commit fixes this by enclosing them in parentheses. Fixes #8717. Signed-off-by: Larsen, Steffen <[email protected]>
1 parent b18e6ea commit d871541

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

sycl/include/sycl/builtins.hpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -929,12 +929,14 @@ __SYCL_MARRAY_COMMON_FUNCTION_UNOP_OVERLOAD(sign, T x, x[i])
929929
__SYCL_MARRAY_COMMON_FUNCTION_OVERLOAD_IMPL(NAME, __VA_ARGS__) \
930930
}
931931

932-
__SYCL_MARRAY_COMMON_FUNCTION_BINOP_OVERLOAD(min, T x, T y, x[i], y[i])
933-
__SYCL_MARRAY_COMMON_FUNCTION_BINOP_OVERLOAD(min, T x,
932+
// min and max may be defined as macros, so we wrap them in parentheses to avoid
933+
// errors.
934+
__SYCL_MARRAY_COMMON_FUNCTION_BINOP_OVERLOAD((min), T x, T y, x[i], y[i])
935+
__SYCL_MARRAY_COMMON_FUNCTION_BINOP_OVERLOAD((min), T x,
934936
detail::marray_element_type<T> y,
935937
x[i], y)
936-
__SYCL_MARRAY_COMMON_FUNCTION_BINOP_OVERLOAD(max, T x, T y, x[i], y[i])
937-
__SYCL_MARRAY_COMMON_FUNCTION_BINOP_OVERLOAD(max, T x,
938+
__SYCL_MARRAY_COMMON_FUNCTION_BINOP_OVERLOAD((max), T x, T y, x[i], y[i])
939+
__SYCL_MARRAY_COMMON_FUNCTION_BINOP_OVERLOAD((max), T x,
938940
detail::marray_element_type<T> y,
939941
x[i], y)
940942
__SYCL_MARRAY_COMMON_FUNCTION_BINOP_OVERLOAD(step, T edge, T x, edge[i], x[i])

0 commit comments

Comments
 (0)