diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/global.c | 2 | ||||
-rw-r--r-- | src/main.c | 7 | ||||
-rw-r--r-- | src/shell.c.in | 11 | ||||
-rw-r--r-- | src/test1.c | 17 |
4 files changed, 27 insertions, 10 deletions
diff --git a/src/global.c b/src/global.c index dc765522e..60cd13e2a 100644 --- a/src/global.c +++ b/src/global.c @@ -243,7 +243,7 @@ SQLITE_WSD struct Sqlite3Config sqlite3Config = { SQLITE_ALLOW_COVERING_INDEX_SCAN, /* bUseCis */ 0, /* bSmallMalloc */ 1, /* bExtraSchemaChecks */ - sizeof(long double)>8, /* bUseLongDouble */ + sizeof(LONGDOUBLE_TYPE)>8, /* bUseLongDouble */ 0x7ffffffe, /* mxStrlen */ 0, /* neverCorrupt */ SQLITE_DEFAULT_LOOKASIDE, /* szLookaside, nLookaside */ diff --git a/src/main.c b/src/main.c index 19f65dac6..8f21af13e 100644 --- a/src/main.c +++ b/src/main.c @@ -4472,11 +4472,14 @@ int sqlite3_test_control(int op, ...){ /* sqlite3_test_control(SQLITE_TESTCTRL_USELONGDOUBLE, int X); ** - ** Enable long double usage if X>0. Disable if X==0. No-op if X<0. - ** Return the status of long double usage afterwards. + ** X<0 Make no changes to the bUseLongDouble. Just report value. + ** X==0 Disable bUseLongDouble + ** X==1 Enable bUseLongDouble + ** X==2 Set bUseLongDouble to its default value for this platform */ case SQLITE_TESTCTRL_USELONGDOUBLE: { int b = va_arg(ap, int); + if( b==2 ) b = sizeof(LONGDOUBLE_TYPE)>8; if( b>=0 ) sqlite3Config.bUseLongDouble = b>0; rc = sqlite3Config.bUseLongDouble!=0; break; diff --git a/src/shell.c.in b/src/shell.c.in index 295d405cb..9165f21f7 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -10876,7 +10876,7 @@ static int do_meta_command(char *zLine, ShellState *p){ {"seek_count", SQLITE_TESTCTRL_SEEK_COUNT, 0, "" }, {"sorter_mmap", SQLITE_TESTCTRL_SORTER_MMAP, 0, "NMAX" }, {"tune", SQLITE_TESTCTRL_TUNE, 1, "ID VALUE" }, - {"uselongdouble", SQLITE_TESTCTRL_USELONGDOUBLE,0,"BOOLEAN" }, + {"uselongdouble", SQLITE_TESTCTRL_USELONGDOUBLE,0,"?BOOLEAN|\"default\"?"}, }; int testctrl = -1; int iCtrl = -1; @@ -11000,7 +11000,14 @@ static int do_meta_command(char *zLine, ShellState *p){ /* sqlite3_test_control(int, int) */ case SQLITE_TESTCTRL_USELONGDOUBLE: { - int opt = nArg==3 ? booleanValue(azArg[2]) : -1; + int opt = -1; + if( nArg==3 ){ + if( cli_strcmp(azArg[2],"default")==0 ){ + opt = 2; + }else{ + opt = booleanValue(azArg[2]); + } + } rc2 = sqlite3_test_control(testctrl, opt); isOk = 1; break; diff --git a/src/test1.c b/src/test1.c index acae44c8a..adc862156 100644 --- a/src/test1.c +++ b/src/test1.c @@ -7099,11 +7099,14 @@ static int SQLITE_TCLAPI extra_schema_checks( } /* -** tclcmd: use_long_double INT +** tclcmd: use_long_double BOOLEAN|"default" ** -** Enable or disable the use of long double. Enable if the argument is -** positive. Disable if the argument is zero. No-op if the argument is -** negative. +** If no argument, report the current value of the use-long-double flag. +** +** If argument is "default", set the use-long-double flag to the default +** value for this build, based on the size of LONGDOUBLE_TYPE. +** +** If argument is a boolean, set the use-long-double flag accordingly. ** ** Return the new setting. */ @@ -7115,7 +7118,11 @@ static int SQLITE_TCLAPI use_long_double( ){ int i = -1; if( objc==2 ){ - if( Tcl_GetBooleanFromObj(interp,objv[1],&i) ) return TCL_ERROR; + if( strcmp(Tcl_GetString(objv[1]),"default")==0 ){ + i = 2; + }else{ + if( Tcl_GetBooleanFromObj(interp,objv[1],&i) ) return TCL_ERROR; + } } i = sqlite3_test_control(SQLITE_TESTCTRL_USELONGDOUBLE, i); Tcl_SetObjResult(interp, Tcl_NewIntObj(i)); |