/ Check-in [9a443397]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Rework the code in ctime.c a bit to report on more compile time options. And to only output configuration options passed in to SQLite, not the default values of #define symbols set automatically. Also generate the large array in ctime.c using new script tool/mkctime.tcl, instead of entering it manually.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 9a443397a6b110f60cae32e1f758914d72931e16ddb423e4d4a119df526bf340
User & Date: dan 2017-06-17 17:55:33
Context
2017-06-17
18:49
Fix a missing comma in the previous check-in. check-in: f3db02f4 user: drh tags: trunk
17:55
Rework the code in ctime.c a bit to report on more compile time options. And to only output configuration options passed in to SQLite, not the default values of #define symbols set automatically. Also generate the large array in ctime.c using new script tool/mkctime.tcl, instead of entering it manually. check-in: 9a443397 user: dan tags: trunk
17:29
Ensure that the value of the THREADSAFE symbol is always included when reporting compile time options, even if it was not explicitly configured. Closed-Leaf check-in: 95141c64 user: dan tags: ctime-refactor
16:39
Add extra test cases for sqlite3changeset_apply() and ALTER TABLE ADD COLUMN. check-in: 603838fc user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/ctime.c.

    12     12   **
    13     13   ** This file implements routines used to report what compile-time options
    14     14   ** SQLite was built with.
    15     15   */
    16     16   
    17     17   #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
    18     18   
    19         -#include "sqliteInt.h"
           19  +
           20  +/* These macros are provided to "stringify" the value of the define
           21  +** for those options in which the value is meaningful. */
           22  +#define CTIMEOPT_VAL_(opt) #opt
           23  +#define CTIMEOPT_VAL(opt) CTIMEOPT_VAL_(opt)
    20     24   
    21     25   /*
    22     26   ** An array of names of all compile-time options.  This array should 
    23     27   ** be sorted A-Z.
    24     28   **
    25     29   ** This array looks large, but in a typical installation actually uses
    26     30   ** only a handful of compile-time options, so most times this array is usually
    27     31   ** rather short and uses little memory space.
    28     32   */
    29     33   static const char * const azCompileOpt[] = {
    30     34   
    31         -/* These macros are provided to "stringify" the value of the define
    32         -** for those options in which the value is meaningful. */
    33         -#define CTIMEOPT_VAL_(opt) #opt
    34         -#define CTIMEOPT_VAL(opt) CTIMEOPT_VAL_(opt)
    35         -
           35  +/* 
           36  +** BEGIN CODE GENERATED BY tool/mkctime.tcl 
           37  +*/
    36     38   #if SQLITE_32BIT_ROWID
    37     39     "32BIT_ROWID",
    38     40   #endif
    39     41   #if SQLITE_4_BYTE_ALIGNED_MALLOC
    40     42     "4_BYTE_ALIGNED_MALLOC",
    41     43   #endif
           44  +#if SQLITE_64BIT_STATS
           45  +  "64BIT_STATS",
           46  +#endif
           47  +#if SQLITE_ALLOW_COVERING_INDEX_SCAN
           48  +  "ALLOW_COVERING_INDEX_SCAN",
           49  +#endif
           50  +#if SQLITE_ALLOW_URI_AUTHORITY
           51  +  "ALLOW_URI_AUTHORITY",
           52  +#endif
           53  +#ifdef SQLITE_BITMASK_TYPE
           54  +  "BITMASK_TYPE=" CTIMEOPT_VAL(SQLITE_BITMASK_TYPE),
           55  +#endif
           56  +#if SQLITE_BUG_COMPATIBLE_20160819
           57  +  "BUG_COMPATIBLE_20160819",
           58  +#endif
    42     59   #if SQLITE_CASE_SENSITIVE_LIKE
    43     60     "CASE_SENSITIVE_LIKE",
    44     61   #endif
    45     62   #if SQLITE_CHECK_PAGES
    46     63     "CHECK_PAGES",
    47     64   #endif
    48     65   #if defined(__clang__) && defined(__clang_major__)
................................................................................
    53     70     "COMPILER=msvc-" CTIMEOPT_VAL(_MSC_VER),
    54     71   #elif defined(__GNUC__) && defined(__VERSION__)
    55     72     "COMPILER=gcc-" __VERSION__,
    56     73   #endif
    57     74   #if SQLITE_COVERAGE_TEST
    58     75     "COVERAGE_TEST",
    59     76   #endif
    60         -#ifdef SQLITE_DEBUG
           77  +#if SQLITE_DEBUG
    61     78     "DEBUG",
    62     79   #endif
    63         -#if SQLITE_DEFAULT_LOCKING_MODE
           80  +#if SQLITE_DEFAULT_AUTOMATIC_INDEX
           81  +  "DEFAULT_AUTOMATIC_INDEX",
           82  +#endif
           83  +#if SQLITE_DEFAULT_AUTOVACUUM
           84  +  "DEFAULT_AUTOVACUUM",
           85  +#endif
           86  +#ifdef SQLITE_DEFAULT_CACHE_SIZE
           87  +  "DEFAULT_CACHE_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_CACHE_SIZE),
           88  +#endif
           89  +#if SQLITE_DEFAULT_CKPTFULLFSYNC
           90  +  "DEFAULT_CKPTFULLFSYNC",
           91  +#endif
           92  +#ifdef SQLITE_DEFAULT_FILE_FORMAT
           93  +  "DEFAULT_FILE_FORMAT=" CTIMEOPT_VAL(SQLITE_DEFAULT_FILE_FORMAT),
           94  +#endif
           95  +#ifdef SQLITE_DEFAULT_FILE_PERMISSIONS
           96  +  "DEFAULT_FILE_PERMISSIONS=" CTIMEOPT_VAL(SQLITE_DEFAULT_FILE_PERMISSIONS),
           97  +#endif
           98  +#if SQLITE_DEFAULT_FOREIGN_KEYS
           99  +  "DEFAULT_FOREIGN_KEYS",
          100  +#endif
          101  +#ifdef SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT
          102  +  "DEFAULT_JOURNAL_SIZE_LIMIT=" CTIMEOPT_VAL(SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT),
          103  +#endif
          104  +#ifdef SQLITE_DEFAULT_LOCKING_MODE
    64    105     "DEFAULT_LOCKING_MODE=" CTIMEOPT_VAL(SQLITE_DEFAULT_LOCKING_MODE),
    65    106   #endif
    66         -#if defined(SQLITE_DEFAULT_MMAP_SIZE) && !defined(SQLITE_DEFAULT_MMAP_SIZE_xc)
          107  +#ifdef SQLITE_DEFAULT_LOOKASIDE
          108  +  "DEFAULT_LOOKASIDE=" CTIMEOPT_VAL(SQLITE_DEFAULT_LOOKASIDE),
          109  +#endif
          110  +#if SQLITE_DEFAULT_MEMSTATUS
          111  +  "DEFAULT_MEMSTATUS",
          112  +#endif
          113  +#ifdef SQLITE_DEFAULT_MMAP_SIZE
    67    114     "DEFAULT_MMAP_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_MMAP_SIZE),
    68    115   #endif
    69         -#if SQLITE_DEFAULT_SYNCHRONOUS
          116  +#ifdef SQLITE_DEFAULT_PAGE_SIZE
          117  +  "DEFAULT_PAGE_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_PAGE_SIZE),
          118  +#endif
          119  +#ifdef SQLITE_DEFAULT_PCACHE_INITSZ
          120  +  "DEFAULT_PCACHE_INITSZ=" CTIMEOPT_VAL(SQLITE_DEFAULT_PCACHE_INITSZ),
          121  +#endif
          122  +#ifdef SQLITE_DEFAULT_PROXYDIR_PERMISSIONS
          123  +  "DEFAULT_PROXYDIR_PERMISSIONS=" CTIMEOPT_VAL(SQLITE_DEFAULT_PROXYDIR_PERMISSIONS),
          124  +#endif
          125  +#if SQLITE_DEFAULT_RECURSIVE_TRIGGERS
          126  +  "DEFAULT_RECURSIVE_TRIGGERS",
          127  +#endif
          128  +#ifdef SQLITE_DEFAULT_ROWEST
          129  +  "DEFAULT_ROWEST=" CTIMEOPT_VAL(SQLITE_DEFAULT_ROWEST),
          130  +#endif
          131  +#ifdef SQLITE_DEFAULT_SECTOR_SIZE
          132  +  "DEFAULT_SECTOR_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_SECTOR_SIZE),
          133  +#endif
          134  +#ifdef SQLITE_DEFAULT_SYNCHRONOUS
    70    135     "DEFAULT_SYNCHRONOUS=" CTIMEOPT_VAL(SQLITE_DEFAULT_SYNCHRONOUS),
    71    136   #endif
    72         -#if SQLITE_DEFAULT_WAL_SYNCHRONOUS
          137  +#ifdef SQLITE_DEFAULT_WAL_AUTOCHECKPOINT
          138  +  "DEFAULT_WAL_AUTOCHECKPOINT=" CTIMEOPT_VAL(SQLITE_DEFAULT_WAL_AUTOCHECKPOINT),
          139  +#endif
          140  +#ifdef SQLITE_DEFAULT_WAL_SYNCHRONOUS
    73    141     "DEFAULT_WAL_SYNCHRONOUS=" CTIMEOPT_VAL(SQLITE_DEFAULT_WAL_SYNCHRONOUS),
    74    142   #endif
          143  +#ifdef SQLITE_DEFAULT_WORKER_THREADS
          144  +  "DEFAULT_WORKER_THREADS=" CTIMEOPT_VAL(SQLITE_DEFAULT_WORKER_THREADS),
          145  +#endif
    75    146   #if SQLITE_DIRECT_OVERFLOW_READ
    76    147     "DIRECT_OVERFLOW_READ",
    77    148   #endif
    78    149   #if SQLITE_DISABLE_DIRSYNC
    79    150     "DISABLE_DIRSYNC",
    80    151   #endif
          152  +#if SQLITE_DISABLE_FTS3_UNICODE
          153  +  "DISABLE_FTS3_UNICODE",
          154  +#endif
          155  +#if SQLITE_DISABLE_FTS4_DEFERRED
          156  +  "DISABLE_FTS4_DEFERRED",
          157  +#endif
          158  +#if SQLITE_DISABLE_INTRINSIC
          159  +  "DISABLE_INTRINSIC",
          160  +#endif
    81    161   #if SQLITE_DISABLE_LFS
    82    162     "DISABLE_LFS",
    83    163   #endif
    84         -#if SQLITE_ENABLE_8_3_NAMES
          164  +#if SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS
          165  +  "DISABLE_PAGECACHE_OVERFLOW_STATS",
          166  +#endif
          167  +#if SQLITE_DISABLE_SKIPAHEAD_DISTINCT
          168  +  "DISABLE_SKIPAHEAD_DISTINCT",
          169  +#endif
          170  +#ifdef SQLITE_ENABLE_8_3_NAMES
    85    171     "ENABLE_8_3_NAMES=" CTIMEOPT_VAL(SQLITE_ENABLE_8_3_NAMES),
    86    172   #endif
    87    173   #if SQLITE_ENABLE_API_ARMOR
    88    174     "ENABLE_API_ARMOR",
    89    175   #endif
    90    176   #if SQLITE_ENABLE_ATOMIC_WRITE
    91    177     "ENABLE_ATOMIC_WRITE",
    92    178   #endif
    93    179   #if SQLITE_ENABLE_CEROD
    94    180     "ENABLE_CEROD",
    95    181   #endif
    96    182   #if SQLITE_ENABLE_COLUMN_METADATA
    97    183     "ENABLE_COLUMN_METADATA",
          184  +#endif
          185  +#if SQLITE_ENABLE_COLUMN_USED_MASK
          186  +  "ENABLE_COLUMN_USED_MASK",
          187  +#endif
          188  +#if SQLITE_ENABLE_COSTMULT
          189  +  "ENABLE_COSTMULT",
          190  +#endif
          191  +#if SQLITE_ENABLE_CURSOR_HINTS
          192  +  "ENABLE_CURSOR_HINTS",
    98    193   #endif
    99    194   #if SQLITE_ENABLE_DBSTAT_VTAB
   100    195     "ENABLE_DBSTAT_VTAB",
   101    196   #endif
   102    197   #if SQLITE_ENABLE_EXPENSIVE_ASSERT
   103    198     "ENABLE_EXPENSIVE_ASSERT",
   104    199   #endif
................................................................................
   110    205   #endif
   111    206   #if SQLITE_ENABLE_FTS3
   112    207     "ENABLE_FTS3",
   113    208   #endif
   114    209   #if SQLITE_ENABLE_FTS3_PARENTHESIS
   115    210     "ENABLE_FTS3_PARENTHESIS",
   116    211   #endif
          212  +#if SQLITE_ENABLE_FTS3_TOKENIZER
          213  +  "ENABLE_FTS3_TOKENIZER",
          214  +#endif
   117    215   #if SQLITE_ENABLE_FTS4
   118    216     "ENABLE_FTS4",
   119    217   #endif
   120    218   #if SQLITE_ENABLE_FTS5
   121    219     "ENABLE_FTS5",
          220  +#endif
          221  +#if SQLITE_ENABLE_HIDDEN_COLUMNS
          222  +  "ENABLE_HIDDEN_COLUMNS",
   122    223   #endif
   123    224   #if SQLITE_ENABLE_ICU
   124    225     "ENABLE_ICU",
   125    226   #endif
   126    227   #if SQLITE_ENABLE_IOTRACE
   127    228     "ENABLE_IOTRACE",
   128    229   #endif
   129    230   #if SQLITE_ENABLE_JSON1
   130    231     "ENABLE_JSON1",
   131    232   #endif
   132    233   #if SQLITE_ENABLE_LOAD_EXTENSION
   133    234     "ENABLE_LOAD_EXTENSION",
   134    235   #endif
   135         -#if SQLITE_ENABLE_LOCKING_STYLE
          236  +#ifdef SQLITE_ENABLE_LOCKING_STYLE
   136    237     "ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE),
   137    238   #endif
   138    239   #if SQLITE_ENABLE_MEMORY_MANAGEMENT
   139    240     "ENABLE_MEMORY_MANAGEMENT",
   140    241   #endif
   141    242   #if SQLITE_ENABLE_MEMSYS3
   142    243     "ENABLE_MEMSYS3",
   143    244   #endif
   144    245   #if SQLITE_ENABLE_MEMSYS5
   145    246     "ENABLE_MEMSYS5",
          247  +#endif
          248  +#if SQLITE_ENABLE_MULTIPLEX
          249  +  "ENABLE_MULTIPLEX",
          250  +#endif
          251  +#if SQLITE_ENABLE_NULL_TRIM
          252  +  "ENABLE_NULL_TRIM",
   146    253   #endif
   147    254   #if SQLITE_ENABLE_OVERSIZE_CELL_CHECK
   148    255     "ENABLE_OVERSIZE_CELL_CHECK",
          256  +#endif
          257  +#if SQLITE_ENABLE_PREUPDATE_HOOK
          258  +  "ENABLE_PREUPDATE_HOOK",
          259  +#endif
          260  +#if SQLITE_ENABLE_RBU
          261  +  "ENABLE_RBU",
   149    262   #endif
   150    263   #if SQLITE_ENABLE_RTREE
   151    264     "ENABLE_RTREE",
          265  +#endif
          266  +#if SQLITE_ENABLE_SELECTTRACE
          267  +  "ENABLE_SELECTTRACE",
          268  +#endif
          269  +#if SQLITE_ENABLE_SESSION
          270  +  "ENABLE_SESSION",
          271  +#endif
          272  +#if SQLITE_ENABLE_SNAPSHOT
          273  +  "ENABLE_SNAPSHOT",
          274  +#endif
          275  +#if SQLITE_ENABLE_SQLLOG
          276  +  "ENABLE_SQLLOG",
   152    277   #endif
   153    278   #if defined(SQLITE_ENABLE_STAT4)
   154    279     "ENABLE_STAT4",
   155    280   #elif defined(SQLITE_ENABLE_STAT3)
   156    281     "ENABLE_STAT3",
          282  +#endif
          283  +#if SQLITE_ENABLE_STMT_SCANSTATUS
          284  +  "ENABLE_STMT_SCANSTATUS",
          285  +#endif
          286  +#if SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
          287  +  "ENABLE_UNKNOWN_SQL_FUNCTION",
   157    288   #endif
   158    289   #if SQLITE_ENABLE_UNLOCK_NOTIFY
   159    290     "ENABLE_UNLOCK_NOTIFY",
   160    291   #endif
   161    292   #if SQLITE_ENABLE_UPDATE_DELETE_LIMIT
   162    293     "ENABLE_UPDATE_DELETE_LIMIT",
   163    294   #endif
   164         -#if defined(SQLITE_ENABLE_URI_00_ERROR)
          295  +#if SQLITE_ENABLE_URI_00_ERROR
   165    296     "ENABLE_URI_00_ERROR",
          297  +#endif
          298  +#if SQLITE_ENABLE_VFSTRACE
          299  +  "ENABLE_VFSTRACE",
          300  +#endif
          301  +#if SQLITE_ENABLE_WHERETRACE
          302  +  "ENABLE_WHERETRACE",
          303  +#endif
          304  +#if SQLITE_ENABLE_ZIPVFS
          305  +  "ENABLE_ZIPVFS",
          306  +#endif
          307  +#if SQLITE_EXPLAIN_ESTIMATED_ROWS
          308  +  "EXPLAIN_ESTIMATED_ROWS",
          309  +#endif
          310  +#if SQLITE_EXTRA_IFNULLROW
          311  +  "EXTRA_IFNULLROW",
          312  +#endif
          313  +#ifdef SQLITE_EXTRA_INIT
          314  +  "EXTRA_INIT=" CTIMEOPT_VAL(SQLITE_EXTRA_INIT),
          315  +#endif
          316  +#ifdef SQLITE_EXTRA_SHUTDOWN
          317  +  "EXTRA_SHUTDOWN=" CTIMEOPT_VAL(SQLITE_EXTRA_SHUTDOWN),
          318  +#endif
          319  +#ifdef SQLITE_FTS3_MAX_EXPR_DEPTH
          320  +  "FTS3_MAX_EXPR_DEPTH=" CTIMEOPT_VAL(SQLITE_FTS3_MAX_EXPR_DEPTH),
          321  +#endif
          322  +#if SQLITE_FTS5_ENABLE_TEST_MI
          323  +  "FTS5_ENABLE_TEST_MI",
          324  +#endif
          325  +#if SQLITE_FTS5_NO_WITHOUT_ROWID
          326  +  "FTS5_NO_WITHOUT_ROWID",
   166    327   #endif
   167    328   #if SQLITE_HAS_CODEC
   168    329     "HAS_CODEC",
   169    330   #endif
   170    331   #if HAVE_ISNAN || SQLITE_HAVE_ISNAN
   171    332     "HAVE_ISNAN",
   172    333   #endif
................................................................................
   175    336   #endif
   176    337   #if SQLITE_IGNORE_AFP_LOCK_ERRORS
   177    338     "IGNORE_AFP_LOCK_ERRORS",
   178    339   #endif
   179    340   #if SQLITE_IGNORE_FLOCK_LOCK_ERRORS
   180    341     "IGNORE_FLOCK_LOCK_ERRORS",
   181    342   #endif
   182         -#ifdef SQLITE_INT64_TYPE
          343  +#if SQLITE_INLINE_MEMCPY
          344  +  "INLINE_MEMCPY",
          345  +#endif
          346  +#if SQLITE_INT64_TYPE
   183    347     "INT64_TYPE",
   184    348   #endif
   185         -#ifdef SQLITE_LIKE_DOESNT_MATCH_BLOBS
          349  +#ifdef SQLITE_INTEGRITY_CHECK_ERROR_MAX
          350  +  "INTEGRITY_CHECK_ERROR_MAX=" CTIMEOPT_VAL(SQLITE_INTEGRITY_CHECK_ERROR_MAX),
          351  +#endif
          352  +#if SQLITE_LIKE_DOESNT_MATCH_BLOBS
   186    353     "LIKE_DOESNT_MATCH_BLOBS",
   187    354   #endif
   188    355   #if SQLITE_LOCK_TRACE
   189    356     "LOCK_TRACE",
   190    357   #endif
   191         -#if defined(SQLITE_MAX_MMAP_SIZE) && !defined(SQLITE_MAX_MMAP_SIZE_xc)
          358  +#if SQLITE_LOG_CACHE_SPILL
          359  +  "LOG_CACHE_SPILL",
          360  +#endif
          361  +#ifdef SQLITE_MALLOC_SOFT_LIMIT
          362  +  "MALLOC_SOFT_LIMIT=" CTIMEOPT_VAL(SQLITE_MALLOC_SOFT_LIMIT),
          363  +#endif
          364  +#ifdef SQLITE_MAX_ATTACHED
          365  +  "MAX_ATTACHED=" CTIMEOPT_VAL(SQLITE_MAX_ATTACHED),
          366  +#endif
          367  +#ifdef SQLITE_MAX_COLUMN
          368  +  "MAX_COLUMN=" CTIMEOPT_VAL(SQLITE_MAX_COLUMN),
          369  +#endif
          370  +#ifdef SQLITE_MAX_COMPOUND_SELECT
          371  +  "MAX_COMPOUND_SELECT=" CTIMEOPT_VAL(SQLITE_MAX_COMPOUND_SELECT),
          372  +#endif
          373  +#ifdef SQLITE_MAX_DEFAULT_PAGE_SIZE
          374  +  "MAX_DEFAULT_PAGE_SIZE=" CTIMEOPT_VAL(SQLITE_MAX_DEFAULT_PAGE_SIZE),
          375  +#endif
          376  +#ifdef SQLITE_MAX_EXPR_DEPTH
          377  +  "MAX_EXPR_DEPTH=" CTIMEOPT_VAL(SQLITE_MAX_EXPR_DEPTH),
          378  +#endif
          379  +#ifdef SQLITE_MAX_FUNCTION_ARG
          380  +  "MAX_FUNCTION_ARG=" CTIMEOPT_VAL(SQLITE_MAX_FUNCTION_ARG),
          381  +#endif
          382  +#ifdef SQLITE_MAX_LENGTH
          383  +  "MAX_LENGTH=" CTIMEOPT_VAL(SQLITE_MAX_LENGTH),
          384  +#endif
          385  +#ifdef SQLITE_MAX_LIKE_PATTERN_LENGTH
          386  +  "MAX_LIKE_PATTERN_LENGTH=" CTIMEOPT_VAL(SQLITE_MAX_LIKE_PATTERN_LENGTH),
          387  +#endif
          388  +#ifdef SQLITE_MAX_MEMORY
          389  +  "MAX_MEMORY=" CTIMEOPT_VAL(SQLITE_MAX_MEMORY),
          390  +#endif
          391  +#ifdef SQLITE_MAX_MMAP_SIZE
   192    392     "MAX_MMAP_SIZE=" CTIMEOPT_VAL(SQLITE_MAX_MMAP_SIZE),
   193    393   #endif
          394  +#ifdef SQLITE_MAX_MMAP_SIZE_
          395  +  "MAX_MMAP_SIZE_=" CTIMEOPT_VAL(SQLITE_MAX_MMAP_SIZE_),
          396  +#endif
          397  +#ifdef SQLITE_MAX_PAGE_COUNT
          398  +  "MAX_PAGE_COUNT=" CTIMEOPT_VAL(SQLITE_MAX_PAGE_COUNT),
          399  +#endif
          400  +#ifdef SQLITE_MAX_PAGE_SIZE
          401  +  "MAX_PAGE_SIZE=" CTIMEOPT_VAL(SQLITE_MAX_PAGE_SIZE),
          402  +#endif
   194    403   #ifdef SQLITE_MAX_SCHEMA_RETRY
   195    404     "MAX_SCHEMA_RETRY=" CTIMEOPT_VAL(SQLITE_MAX_SCHEMA_RETRY),
   196    405   #endif
          406  +#ifdef SQLITE_MAX_SQL_LENGTH
          407  +  "MAX_SQL_LENGTH=" CTIMEOPT_VAL(SQLITE_MAX_SQL_LENGTH),
          408  +#endif
          409  +#ifdef SQLITE_MAX_TRIGGER_DEPTH
          410  +  "MAX_TRIGGER_DEPTH=" CTIMEOPT_VAL(SQLITE_MAX_TRIGGER_DEPTH),
          411  +#endif
          412  +#ifdef SQLITE_MAX_VARIABLE_NUMBER
          413  +  "MAX_VARIABLE_NUMBER=" CTIMEOPT_VAL(SQLITE_MAX_VARIABLE_NUMBER),
          414  +#endif
          415  +#ifdef SQLITE_MAX_VDBE_OP
          416  +  "MAX_VDBE_OP=" CTIMEOPT_VAL(SQLITE_MAX_VDBE_OP),
          417  +#endif
          418  +#ifdef SQLITE_MAX_WORKER_THREADS
          419  +  "MAX_WORKER_THREADS=" CTIMEOPT_VAL(SQLITE_MAX_WORKER_THREADS),
          420  +#endif
   197    421   #if SQLITE_MEMDEBUG
   198    422     "MEMDEBUG",
   199    423   #endif
   200    424   #if SQLITE_MIXED_ENDIAN_64BIT_FLOAT
   201    425     "MIXED_ENDIAN_64BIT_FLOAT",
          426  +#endif
          427  +#if SQLITE_MMAP_READWRITE
          428  +  "MMAP_READWRITE",
          429  +#endif
          430  +#if SQLITE_MUTEX_NOOP
          431  +  "MUTEX_NOOP",
          432  +#endif
          433  +#if SQLITE_MUTEX_NREF
          434  +  "MUTEX_NREF",
          435  +#endif
          436  +#if SQLITE_MUTEX_OMIT
          437  +  "MUTEX_OMIT",
          438  +#endif
          439  +#if SQLITE_MUTEX_PTHREADS
          440  +  "MUTEX_PTHREADS",
          441  +#endif
          442  +#if SQLITE_MUTEX_W32
          443  +  "MUTEX_W32",
          444  +#endif
          445  +#if SQLITE_NEED_ERR_NAME
          446  +  "NEED_ERR_NAME",
          447  +#endif
          448  +#if SQLITE_NOINLINE
          449  +  "NOINLINE",
   202    450   #endif
   203    451   #if SQLITE_NO_SYNC
   204    452     "NO_SYNC",
   205    453   #endif
   206    454   #if SQLITE_OMIT_ALTERTABLE
   207    455     "OMIT_ALTERTABLE",
   208    456   #endif
................................................................................
   247    495   #endif
   248    496   #if SQLITE_OMIT_COMPLETE
   249    497     "OMIT_COMPLETE",
   250    498   #endif
   251    499   #if SQLITE_OMIT_COMPOUND_SELECT
   252    500     "OMIT_COMPOUND_SELECT",
   253    501   #endif
          502  +#if SQLITE_OMIT_CONFLICT_CLAUSE
          503  +  "OMIT_CONFLICT_CLAUSE",
          504  +#endif
   254    505   #if SQLITE_OMIT_CTE
   255    506     "OMIT_CTE",
   256    507   #endif
   257    508   #if SQLITE_OMIT_DATETIME_FUNCS
   258    509     "OMIT_DATETIME_FUNCS",
   259    510   #endif
   260    511   #if SQLITE_OMIT_DECLTYPE
................................................................................
   276    527     "OMIT_FLOATING_POINT",
   277    528   #endif
   278    529   #if SQLITE_OMIT_FOREIGN_KEY
   279    530     "OMIT_FOREIGN_KEY",
   280    531   #endif
   281    532   #if SQLITE_OMIT_GET_TABLE
   282    533     "OMIT_GET_TABLE",
          534  +#endif
          535  +#if SQLITE_OMIT_HEX_INTEGER
          536  +  "OMIT_HEX_INTEGER",
   283    537   #endif
   284    538   #if SQLITE_OMIT_INCRBLOB
   285    539     "OMIT_INCRBLOB",
   286    540   #endif
   287    541   #if SQLITE_OMIT_INTEGRITY_CHECK
   288    542     "OMIT_INTEGRITY_CHECK",
   289    543   #endif
................................................................................
   303    557     "OMIT_MEMORYDB",
   304    558   #endif
   305    559   #if SQLITE_OMIT_OR_OPTIMIZATION
   306    560     "OMIT_OR_OPTIMIZATION",
   307    561   #endif
   308    562   #if SQLITE_OMIT_PAGER_PRAGMAS
   309    563     "OMIT_PAGER_PRAGMAS",
          564  +#endif
          565  +#if SQLITE_OMIT_PARSER_TRACE
          566  +  "OMIT_PARSER_TRACE",
          567  +#endif
          568  +#if SQLITE_OMIT_POPEN
          569  +  "OMIT_POPEN",
   310    570   #endif
   311    571   #if SQLITE_OMIT_PRAGMA
   312    572     "OMIT_PRAGMA",
   313    573   #endif
   314    574   #if SQLITE_OMIT_PROGRESS_CALLBACK
   315    575     "OMIT_PROGRESS_CALLBACK",
   316    576   #endif
................................................................................
   325    585   #endif
   326    586   #if SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
   327    587     "OMIT_SCHEMA_VERSION_PRAGMAS",
   328    588   #endif
   329    589   #if SQLITE_OMIT_SHARED_CACHE
   330    590     "OMIT_SHARED_CACHE",
   331    591   #endif
          592  +#if SQLITE_OMIT_SHUTDOWN_DIRECTORIES
          593  +  "OMIT_SHUTDOWN_DIRECTORIES",
          594  +#endif
   332    595   #if SQLITE_OMIT_SUBQUERY
   333    596     "OMIT_SUBQUERY",
   334    597   #endif
   335    598   #if SQLITE_OMIT_TCL_VARIABLE
   336    599     "OMIT_TCL_VARIABLE",
   337    600   #endif
   338    601   #if SQLITE_OMIT_TEMPDB
   339    602     "OMIT_TEMPDB",
          603  +#endif
          604  +#if SQLITE_OMIT_TEST_CONTROL
          605  +  "OMIT_TEST_CONTROL",
   340    606   #endif
   341    607   #if SQLITE_OMIT_TRACE
   342    608     "OMIT_TRACE",
   343    609   #endif
   344    610   #if SQLITE_OMIT_TRIGGER
   345    611     "OMIT_TRIGGER",
   346    612   #endif
................................................................................
   363    629     "OMIT_WAL",
   364    630   #endif
   365    631   #if SQLITE_OMIT_WSD
   366    632     "OMIT_WSD",
   367    633   #endif
   368    634   #if SQLITE_OMIT_XFER_OPT
   369    635     "OMIT_XFER_OPT",
          636  +#endif
          637  +#if SQLITE_PCACHE_SEPARATE_HEADER
          638  +  "PCACHE_SEPARATE_HEADER",
   370    639   #endif
   371    640   #if SQLITE_PERFORMANCE_TRACE
   372    641     "PERFORMANCE_TRACE",
   373    642   #endif
          643  +#if SQLITE_POWERSAFE_OVERWRITE
          644  +  "POWERSAFE_OVERWRITE",
          645  +#endif
          646  +#if SQLITE_PREFER_PROXY_LOCKING
          647  +  "PREFER_PROXY_LOCKING",
          648  +#endif
   374    649   #if SQLITE_PROXY_DEBUG
   375    650     "PROXY_DEBUG",
          651  +#endif
          652  +#if SQLITE_REVERSE_UNORDERED_SELECTS
          653  +  "REVERSE_UNORDERED_SELECTS",
   376    654   #endif
   377    655   #if SQLITE_RTREE_INT_ONLY
   378    656     "RTREE_INT_ONLY",
   379    657   #endif
   380    658   #if SQLITE_SECURE_DELETE
   381    659     "SECURE_DELETE",
   382    660   #endif
   383    661   #if SQLITE_SMALL_STACK
   384    662     "SMALL_STACK",
   385    663   #endif
          664  +#ifdef SQLITE_SORTER_PMASZ
          665  +  "SORTER_PMASZ=" CTIMEOPT_VAL(SQLITE_SORTER_PMASZ),
          666  +#endif
   386    667   #if SQLITE_SOUNDEX
   387    668     "SOUNDEX",
          669  +#endif
          670  +#ifdef SQLITE_STAT4_SAMPLES
          671  +  "STAT4_SAMPLES=" CTIMEOPT_VAL(SQLITE_STAT4_SAMPLES),
          672  +#endif
          673  +#ifdef SQLITE_STMTJRNL_SPILL
          674  +  "STMTJRNL_SPILL=" CTIMEOPT_VAL(SQLITE_STMTJRNL_SPILL),
          675  +#endif
          676  +#if SQLITE_SUBSTR_COMPATIBILITY
          677  +  "SUBSTR_COMPATIBILITY",
   388    678   #endif
   389    679   #if SQLITE_SYSTEM_MALLOC
   390    680     "SYSTEM_MALLOC",
   391    681   #endif
   392    682   #if SQLITE_TCL
   393    683     "TCL",
   394    684   #endif
   395         -#if defined(SQLITE_TEMP_STORE) && !defined(SQLITE_TEMP_STORE_xc)
          685  +#ifdef SQLITE_TEMP_STORE
   396    686     "TEMP_STORE=" CTIMEOPT_VAL(SQLITE_TEMP_STORE),
   397    687   #endif
   398    688   #if SQLITE_TEST
   399    689     "TEST",
   400    690   #endif
   401    691   #if defined(SQLITE_THREADSAFE)
   402    692     "THREADSAFE=" CTIMEOPT_VAL(SQLITE_THREADSAFE),
          693  +#elif defined(THREADSAFE)
          694  +  "THREADSAFE=" CTIMEOPT_VAL(THREADSAFE),
          695  +#else
          696  +  "THREADSAFE=1"
          697  +#endif
          698  +#if SQLITE_UNLINK_AFTER_CLOSE
          699  +  "UNLINK_AFTER_CLOSE",
   403    700   #endif
   404    701   #if SQLITE_UNTESTABLE
   405         -  "UNTESTABLE"
          702  +  "UNTESTABLE",
          703  +#endif
          704  +#if SQLITE_USER_AUTHENTICATION
          705  +  "USER_AUTHENTICATION",
   406    706   #endif
   407    707   #if SQLITE_USE_ALLOCA
   408    708     "USE_ALLOCA",
   409    709   #endif
   410         -#if SQLITE_USER_AUTHENTICATION
   411         -  "USER_AUTHENTICATION",
          710  +#if SQLITE_USE_FCNTL_TRACE
          711  +  "USE_FCNTL_TRACE",
          712  +#endif
          713  +#if SQLITE_USE_URI
          714  +  "USE_URI",
          715  +#endif
          716  +#if SQLITE_VDBE_COVERAGE
          717  +  "VDBE_COVERAGE",
   412    718   #endif
   413    719   #if SQLITE_WIN32_MALLOC
   414    720     "WIN32_MALLOC",
   415    721   #endif
   416    722   #if SQLITE_ZERO_MALLOC
   417         -  "ZERO_MALLOC"
          723  +  "ZERO_MALLOC",
   418    724   #endif
          725  +/* 
          726  +** END CODE GENERATED BY tool/mkctime.tcl 
          727  +*/
   419    728   };
   420    729   
   421         -/*
   422         -** Given the name of a compile-time option, return true if that option
   423         -** was used and false if not.
   424         -**
   425         -** The name can optionally begin with "SQLITE_" but the "SQLITE_" prefix
   426         -** is not required for a match.
   427         -*/
   428         -int sqlite3_compileoption_used(const char *zOptName){
   429         -  int i, n;
   430         -
   431         -#if SQLITE_ENABLE_API_ARMOR
   432         -  if( zOptName==0 ){
   433         -    (void)SQLITE_MISUSE_BKPT;
   434         -    return 0;
   435         -  }
   436         -#endif
   437         -  if( sqlite3StrNICmp(zOptName, "SQLITE_", 7)==0 ) zOptName += 7;
   438         -  n = sqlite3Strlen30(zOptName);
   439         -
   440         -  /* Since ArraySize(azCompileOpt) is normally in single digits, a
   441         -  ** linear search is adequate.  No need for a binary search. */
   442         -  for(i=0; i<ArraySize(azCompileOpt); i++){
   443         -    if( sqlite3StrNICmp(zOptName, azCompileOpt[i], n)==0
   444         -     && sqlite3IsIdChar((unsigned char)azCompileOpt[i][n])==0
   445         -    ){
   446         -      return 1;
   447         -    }
   448         -  }
   449         -  return 0;
   450         -}
   451         -
   452         -/*
   453         -** Return the N-th compile-time option string.  If N is out of range,
   454         -** return a NULL pointer.
   455         -*/
   456         -const char *sqlite3_compileoption_get(int N){
   457         -  if( N>=0 && N<ArraySize(azCompileOpt) ){
   458         -    return azCompileOpt[N];
   459         -  }
   460         -  return 0;
          730  +const char **sqlite3CompileOptions(int *pnOpt){
          731  +  *pnOpt = sizeof(azCompileOpt) / sizeof(azCompileOpt[0]);
          732  +  return (const char**)azCompileOpt;
   461    733   }
   462    734   
   463    735   #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
          736  +

Changes to src/main.c.

  4098   4098   /*
  4099   4099   ** Free a snapshot handle obtained from sqlite3_snapshot_get().
  4100   4100   */
  4101   4101   void sqlite3_snapshot_free(sqlite3_snapshot *pSnapshot){
  4102   4102     sqlite3_free(pSnapshot);
  4103   4103   }
  4104   4104   #endif /* SQLITE_ENABLE_SNAPSHOT */
         4105  +
         4106  +#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
         4107  +/*
         4108  +** Given the name of a compile-time option, return true if that option
         4109  +** was used and false if not.
         4110  +**
         4111  +** The name can optionally begin with "SQLITE_" but the "SQLITE_" prefix
         4112  +** is not required for a match.
         4113  +*/
         4114  +int sqlite3_compileoption_used(const char *zOptName){
         4115  +  int i, n;
         4116  +  int nOpt;
         4117  +  const char **azCompileOpt;
         4118  + 
         4119  +#if SQLITE_ENABLE_API_ARMOR
         4120  +  if( zOptName==0 ){
         4121  +    (void)SQLITE_MISUSE_BKPT;
         4122  +    return 0;
         4123  +  }
         4124  +#endif
         4125  +
         4126  +  azCompileOpt = sqlite3CompileOptions(&nOpt);
         4127  +
         4128  +  if( sqlite3StrNICmp(zOptName, "SQLITE_", 7)==0 ) zOptName += 7;
         4129  +  n = sqlite3Strlen30(zOptName);
         4130  +
         4131  +  /* Since nOpt is normally in single digits, a linear search is 
         4132  +  ** adequate. No need for a binary search. */
         4133  +  for(i=0; i<nOpt; i++){
         4134  +    if( sqlite3StrNICmp(zOptName, azCompileOpt[i], n)==0
         4135  +     && sqlite3IsIdChar((unsigned char)azCompileOpt[i][n])==0
         4136  +    ){
         4137  +      return 1;
         4138  +    }
         4139  +  }
         4140  +  return 0;
         4141  +}
         4142  +
         4143  +/*
         4144  +** Return the N-th compile-time option string.  If N is out of range,
         4145  +** return a NULL pointer.
         4146  +*/
         4147  +const char *sqlite3_compileoption_get(int N){
         4148  +  int nOpt;
         4149  +  const char **azCompileOpt;
         4150  +  azCompileOpt = sqlite3CompileOptions(&nOpt);
         4151  +  if( N>=0 && N<nOpt ){
         4152  +    return azCompileOpt[N];
         4153  +  }
         4154  +  return 0;
         4155  +}
         4156  +#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */

Changes to src/sqliteInt.h.

   270    270   ** threadsafe.  1 means the library is serialized which is the highest
   271    271   ** level of threadsafety.  2 means the library is multithreaded - multiple
   272    272   ** threads can use SQLite as long as no two threads try to use the same
   273    273   ** database connection at the same time.
   274    274   **
   275    275   ** Older versions of SQLite used an optional THREADSAFE macro.
   276    276   ** We support that for legacy.
          277  +**
          278  +** To ensure that the correct value of "THREADSAFE" is reported when querying
          279  +** for compile-time options at runtime (e.g. "PRAGMA compile_options"), this
          280  +** logic is partially replicated in ctime.c. If it is updated here, it should
          281  +** also be updated there.
   277    282   */
   278    283   #if !defined(SQLITE_THREADSAFE)
   279    284   # if defined(THREADSAFE)
   280    285   #   define SQLITE_THREADSAFE THREADSAFE
   281    286   # else
   282    287   #   define SQLITE_THREADSAFE 1 /* IMP: R-07272-22309 */
   283    288   # endif
................................................................................
   585    590   
   586    591   /*
   587    592   ** Provide a default value for SQLITE_TEMP_STORE in case it is not specified
   588    593   ** on the command-line
   589    594   */
   590    595   #ifndef SQLITE_TEMP_STORE
   591    596   # define SQLITE_TEMP_STORE 1
   592         -# define SQLITE_TEMP_STORE_xc 1  /* Exclude from ctime.c */
   593    597   #endif
   594    598   
   595    599   /*
   596    600   ** If no value has been provided for SQLITE_MAX_WORKER_THREADS, or if
   597    601   ** SQLITE_TEMP_STORE is set to 3 (never use temporary files), set it
   598    602   ** to zero.
   599    603   */
................................................................................
   886    890     || defined(__sun) \
   887    891     || defined(__FreeBSD__) \
   888    892     || defined(__DragonFly__)
   889    893   #   define SQLITE_MAX_MMAP_SIZE 0x7fff0000  /* 2147418112 */
   890    894   # else
   891    895   #   define SQLITE_MAX_MMAP_SIZE 0
   892    896   # endif
   893         -# define SQLITE_MAX_MMAP_SIZE_xc 1 /* exclude from ctime.c */
   894    897   #endif
   895    898   
   896    899   /*
   897    900   ** The default MMAP_SIZE is zero on all platforms.  Or, even if a larger
   898    901   ** default MMAP_SIZE is specified at compile-time, make sure that it does
   899    902   ** not exceed the maximum mmap size.
   900    903   */
   901    904   #ifndef SQLITE_DEFAULT_MMAP_SIZE
   902    905   # define SQLITE_DEFAULT_MMAP_SIZE 0
   903         -# define SQLITE_DEFAULT_MMAP_SIZE_xc 1  /* Exclude from ctime.c */
   904    906   #endif
   905    907   #if SQLITE_DEFAULT_MMAP_SIZE>SQLITE_MAX_MMAP_SIZE
   906    908   # undef SQLITE_DEFAULT_MMAP_SIZE
   907    909   # define SQLITE_DEFAULT_MMAP_SIZE SQLITE_MAX_MMAP_SIZE
   908    910   #endif
   909    911   
   910    912   /*
................................................................................
  4365   4367   #endif
  4366   4368   
  4367   4369   int sqlite3ExprVectorSize(Expr *pExpr);
  4368   4370   int sqlite3ExprIsVector(Expr *pExpr);
  4369   4371   Expr *sqlite3VectorFieldSubexpr(Expr*, int);
  4370   4372   Expr *sqlite3ExprForVectorField(Parse*,Expr*,int);
  4371   4373   void sqlite3VectorErrorMsg(Parse*, Expr*);
         4374  +
         4375  +const char **sqlite3CompileOptions(int *pnOpt);
  4372   4376   
  4373   4377   #endif /* SQLITEINT_H */

Changes to test/ctime.test.

    56     56   # the results should be in sorted order already
    57     57   do_test ctime-1.2.2 {
    58     58     set ans [ catchsql {
    59     59       PRAGMA compile_options;
    60     60     } ]
    61     61     list [ lindex $ans 0 ] [ expr { [lsort [lindex $ans 1]]==[lindex $ans 1] } ]
    62     62   } {0 1}
           63  +
           64  +# Check the THREADSAFE option for SQLITE_THREADSAFE=2 builds (there are
           65  +# a couple of these configurations in releasetest.tcl).
           66  +#
           67  +ifcapable threadsafe2 {
           68  +  foreach {tn opt res} {
           69  +    1 SQLITE_THREADSAFE     1
           70  +    2 THREADSAFE            1
           71  +    3 THREADSAFE=0          0
           72  +    4 THREADSAFE=1          0
           73  +    5 THREADSAFE=2          1
           74  +    6 THREADSAFE=           0
           75  +  } {
           76  +    do_execsql_test ctime-1.3.$tn {
           77  +      SELECT sqlite_compileoption_used($opt)
           78  +    } $res
           79  +  }
           80  +}
    63     81   
    64     82   # SQLITE_THREADSAFE should pretty much always be defined
    65     83   # one way or the other, and it must have a value of 0 or 1.
    66     84   do_test ctime-1.4.1 {
    67     85     catchsql {
    68     86       SELECT sqlite_compileoption_used('SQLITE_THREADSAFE');
    69     87     }

Added tool/mkctimec.tcl.

            1  +#!/usr/bin/tclsh
            2  +#
            3  +# To build the
            4  +#
            5  +#   const char **azCompileOpt[]
            6  +#
            7  +# declaration used in src/ctime.c, run this script.
            8  +#
            9  +
           10  +# All Boolean compile time options.
           11  +#
           12  +set boolean_options {
           13  +  SQLITE_32BIT_ROWID
           14  +  SQLITE_4_BYTE_ALIGNED_MALLOC
           15  +  SQLITE_64BIT_STATS
           16  +  SQLITE_ALLOW_COVERING_INDEX_SCAN
           17  +  SQLITE_ALLOW_URI_AUTHORITY
           18  +  SQLITE_BUG_COMPATIBLE_20160819
           19  +  SQLITE_CASE_SENSITIVE_LIKE
           20  +  SQLITE_CHECK_PAGES
           21  +  SQLITE_COVERAGE_TEST
           22  +  SQLITE_DEBUG
           23  +  SQLITE_DEFAULT_AUTOMATIC_INDEX
           24  +  SQLITE_DEFAULT_AUTOVACUUM
           25  +  SQLITE_DEFAULT_CKPTFULLFSYNC
           26  +  SQLITE_DEFAULT_FOREIGN_KEYS
           27  +  SQLITE_DEFAULT_LOCKING_MODE
           28  +  SQLITE_DEFAULT_MEMSTATUS
           29  +  SQLITE_DEFAULT_RECURSIVE_TRIGGERS
           30  +  SQLITE_DEFAULT_SYNCHRONOUS
           31  +  SQLITE_DEFAULT_WAL_SYNCHRONOUS
           32  +  SQLITE_DIRECT_OVERFLOW_READ
           33  +  SQLITE_DISABLE_DIRSYNC
           34  +  SQLITE_DISABLE_FTS3_UNICODE
           35  +  SQLITE_DISABLE_FTS4_DEFERRED
           36  +  SQLITE_DISABLE_INTRINSIC
           37  +  SQLITE_DISABLE_LFS
           38  +  SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS
           39  +  SQLITE_DISABLE_SKIPAHEAD_DISTINCT
           40  +  SQLITE_ENABLE_8_3_NAMES
           41  +  SQLITE_ENABLE_API_ARMOR
           42  +  SQLITE_ENABLE_ATOMIC_WRITE
           43  +  SQLITE_ENABLE_CEROD
           44  +  SQLITE_ENABLE_COLUMN_METADATA
           45  +  SQLITE_ENABLE_COLUMN_USED_MASK
           46  +  SQLITE_ENABLE_COSTMULT
           47  +  SQLITE_ENABLE_CURSOR_HINTS
           48  +  SQLITE_ENABLE_DBSTAT_VTAB
           49  +  SQLITE_ENABLE_EXPENSIVE_ASSERT
           50  +  SQLITE_ENABLE_FTS1
           51  +  SQLITE_ENABLE_FTS2
           52  +  SQLITE_ENABLE_FTS3
           53  +  SQLITE_ENABLE_FTS3_PARENTHESIS
           54  +  SQLITE_ENABLE_FTS3_TOKENIZER
           55  +  SQLITE_ENABLE_FTS4
           56  +  SQLITE_ENABLE_FTS5
           57  +  SQLITE_ENABLE_HIDDEN_COLUMNS
           58  +  SQLITE_ENABLE_ICU
           59  +  SQLITE_ENABLE_IOTRACE
           60  +  SQLITE_ENABLE_JSON1
           61  +  SQLITE_ENABLE_LOAD_EXTENSION
           62  +  SQLITE_ENABLE_LOCKING_STYLE
           63  +  SQLITE_ENABLE_MEMORY_MANAGEMENT
           64  +  SQLITE_ENABLE_MEMSYS3
           65  +  SQLITE_ENABLE_MEMSYS5
           66  +  SQLITE_ENABLE_MULTIPLEX
           67  +  SQLITE_ENABLE_NULL_TRIM
           68  +  SQLITE_ENABLE_OVERSIZE_CELL_CHECK
           69  +  SQLITE_ENABLE_PREUPDATE_HOOK
           70  +  SQLITE_ENABLE_RBU
           71  +  SQLITE_ENABLE_RTREE
           72  +  SQLITE_ENABLE_SELECTTRACE
           73  +  SQLITE_ENABLE_SESSION
           74  +  SQLITE_ENABLE_SNAPSHOT
           75  +  SQLITE_ENABLE_SQLLOG
           76  +  SQLITE_ENABLE_STMT_SCANSTATUS
           77  +  SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
           78  +  SQLITE_ENABLE_UNLOCK_NOTIFY
           79  +  SQLITE_ENABLE_UPDATE_DELETE_LIMIT
           80  +  SQLITE_ENABLE_URI_00_ERROR
           81  +  SQLITE_ENABLE_VFSTRACE
           82  +  SQLITE_ENABLE_WHERETRACE
           83  +  SQLITE_ENABLE_ZIPVFS
           84  +  SQLITE_EXPLAIN_ESTIMATED_ROWS
           85  +  SQLITE_EXTRA_IFNULLROW
           86  +  SQLITE_FTS5_ENABLE_TEST_MI
           87  +  SQLITE_FTS5_NO_WITHOUT_ROWID
           88  +  SQLITE_HAS_CODEC
           89  +  SQLITE_HOMEGROWN_RECURSIVE_MUTEX
           90  +  SQLITE_IGNORE_AFP_LOCK_ERRORS
           91  +  SQLITE_IGNORE_FLOCK_LOCK_ERRORS
           92  +  SQLITE_INLINE_MEMCPY
           93  +  SQLITE_INT64_TYPE
           94  +  SQLITE_LIKE_DOESNT_MATCH_BLOBS
           95  +  SQLITE_LOCK_TRACE
           96  +  SQLITE_LOG_CACHE_SPILL
           97  +  SQLITE_MEMDEBUG
           98  +  SQLITE_MIXED_ENDIAN_64BIT_FLOAT
           99  +  SQLITE_MMAP_READWRITE
          100  +  SQLITE_MUTEX_NOOP
          101  +  SQLITE_MUTEX_NREF
          102  +  SQLITE_MUTEX_OMIT
          103  +  SQLITE_MUTEX_PTHREADS
          104  +  SQLITE_MUTEX_W32
          105  +  SQLITE_NEED_ERR_NAME
          106  +  SQLITE_NOINLINE
          107  +  SQLITE_NO_SYNC
          108  +  SQLITE_OMIT_ALTERTABLE
          109  +  SQLITE_OMIT_ANALYZE
          110  +  SQLITE_OMIT_ATTACH
          111  +  SQLITE_OMIT_AUTHORIZATION
          112  +  SQLITE_OMIT_AUTOINCREMENT
          113  +  SQLITE_OMIT_AUTOINIT
          114  +  SQLITE_OMIT_AUTOMATIC_INDEX
          115  +  SQLITE_OMIT_AUTORESET
          116  +  SQLITE_OMIT_AUTOVACUUM
          117  +  SQLITE_OMIT_BETWEEN_OPTIMIZATION
          118  +  SQLITE_OMIT_BLOB_LITERAL
          119  +  SQLITE_OMIT_BTREECOUNT
          120  +  SQLITE_OMIT_CAST
          121  +  SQLITE_OMIT_CHECK
          122  +  SQLITE_OMIT_COMPLETE
          123  +  SQLITE_OMIT_COMPOUND_SELECT
          124  +  SQLITE_OMIT_CONFLICT_CLAUSE
          125  +  SQLITE_OMIT_CTE
          126  +  SQLITE_OMIT_DATETIME_FUNCS
          127  +  SQLITE_OMIT_DECLTYPE
          128  +  SQLITE_OMIT_DEPRECATED
          129  +  SQLITE_OMIT_DISKIO
          130  +  SQLITE_OMIT_EXPLAIN
          131  +  SQLITE_OMIT_FLAG_PRAGMAS
          132  +  SQLITE_OMIT_FLOATING_POINT
          133  +  SQLITE_OMIT_FOREIGN_KEY
          134  +  SQLITE_OMIT_GET_TABLE
          135  +  SQLITE_OMIT_HEX_INTEGER
          136  +  SQLITE_OMIT_INCRBLOB
          137  +  SQLITE_OMIT_INTEGRITY_CHECK
          138  +  SQLITE_OMIT_LIKE_OPTIMIZATION
          139  +  SQLITE_OMIT_LOAD_EXTENSION
          140  +  SQLITE_OMIT_LOCALTIME
          141  +  SQLITE_OMIT_LOOKASIDE
          142  +  SQLITE_OMIT_MEMORYDB
          143  +  SQLITE_OMIT_OR_OPTIMIZATION
          144  +  SQLITE_OMIT_PAGER_PRAGMAS
          145  +  SQLITE_OMIT_PARSER_TRACE
          146  +  SQLITE_OMIT_POPEN
          147  +  SQLITE_OMIT_PRAGMA
          148  +  SQLITE_OMIT_PROGRESS_CALLBACK
          149  +  SQLITE_OMIT_QUICKBALANCE
          150  +  SQLITE_OMIT_REINDEX
          151  +  SQLITE_OMIT_SCHEMA_PRAGMAS
          152  +  SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
          153  +  SQLITE_OMIT_SHARED_CACHE
          154  +  SQLITE_OMIT_SHUTDOWN_DIRECTORIES
          155  +  SQLITE_OMIT_SUBQUERY
          156  +  SQLITE_OMIT_TCL_VARIABLE
          157  +  SQLITE_OMIT_TEMPDB
          158  +  SQLITE_OMIT_TEST_CONTROL
          159  +  SQLITE_OMIT_TRACE
          160  +  SQLITE_OMIT_TRIGGER
          161  +  SQLITE_OMIT_TRUNCATE_OPTIMIZATION
          162  +  SQLITE_OMIT_UTF16
          163  +  SQLITE_OMIT_VACUUM
          164  +  SQLITE_OMIT_VIEW
          165  +  SQLITE_OMIT_VIRTUALTABLE
          166  +  SQLITE_OMIT_WAL
          167  +  SQLITE_OMIT_WSD
          168  +  SQLITE_OMIT_XFER_OPT
          169  +  SQLITE_PCACHE_SEPARATE_HEADER
          170  +  SQLITE_PERFORMANCE_TRACE
          171  +  SQLITE_POWERSAFE_OVERWRITE
          172  +  SQLITE_PREFER_PROXY_LOCKING
          173  +  SQLITE_PROXY_DEBUG
          174  +  SQLITE_REVERSE_UNORDERED_SELECTS
          175  +  SQLITE_RTREE_INT_ONLY
          176  +  SQLITE_SECURE_DELETE
          177  +  SQLITE_SMALL_STACK
          178  +  SQLITE_SOUNDEX
          179  +  SQLITE_SUBSTR_COMPATIBILITY
          180  +  SQLITE_SYSTEM_MALLOC
          181  +  SQLITE_TCL
          182  +  SQLITE_TEST
          183  +  SQLITE_UNLINK_AFTER_CLOSE
          184  +  SQLITE_UNTESTABLE
          185  +  SQLITE_USE_ALLOCA
          186  +  SQLITE_USE_FCNTL_TRACE
          187  +  SQLITE_USER_AUTHENTICATION
          188  +  SQLITE_USE_URI
          189  +  SQLITE_VDBE_COVERAGE
          190  +  SQLITE_WIN32_MALLOC
          191  +  SQLITE_ZERO_MALLOC
          192  +}
          193  +
          194  +# All compile time options for which the assigned value is other than boolean.
          195  +#
          196  +set value_options {
          197  +  SQLITE_BITMASK_TYPE
          198  +  SQLITE_DEFAULT_CACHE_SIZE
          199  +  SQLITE_DEFAULT_FILE_FORMAT
          200  +  SQLITE_DEFAULT_FILE_PERMISSIONS
          201  +  SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT
          202  +  SQLITE_DEFAULT_LOCKING_MODE
          203  +  SQLITE_DEFAULT_LOOKASIDE
          204  +  SQLITE_DEFAULT_MMAP_SIZE
          205  +  SQLITE_DEFAULT_PAGE_SIZE
          206  +  SQLITE_DEFAULT_PCACHE_INITSZ
          207  +  SQLITE_DEFAULT_PROXYDIR_PERMISSIONS
          208  +  SQLITE_DEFAULT_ROWEST
          209  +  SQLITE_DEFAULT_SECTOR_SIZE
          210  +  SQLITE_DEFAULT_SYNCHRONOUS
          211  +  SQLITE_DEFAULT_WAL_AUTOCHECKPOINT
          212  +  SQLITE_DEFAULT_WAL_SYNCHRONOUS
          213  +  SQLITE_DEFAULT_WORKER_THREADS
          214  +  SQLITE_ENABLE_8_3_NAMES
          215  +  SQLITE_ENABLE_LOCKING_STYLE
          216  +  SQLITE_EXTRA_INIT
          217  +  SQLITE_EXTRA_SHUTDOWN
          218  +  SQLITE_FTS3_MAX_EXPR_DEPTH
          219  +  SQLITE_INTEGRITY_CHECK_ERROR_MAX
          220  +  SQLITE_MALLOC_SOFT_LIMIT
          221  +  SQLITE_MAX_ATTACHED
          222  +  SQLITE_MAX_COLUMN
          223  +  SQLITE_MAX_COMPOUND_SELECT
          224  +  SQLITE_MAX_DEFAULT_PAGE_SIZE
          225  +  SQLITE_MAX_EXPR_DEPTH
          226  +  SQLITE_MAX_FUNCTION_ARG
          227  +  SQLITE_MAX_LENGTH
          228  +  SQLITE_MAX_LIKE_PATTERN_LENGTH
          229  +  SQLITE_MAX_MEMORY
          230  +  SQLITE_MAX_MMAP_SIZE
          231  +  SQLITE_MAX_MMAP_SIZE_
          232  +  SQLITE_MAX_PAGE_COUNT
          233  +  SQLITE_MAX_PAGE_SIZE
          234  +  SQLITE_MAX_SCHEMA_RETRY
          235  +  SQLITE_MAX_SQL_LENGTH
          236  +  SQLITE_MAX_TRIGGER_DEPTH
          237  +  SQLITE_MAX_VARIABLE_NUMBER
          238  +  SQLITE_MAX_VDBE_OP
          239  +  SQLITE_MAX_WORKER_THREADS
          240  +  SQLITE_SORTER_PMASZ
          241  +  SQLITE_STAT4_SAMPLES
          242  +  SQLITE_STMTJRNL_SPILL
          243  +  SQLITE_TEMP_STORE
          244  +}
          245  +
          246  +# Options that require custom code.
          247  +#
          248  +set options(ENABLE_STAT3) {
          249  +#if defined(SQLITE_ENABLE_STAT4)
          250  +  "ENABLE_STAT4",
          251  +#elif defined(SQLITE_ENABLE_STAT3)
          252  +  "ENABLE_STAT3",
          253  +#endif
          254  +}
          255  +set options(COMPILER) {
          256  +#if defined(__clang__) && defined(__clang_major__)
          257  +  "COMPILER=clang-" CTIMEOPT_VAL(__clang_major__) "."
          258  +                    CTIMEOPT_VAL(__clang_minor__) "."
          259  +                    CTIMEOPT_VAL(__clang_patchlevel__),
          260  +#elif defined(_MSC_VER)
          261  +  "COMPILER=msvc-" CTIMEOPT_VAL(_MSC_VER),
          262  +#elif defined(__GNUC__) && defined(__VERSION__)
          263  +  "COMPILER=gcc-" __VERSION__,
          264  +#endif
          265  +}
          266  +set options(HAVE_ISNAN) {
          267  +#if HAVE_ISNAN || SQLITE_HAVE_ISNAN
          268  +  "HAVE_ISNAN",
          269  +#endif
          270  +}
          271  +set options(THREADSAFE) {
          272  +#if defined(SQLITE_THREADSAFE)
          273  +  "THREADSAFE=" CTIMEOPT_VAL(SQLITE_THREADSAFE),
          274  +#elif defined(THREADSAFE)
          275  +  "THREADSAFE=" CTIMEOPT_VAL(THREADSAFE),
          276  +#else
          277  +  "THREADSAFE=1"
          278  +#endif
          279  +}
          280  +
          281  +proc trim_name {in} {
          282  +  set ret $in
          283  +  if {[string range $in 0 6]=="SQLITE_"} {
          284  +    set ret [string range $in 7 end]
          285  +  }
          286  +  return $ret
          287  +}
          288  +
          289  +foreach b $boolean_options {
          290  +  set name [trim_name $b]
          291  +  set options($name) [subst {
          292  +#if $b
          293  +  "$name",
          294  +#endif
          295  +}]
          296  +}
          297  +  
          298  +foreach v $value_options {
          299  +  set name [trim_name $v]
          300  +  set options($name) [subst {
          301  +#ifdef $v
          302  +  "$name=" CTIMEOPT_VAL($v),
          303  +#endif
          304  +}]
          305  +}
          306  +
          307  +foreach o [lsort [array names options]] {
          308  +  puts [string trim $options($o)]
          309  +}
          310  +
          311  +

Changes to tool/mksqlite3c.tcl.

   278    278   
   279    279   
   280    280   # Process the source files.  Process files containing commonly
   281    281   # used subroutines first in order to help the compiler find
   282    282   # inlining opportunities.
   283    283   #
   284    284   foreach file {
          285  +   ctime.c
   285    286      sqliteInt.h
   286    287   
   287    288      global.c
   288         -   ctime.c
   289    289      status.c
   290    290      date.c
   291    291      os.c
   292    292   
   293    293      fault.c
   294    294      mem0.c
   295    295      mem1.c