1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-06 15:49:35 +03:00

Link the NDEBUG macro to SQLITE_DEBUG so that when SQLITE_DEBUG is defined,

NDEBUG is automatically undefined an dwhen SQLITE_DEBUG is undefined
NDEBUG is automatically defined.

FossilOrigin-Name: 07935d10d341fe6265cfd3b09e2c4ef4005c4826
This commit is contained in:
drh
2012-05-29 19:25:20 +00:00
parent 666a1d8d1e
commit 1b28b89319
3 changed files with 18 additions and 11 deletions

View File

@@ -203,15 +203,22 @@
#endif
/*
** Many people are failing to set -DNDEBUG=1 when compiling SQLite.
** Setting NDEBUG makes the code smaller and run faster. So the following
** lines are added to automatically set NDEBUG unless the -DSQLITE_DEBUG=1
** option is set. Thus NDEBUG becomes an opt-in rather than an opt-out
** NDEBUG and SQLITE_DEBUG are opposites. It should always be true that
** defined(NDEBUG)==!defined(SQLITE_DEBUG). If this is not currently true,
** make it true by defining or undefining NDEBUG.
**
** Setting NDEBUG makes the code smaller and run faster by disabling the
** number assert() statements in the code. So we want the default action
** to be for NDEBUG to be set and NDEBUG to be undefined only if SQLITE_DEBUG
** is set. Thus NDEBUG becomes an opt-in rather than an opt-out
** feature.
*/
#if !defined(NDEBUG) && !defined(SQLITE_DEBUG)
# define NDEBUG 1
#endif
#if defined(NDEBUG) && defined(SQLITE_DEBUG)
# undef NDEBUG
#endif
/*
** The testcase() macro is used to aid in coverage testing. When