lj_assert.c 610 B

12345678910111213141516171819202122232425262728
  1. /*
  2. ** Internal assertions.
  3. ** Copyright (C) 2005-2023 Mike Pall. See Copyright Notice in luajit.h
  4. */
  5. #define lj_assert_c
  6. #define LUA_CORE
  7. #if defined(LUA_USE_ASSERT) || defined(LUA_USE_APICHECK)
  8. #include <stdio.h>
  9. #include "lj_obj.h"
  10. void lj_assert_fail(global_State *g, const char *file, int line,
  11. const char *func, const char *fmt, ...)
  12. {
  13. va_list argp;
  14. va_start(argp, fmt);
  15. fprintf(stderr, "LuaJIT ASSERT %s:%d: %s: ", file, line, func);
  16. vfprintf(stderr, fmt, argp);
  17. fputc('\n', stderr);
  18. va_end(argp);
  19. UNUSED(g); /* May be NULL. TODO: optionally dump state. */
  20. abort();
  21. }
  22. #endif