Skip to content

Commit

Permalink
[core] fix print formatting in (dumb) assert
Browse files Browse the repository at this point in the history
If the assert condition contains a `%` weird things could happen. It was interpreted as a format specifier, which leads to errors/warnings.
  • Loading branch information
MarcelKoch committed Jun 21, 2024
1 parent 65cc982 commit 8a9d85d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions include/ginkgo/core/base/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,10 @@
#else // NDEBUG
// Poor man's assertions on GPUs for MACs. They won't terminate the program
// but will at least print something on the screen
#define GKO_ASSERT(condition) \
((condition) \
? ((void)0) \
: ((void)printf("%s: %d: %s: Assertion `" #condition "' failed\n", \
__FILE__, __LINE__, __func__)))
#define GKO_ASSERT(condition) \
((condition) ? ((void)0) \
: ((void)printf("%s: %d: %s: Assertion `%s` failed\n", \
__FILE__, __LINE__, __func__, #condition)))
#endif // NDEBUG

#else // (defined(__CUDA_ARCH__) && defined(__APPLE__)) ||
Expand Down

0 comments on commit 8a9d85d

Please sign in to comment.