aboutsummaryrefslogtreecommitdiff
path: root/ext/misc/json1.c
diff options
context:
space:
mode:
authordrh <>2021-12-20 23:46:44 +0000
committerdrh <>2021-12-20 23:46:44 +0000
commitf3c33c62351053b784cd9a49337fa75470cf3553 (patch)
tree7dc41eecef66e9112184a6474a5b215f12fc59b7 /ext/misc/json1.c
parent62e9c352ebe0f6e59f7e53b79fadc3e8cd3bd42a (diff)
downloadsqlite-f3c33c62351053b784cd9a49337fa75470cf3553.tar.gz
sqlite-f3c33c62351053b784cd9a49337fa75470cf3553.zip
In the json1 extension, which compiling it separately, ensure that either
SQLITE_DEBUG macro or the NDEBUG macro is set prior to including assert.h. If neither macro is defined, then assert() statement do generate code but VVA() statements do not, and that is a deadly combination. [forum:/forumpost/858dee399e|forum post 858dee399e] FossilOrigin-Name: d9f814a6402ca7fd999bbb847dc354b52ab9b97cae0c932344584d26c9430f24
Diffstat (limited to 'ext/misc/json1.c')
-rw-r--r--ext/misc/json1.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/ext/misc/json1.c b/ext/misc/json1.c
index 7fcd7342a..787b46982 100644
--- a/ext/misc/json1.c
+++ b/ext/misc/json1.c
@@ -26,6 +26,15 @@
#include "sqlite3ext.h"
#endif
SQLITE_EXTENSION_INIT1
+
+/* If compiling this extension separately (why would anybody do that when
+** it is built into the amalgamation?) we must set NDEBUG if SQLITE_DEBUG
+** is not defined *before* including <assert.h>, in order to disable asserts().
+*/
+#if !defined(SQLITE_AMALGAMATION) && !defined(SQLITE_DEBUG)
+# define NDEBUG 1
+#endif
+
#include <assert.h>
#include <string.h>
#include <stdlib.h>