diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-07-08 15:51:55 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-07-08 15:51:55 -0300 |
commit | 6f5bd5072dff07679c390eecfeaa9d20cc45a9ef (patch) | |
tree | e7025f2595fe225b165b6a9daae53c86013139ca | |
parent | 56ec4322817b0e9aef6084c278dcf24fda7bed1c (diff) | |
download | lua-6f5bd5072dff07679c390eecfeaa9d20cc45a9ef.tar.gz lua-6f5bd5072dff07679c390eecfeaa9d20cc45a9ef.tar.bz2 lua-6f5bd5072dff07679c390eecfeaa9d20cc45a9ef.zip |
Macro LUAI_ASSERT eases turning assertions on
-rw-r--r-- | llimits.h | 10 | ||||
-rw-r--r-- | ltests.h | 4 | ||||
-rw-r--r-- | makefile | 1 |
3 files changed, 11 insertions, 4 deletions
@@ -84,7 +84,15 @@ typedef LUAI_UACNUMBER l_uacNumber; | |||
84 | typedef LUAI_UACINT l_uacInt; | 84 | typedef LUAI_UACINT l_uacInt; |
85 | 85 | ||
86 | 86 | ||
87 | /* internal assertions for in-house debugging */ | 87 | /* |
88 | ** Internal assertions for in-house debugging | ||
89 | */ | ||
90 | #if defined LUAI_ASSERT | ||
91 | #undef NDEBUG | ||
92 | #include <assert.h> | ||
93 | #define lua_assert(c) assert(c) | ||
94 | #endif | ||
95 | |||
88 | #if defined(lua_assert) | 96 | #if defined(lua_assert) |
89 | #define check_exp(c,e) (lua_assert(c), (e)) | 97 | #define check_exp(c,e) (lua_assert(c), (e)) |
90 | /* to avoid problems with conditions too long */ | 98 | /* to avoid problems with conditions too long */ |
@@ -20,9 +20,7 @@ | |||
20 | 20 | ||
21 | 21 | ||
22 | /* turn on assertions */ | 22 | /* turn on assertions */ |
23 | #undef NDEBUG | 23 | #define LUAI_ASSERT |
24 | #include <assert.h> | ||
25 | #define lua_assert(c) assert(c) | ||
26 | 24 | ||
27 | 25 | ||
28 | 26 | ||
@@ -38,6 +38,7 @@ CWARNSC= -Wdeclaration-after-statement \ | |||
38 | CWARNS= $(CWARNSCPP) $(CWARNSC) | 38 | CWARNS= $(CWARNSCPP) $(CWARNSC) |
39 | 39 | ||
40 | # Some useful compiler options for internal tests: | 40 | # Some useful compiler options for internal tests: |
41 | # -DLUAI_ASSERT turns on all assertions inside Lua. | ||
41 | # -DHARDSTACKTESTS forces a reallocation of the stack at every point where | 42 | # -DHARDSTACKTESTS forces a reallocation of the stack at every point where |
42 | # the stack can be reallocated. | 43 | # the stack can be reallocated. |
43 | # -DHARDMEMTESTS forces a full collection at all points where the collector | 44 | # -DHARDMEMTESTS forces a full collection at all points where the collector |