Skip to content

Commit 0203c6c

Browse files
authored
[SYCL] Fix macro in device library function declaration (#1324)
As our compiler are based on LLVM , so: "if defined(__GNUC__) || defined(__clang__)" will always be true as __clang__ will always be defined and "elif defined(_MSC_VER)" will always be false as only _MSC_VER is a Microsoft CL compiler's macro telling its version. Current code will lead to std::assert building failure on Windows. Signed-off-by: gejin <[email protected]>
1 parent 197b24a commit 0203c6c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sycl/include/CL/sycl/builtins.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1543,17 +1543,17 @@ detail::enable_if_t<detail::is_genfloatf<T>::value, T> tan(T x) __NOEXC {
15431543
} // __SYCL_INLINE_NAMESPACE(cl)
15441544

15451545
#ifdef __SYCL_DEVICE_ONLY__
1546-
#if defined(__GNUC__) || defined(__clang__)
1546+
#ifdef __GLIBC__
15471547
extern "C" {
15481548
extern SYCL_EXTERNAL void __assert_fail(const char *expr, const char *file,
15491549
unsigned int line, const char *func);
15501550
}
1551-
#elif defined(_MSC_VER)
1551+
#elif defined(_WIN32)
15521552
extern "C" {
15531553
extern SYCL_EXTERNAL void _wassert(const wchar_t *wexpr, const wchar_t *wfile,
15541554
unsigned line);
15551555
}
1556-
#endif // defined(_MSC_VER_)
1556+
#endif
15571557
#endif // __SYCL_DEVICE_ONLY__
15581558

15591559
#undef __NOEXC

0 commit comments

Comments
 (0)