aboutsummaryrefslogtreecommitdiff
path: root/src/sqliteInt.h
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2019-12-23 18:02:15 +0000
committerdrh <drh@noemail.net>2019-12-23 18:02:15 +0000
commita2d50283dbb176c6fd5853a3d821f1ace2ef008b (patch)
treea7eab12de4738fd16287f45d16d7e479a723a089 /src/sqliteInt.h
parent1d24a53125ab15f2d80ff4c64a2b65ed9d9ff44b (diff)
downloadsqlite-a2d50283dbb176c6fd5853a3d821f1ace2ef008b.tar.gz
sqlite-a2d50283dbb176c6fd5853a3d821f1ace2ef008b.zip
Early detection of database corruption in balance_deeper().
FossilOrigin-Name: 61c2233654158e65a3d3baeea947903a919a569fcc4a5b342b2e9a68cec1b6f3
Diffstat (limited to 'src/sqliteInt.h')
-rw-r--r--src/sqliteInt.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 4b4a9068c..a8cdb9f6a 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -447,6 +447,26 @@
#endif
/*
+** The harmless(X) macro indicates that expression X is usually false
+** but can be true without causing any problems, but we don't know of
+** any way to cause X to be true.
+**
+** In debugging and testing builds, this macro will abort if X is ever
+** true. In this way, developers are alerted to a possible test case
+** that causes X to be true. If a harmless macro ever fails, that is
+** an opportunity to change the macro into a testcase() and add a new
+** test case to the test suite.
+**
+** For normal production builds, harmless(X) is a no-op, since it does
+** not matter whether expression X is true or false.
+*/
+#ifdef SQLITE_DEBUG
+# define harmless(X) assert(!(X));
+#else
+# define harmless(X)
+#endif
+
+/*
** Some conditionals are optimizations only. In other words, if the
** conditionals are replaced with a constant 1 (true) or 0 (false) then
** the correct answer is still obtained, though perhaps not as quickly.