aboutsummaryrefslogtreecommitdiff
path: root/src/sqliteInt.h
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2016-01-18 00:20:26 +0000
committerdrh <drh@noemail.net>2016-01-18 00:20:26 +0000
commitdad300d8e1a9e9db9b9be19929e22d6a3c2bcdda (patch)
tree2820e3c9e3d07ce7425e65ff28d95c5524526e8e /src/sqliteInt.h
parent3ed7029921c201a6dc9a0861497b782d392ac47c (diff)
downloadsqlite-dad300d8e1a9e9db9b9be19929e22d6a3c2bcdda.tar.gz
sqlite-dad300d8e1a9e9db9b9be19929e22d6a3c2bcdda.zip
Fix a problem with SQLITE_TEST_REALLOC_STRESS.
FossilOrigin-Name: 0aaf3febb00f622c5ef0853b2491d69f7ca7a21e
Diffstat (limited to 'src/sqliteInt.h')
-rw-r--r--src/sqliteInt.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index a70b0cfb3..5d8a504f8 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -403,6 +403,21 @@
#endif
/*
+** Some malloc failures are only possible if SQLITE_TEST_REALLOC_STRESS is
+** defined. We need to defend against those failures when testing with
+** SQLITE_TEST_REALLOC_STRESS, but we don't want the unreachable branches
+** during a normal build. The following macro can be used to disable tests
+** that are always false except when SQLITE_TEST_REALLOC_STRESS is set.
+*/
+#if defined(SQLITE_TEST_REALLOC_STRESS)
+# define ONLY_IF_REALLOC_STRESS(X) (X)
+#elif !defined(NDEBUG)
+# define ONLY_IF_REALLOC_STRESS(X) ((X)?(assert(0),1):0)
+#else
+# define ONLY_IF_REALLOC_STRESS(X) (0)
+#endif
+
+/*
** Declarations used for tracing the operating system interfaces.
*/
#if defined(SQLITE_FORCE_OS_TRACE) || defined(SQLITE_TEST) || \