summaryrefslogtreecommitdiff
path: root/libs/luajit-cmake/luajit/src/lj_assert.c
blob: 4b713b2b0bbb9cc9a70f2a715efe381e1ef838bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
** Internal assertions.
** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h
*/

#define lj_assert_c
#define LUA_CORE

#if defined(LUA_USE_ASSERT) || defined(LUA_USE_APICHECK)

#include <stdio.h>

#include "lj_obj.h"

void lj_assert_fail(global_State *g, const char *file, int line,
		    const char *func, const char *fmt, ...)
{
  va_list argp;
  va_start(argp, fmt);
  fprintf(stderr, "LuaJIT ASSERT %s:%d: %s: ", file, line, func);
  vfprintf(stderr, fmt, argp);
  fputc('\n', stderr);
  va_end(argp);
  UNUSED(g);  /* May be NULL. TODO: optionally dump state. */
  abort();
}

#endif