We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b3be72a commit 3d5db69Copy full SHA for 3d5db69
Code_Exercises/helpers.hpp
@@ -13,13 +13,14 @@
13
#include <cstddef> // for size_t
14
15
#ifndef __SYCL_DEVICE_ONLY__
16
-extern "C" void __assert_fail(const char* __assertion, const char* __file,
17
- unsigned int __line, const char* __function);
18
-
+#include <cstdio> // fprintf
+#include <cstdlib> // abort
19
#define SYCLACADEMY_ASSERT(cond) \
20
- (static_cast<bool>(cond) \
21
- ? void(0) \
22
- : __assert_fail(#cond, __FILE__, __LINE__, __FUNCTION__))
+ if (!(cond)) { \
+ std::fprintf(stderr, "%s failed in %s:%d:%s\nExiting\n", #cond, \
+ __BASE_FILE__, __LINE__, __FUNCTION__); \
+ std::abort(); \
23
+ }
24
#else
25
#define SYCLACADEMY_ASSERT(cond) void(0);
26
#endif
0 commit comments