aboutsummaryrefslogtreecommitdiff
path: root/src/lj_ctype.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_ctype.h')
-rw-r--r--src/lj_ctype.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/lj_ctype.h b/src/lj_ctype.h
index 73cefef8..8c8fc790 100644
--- a/src/lj_ctype.h
+++ b/src/lj_ctype.h
@@ -260,6 +260,12 @@ typedef struct CTState {
260 260
261#define CT_MEMALIGN 3 /* Alignment guaranteed by memory allocator. */ 261#define CT_MEMALIGN 3 /* Alignment guaranteed by memory allocator. */
262 262
263#ifdef LUA_USE_ASSERT
264#define lj_assertCTS(c, ...) (lj_assertG_(cts->g, (c), __VA_ARGS__))
265#else
266#define lj_assertCTS(c, ...) ((void)cts)
267#endif
268
263/* -- Predefined types ---------------------------------------------------- */ 269/* -- Predefined types ---------------------------------------------------- */
264 270
265/* Target-dependent types. */ 271/* Target-dependent types. */
@@ -392,7 +398,8 @@ static LJ_AINLINE CTState *ctype_cts(lua_State *L)
392/* Check C type ID for validity when assertions are enabled. */ 398/* Check C type ID for validity when assertions are enabled. */
393static LJ_AINLINE CTypeID ctype_check(CTState *cts, CTypeID id) 399static LJ_AINLINE CTypeID ctype_check(CTState *cts, CTypeID id)
394{ 400{
395 lua_assert(id > 0 && id < cts->top); UNUSED(cts); 401 UNUSED(cts);
402 lj_assertCTS(id > 0 && id < cts->top, "bad CTID %d", id);
396 return id; 403 return id;
397} 404}
398 405
@@ -408,8 +415,9 @@ static LJ_AINLINE CType *ctype_get(CTState *cts, CTypeID id)
408/* Get child C type. */ 415/* Get child C type. */
409static LJ_AINLINE CType *ctype_child(CTState *cts, CType *ct) 416static LJ_AINLINE CType *ctype_child(CTState *cts, CType *ct)
410{ 417{
411 lua_assert(!(ctype_isvoid(ct->info) || ctype_isstruct(ct->info) || 418 lj_assertCTS(!(ctype_isvoid(ct->info) || ctype_isstruct(ct->info) ||
412 ctype_isbitfield(ct->info))); /* These don't have children. */ 419 ctype_isbitfield(ct->info)),
420 "ctype %08x has no children", ct->info);
413 return ctype_get(cts, ctype_cid(ct->info)); 421 return ctype_get(cts, ctype_cid(ct->info));
414} 422}
415 423