lua

A copy of the Lua development repository
Log | Files | Refs | README

commit 6f5bd5072dff07679c390eecfeaa9d20cc45a9ef
parent 56ec4322817b0e9aef6084c278dcf24fda7bed1c
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Wed,  8 Jul 2020 15:51:28 -0300

Macro LUAI_ASSERT eases turning assertions on

Diffstat:
Mllimits.h | 10+++++++++-
Mltests.h | 4+---
Mmakefile | 1+
3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/llimits.h b/llimits.h @@ -84,7 +84,15 @@ typedef LUAI_UACNUMBER l_uacNumber; 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) #define check_exp(c,e) (lua_assert(c), (e)) /* to avoid problems with conditions too long */ diff --git a/ltests.h b/ltests.h @@ -20,9 +20,7 @@ /* turn on assertions */ -#undef NDEBUG -#include <assert.h> -#define lua_assert(c) assert(c) +#define LUAI_ASSERT diff --git a/makefile b/makefile @@ -38,6 +38,7 @@ CWARNSC= -Wdeclaration-after-statement \ CWARNS= $(CWARNSCPP) $(CWARNSC) # 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 # the stack can be reallocated. # -DHARDMEMTESTS forces a full collection at all points where the collector