Skip to content

Commit e0edd71

Browse files
committed
Wrap new fprintf, abort code in INK_ENABLE_CSTD
1 parent 162dc16 commit e0edd71

1 file changed

Lines changed: 9 additions & 12 deletions

File tree

shared/public/system.h

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -215,20 +215,17 @@ void ink_assert(bool condition, const char* msg = nullptr, Args... args)
215215
size_t size = snprintf(nullptr, 0, msg, args...) + 1;
216216
char* message = static_cast<char*>(malloc(size));
217217
snprintf(message, size, msg, args...);
218+
msg = message;
219+
}
220+
218221
# ifdef INK_ENABLE_EXCEPTIONS
219-
throw ink_exception(message);
220-
# else
221-
fprintf(stderr, "Ink Assert: %s\n", message);
222-
abort();
223-
# endif
224-
} else {
225-
# ifdef INK_ENABLE_EXCEPTIONS
226-
throw ink_exception(msg);
227-
# else
228-
fprintf(stderr, "Ink Assert: %s\n", msg);
229-
abort();
222+
throw ink_exception(msg);
223+
# elif defined(INK_ENABLE_CSTD)
224+
fprintf(stderr, "Ink Assert: %s\n", msg);
225+
abort();
226+
#else
227+
#error "This path needs a way to warn and then terminate, otherwise it'll silently fail"
230228
# endif
231-
}
232229
}
233230
}
234231

0 commit comments

Comments
 (0)