mirror of
https://github.com/lua/lua
synced 2026-09-26 16:17:11 +03:00
Macro LUAI_ASSERT eases turning assertions on
This commit is contained in:
parent
56ec432281
commit
6f5bd5072d
3 changed files with 11 additions and 4 deletions
10
llimits.h
10
llimits.h
|
|
@ -84,7 +84,15 @@ typedef LUAI_UACNUMBER l_uacNumber;
|
||||||
typedef LUAI_UACINT l_uacInt;
|
typedef LUAI_UACINT l_uacInt;
|
||||||
|
|
||||||
|
|
||||||
/* internal assertions for in-house debugging */
|
/*
|
||||||
|
** Internal assertions for in-house debugging
|
||||||
|
*/
|
||||||
|
#if defined LUAI_ASSERT
|
||||||
|
#undef NDEBUG
|
||||||
|
#include <assert.h>
|
||||||
|
#define lua_assert(c) assert(c)
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(lua_assert)
|
#if defined(lua_assert)
|
||||||
#define check_exp(c,e) (lua_assert(c), (e))
|
#define check_exp(c,e) (lua_assert(c), (e))
|
||||||
/* to avoid problems with conditions too long */
|
/* to avoid problems with conditions too long */
|
||||||
|
|
|
||||||
4
ltests.h
4
ltests.h
|
|
@ -20,9 +20,7 @@
|
||||||
|
|
||||||
|
|
||||||
/* turn on assertions */
|
/* turn on assertions */
|
||||||
#undef NDEBUG
|
#define LUAI_ASSERT
|
||||||
#include <assert.h>
|
|
||||||
#define lua_assert(c) assert(c)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
1
makefile
1
makefile
|
|
@ -38,6 +38,7 @@ CWARNSC= -Wdeclaration-after-statement \
|
||||||
CWARNS= $(CWARNSCPP) $(CWARNSC)
|
CWARNS= $(CWARNSCPP) $(CWARNSC)
|
||||||
|
|
||||||
# Some useful compiler options for internal tests:
|
# Some useful compiler options for internal tests:
|
||||||
|
# -DLUAI_ASSERT turns on all assertions inside Lua.
|
||||||
# -DHARDSTACKTESTS forces a reallocation of the stack at every point where
|
# -DHARDSTACKTESTS forces a reallocation of the stack at every point where
|
||||||
# the stack can be reallocated.
|
# the stack can be reallocated.
|
||||||
# -DHARDMEMTESTS forces a full collection at all points where the collector
|
# -DHARDMEMTESTS forces a full collection at all points where the collector
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue