diff options
author | drh <> | 2022-02-11 11:37:12 +0000 |
---|---|---|
committer | drh <> | 2022-02-11 11:37:12 +0000 |
commit | 0d58ae010c386d628ded9db0774dce236b128e9a (patch) | |
tree | 86b8ce3c084930afb236e6a37282250ff1c989b0 /src | |
parent | b30af022da72ad79a9085af758ff3a3b5751c8fc (diff) | |
download | sqlite-0d58ae010c386d628ded9db0774dce236b128e9a.tar.gz sqlite-0d58ae010c386d628ded9db0774dce236b128e9a.zip |
Work around the MSVC bug that prevents the use of function pointer types in
the second argument of va_arg() by adding a typedef.
FossilOrigin-Name: eae3ab0a050079d050f339b2510eebd55afe4464e9b410ddacb7523f89981144
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/main.c b/src/main.c index f34e981d5..7ff524c9a 100644 --- a/src/main.c +++ b/src/main.c @@ -4029,12 +4029,14 @@ int sqlite3_test_control(int op, ...){ ** sqlite3_test_control(). */ case SQLITE_TESTCTRL_FAULT_INSTALL: { - /* MSVC is picky about pulling func ptrs from va lists. - ** http://support.microsoft.com/kb/47961 + /* A bug in MSVC prevents it from understanding pointers to functions + ** types in the second argument to va_arg(). Work around the problem + ** using a typedef. + ** http://support.microsoft.com/kb/47961 <-- dead hyperlink ** sqlite3GlobalConfig.xTestCallback = va_arg(ap, int(*)(int)); */ - typedef int(*TESTCALLBACKFUNC_t)(int); - sqlite3GlobalConfig.xTestCallback = va_arg(ap, TESTCALLBACKFUNC_t); + typedef int(*sqlite3FaultFuncType)(int); + sqlite3GlobalConfig.xTestCallback = va_arg(ap, sqlite3FaultFuncType); rc = sqlite3FaultSim(0); break; } @@ -4177,8 +4179,8 @@ int sqlite3_test_control(int op, ...){ case SQLITE_TESTCTRL_LOCALTIME_FAULT: { sqlite3GlobalConfig.bLocaltimeFault = va_arg(ap, int); if( sqlite3GlobalConfig.bLocaltimeFault==2 ){ - sqlite3GlobalConfig.xAltLocaltime = - va_arg(ap, int(*)(const void*,void*)); + typedef int(*sqlite3LocaltimeType)(const void*,void*); + sqlite3GlobalConfig.xAltLocaltime = va_arg(ap, sqlite3LocaltimeType); }else{ sqlite3GlobalConfig.xAltLocaltime = 0; } |