From 27b2f05335a0fff69656fe54c3904fd3ee670a6e Mon Sep 17 00:00:00 2001 From: mistachkin Date: Mon, 12 Jan 2015 19:49:46 +0000 Subject: [PATCH] Harmless compiler warning fixes for 'testfixture' and the miscellaneous extensions when built with the MSVC makefile. FossilOrigin-Name: 923fd66031ed1876bc63c3a038f0b8e33678184e --- Makefile.msc | 11 ++++++----- manifest | 26 +++++++++++++------------- manifest.uuid | 2 +- src/msvc.h | 7 +++++++ src/tclsqlite.c | 10 +++++++++- src/test1.c | 8 ++++---- src/test2.c | 2 +- src/test8.c | 6 +++--- src/test_journal.c | 4 +++- src/test_multiplex.c | 2 +- 10 files changed, 48 insertions(+), 30 deletions(-) diff --git a/Makefile.msc b/Makefile.msc index f301048fae..532b35ba5c 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -28,7 +28,8 @@ USE_FULLWARN = 0 # !IFNDEF NO_WARN !IF $(USE_FULLWARN)!=0 -NO_WARN = -wd4054 -wd4055 -wd4100 -wd4210 -wd4702 +NO_WARN = -wd4054 -wd4055 -wd4100 -wd4127 -wd4152 -wd4189 -wd4206 -wd4210 +NO_WARN = $(NO_WARN) -wd4232 -wd4244 -wd4702 -wd4706 !ENDIF !ENDIF @@ -274,7 +275,7 @@ NLTLIBPATHS = "/LIBPATH:$(NCRTLIBPATH)" "/LIBPATH:$(NSDKLIBPATH)" # same unless your are cross-compiling.) # !IF $(USE_FULLWARN)!=0 -TCC = $(CC) -W4 +TCC = $(CC) -W4 -DINCLUDE_MSVC_H=1 !ELSE TCC = $(CC) -W3 !ENDIF @@ -1017,8 +1018,7 @@ libtclsqlite3.lib: tclsqlite.lo libsqlite3.lib $(LTLIB) $(LTLIBOPTS) $(LTLIBPATHS) /OUT:$@ tclsqlite.lo libsqlite3.lib $(LIBTCL:tcl=tclstub) $(TLIBS) sqlite3.exe: $(TOP)\src\shell.c libsqlite3.lib $(LIBRESOBJS) sqlite3.h - $(LTLINK) $(READLINE_FLAGS) \ - -DINCLUDE_MSVC_H=1 $(TOP)\src\shell.c \ + $(LTLINK) $(READLINE_FLAGS) $(TOP)\src\shell.c \ /link $(LTLINKOPTS) $(LTLIBPATHS) libsqlite3.lib $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS) mptester.exe: $(TOP)\mptest\mptest.c libsqlite3.lib $(LIBRESOBJS) sqlite3.h @@ -1422,7 +1422,8 @@ rtree.lo: $(TOP)\ext\rtree\rtree.c $(HDR) $(EXTHDR) # hidden when the library is built via the amalgamation). # TESTFIXTURE_FLAGS = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1 -TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE +TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" +TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_CORE $(NO_WARN) TESTFIXTURE_SRC0 = $(TESTEXT) $(TESTSRC2) libsqlite3.lib TESTFIXTURE_SRC1 = $(TESTEXT) $(SQLITE3C) diff --git a/manifest b/manifest index 8d577e9692..d4b0f884cf 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Merge\supdates\sfrom\strunk. -D 2015-01-12T18:52:57.919 +C Harmless\scompiler\swarning\sfixes\sfor\s'testfixture'\sand\sthe\smiscellaneous\sextensions\swhen\sbuilt\swith\sthe\sMSVC\smakefile. +D 2015-01-12T19:49:46.321 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 9efcdb5c6025caea362cdfc38817451170fc6344 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 -F Makefile.msc 2ed20e3ee252eb85dea357940a2e5e5649f9dd86 +F Makefile.msc 42ce34934c4e1c957f194bd76992aa9008c2daa5 F Makefile.vxworks e1b65dea203f054e71653415bd8f96dcaed47858 F README.md d58e3bebc0a4145e0f2a87994015fdb575a8e866 F VERSION d846487aff892625eb8e75960234e7285f0462fe @@ -203,7 +203,7 @@ F src/mem2.c f1940d9e91948dd6a908fbb9ce3835c36b5d83c3 F src/mem3.c 61c9d47b792908c532ca3a62b999cf21795c6534 F src/mem5.c 61eeb90134f9a5be6c2e68d8daae7628b25953fb F src/memjournal.c 3eb2c0b51adbd869cb6a44780323f05fa904dc85 -F src/msvc.h 546453caaf5227521f1fb87a5033b37e00675608 +F src/msvc.h 9dc7aedcf4f19696f2e5aac148a654ed0ddcaf35 F src/mutex.c 19bf9acba69ca2f367c3761080f8a9f0cf4670a8 F src/mutex.h 779d588e3b7756ec3ecf7d78cde1d84aba414f85 F src/mutex_noop.c f3f09fd7a2eb4287cfc799753ffc30380e7b71a1 @@ -238,15 +238,15 @@ F src/sqliteInt.h eaf210295b551d4e40e622aec1b2261c0b28f844 F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 81712116e826b0089bb221b018929536b2b5406f F src/table.c e7a09215315a978057fb42c640f890160dbcc45e -F src/tclsqlite.c b1d0a181a9f8e8dae960370518a3450db93a6a8c -F src/test1.c 163cff8c4ebdda512e3b055716e3cc7f0e563a44 -F src/test2.c 98049e51a17dc62606a99a9eb95ee477f9996712 +F src/tclsqlite.c 799315b0cdc0f9ca498573c46ea2d678a9cfdde6 +F src/test1.c 093d8b5b54b829dcfebae3181d4406edcc935d90 +F src/test2.c 577961fe48961b2f2e5c8b56ee50c3f459d3359d F src/test3.c 1c0e5d6f080b8e33c1ce8b3078e7013fdbcd560c F src/test4.c 9b32d22f5f150abe23c1830e2057c4037c45b3df F src/test5.c 5a34feec76d9b3a86aab30fd4f6cc9c48cbab4c1 F src/test6.c 41cacf3b0dd180823919bf9e1fbab287c9266723 F src/test7.c 72b732baa5642f795655ba1126ea032af46ecfd2 -F src/test8.c bf3bad9a7df2e7c58d3371ea913abeaedb429a38 +F src/test8.c df8dd4c99c1dd2225cb2a6f334299cddc5dcf1f1 F src/test9.c bea1e8cf52aa93695487badedd6e1886c321ea60 F src/test_async.c 21e11293a2f72080eda70e1124e9102044531cd8 F src/test_autoext.c dea8a01a7153b9adc97bd26161e4226329546e12 @@ -262,10 +262,10 @@ F src/test_hexio.c abfdecb6fa58c354623978efceb088ca18e379cd F src/test_init.c 66b33120ffe9cd853b5a905ec850d51151337b32 F src/test_intarray.c 6c610a21ab8edde85a3a2c7f2b069244ecf4d834 F src/test_intarray.h 9dc57417fb65bc7835cc18548852cc08cc062202 -F src/test_journal.c f5c0a05b7b3d5930db769b5ee6c3766dc2221a64 +F src/test_journal.c de3402cbd600b55b6bac74663135b7a4e159ff66 F src/test_loadext.c a5251f956ab6af21e138dc1f9c0399394a510cb4 F src/test_malloc.c fffc66b2e7743ce93f039187d3fd78664193c664 -F src/test_multiplex.c caadb62cc777268b4f8fb94d5b27b80156c8f7c0 +F src/test_multiplex.c 0ac6d9197e3d4baa530785b882b631c0086351a1 F src/test_multiplex.h c08e4e8f8651f0c5e0509b138ff4d5b43ed1f5d3 F src/test_mutex.c 293042d623ebba969160f471a82aa1551626454f F src/test_onefile.c 0396f220561f3b4eedc450cef26d40c593c69a25 @@ -1236,7 +1236,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P c8725fa5fa361959b0f0a3fb36f204905d6f0ae9 11e81ac2a7c917f7c9afc218d104d9870daf9668 -R 2eb9ddda90091ff81afdfabf278ccd4b +P ca5f2c545216c82486e66d26f55b49cbf351ffdc +R abdafb1ebc48afc63d88753056c322e6 U mistachkin -Z b3ea8767e897ce2d6470ea9439664def +Z bd158ce8f1d3955470f74e8e3dfe7133 diff --git a/manifest.uuid b/manifest.uuid index fd770dd259..118dd4b43c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ca5f2c545216c82486e66d26f55b49cbf351ffdc \ No newline at end of file +923fd66031ed1876bc63c3a038f0b8e33678184e \ No newline at end of file diff --git a/src/msvc.h b/src/msvc.h index 85951c846a..09f518454a 100644 --- a/src/msvc.h +++ b/src/msvc.h @@ -16,10 +16,17 @@ #define _MSVC_H_ #if defined(_MSC_VER) +#pragma warning(disable : 4054) +#pragma warning(disable : 4055) #pragma warning(disable : 4100) #pragma warning(disable : 4127) +#pragma warning(disable : 4152) +#pragma warning(disable : 4189) +#pragma warning(disable : 4206) +#pragma warning(disable : 4210) #pragma warning(disable : 4232) #pragma warning(disable : 4244) +#pragma warning(disable : 4702) #pragma warning(disable : 4706) #endif /* defined(_MSC_VER) */ diff --git a/src/tclsqlite.c b/src/tclsqlite.c index 852f966a85..747017e32e 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -25,6 +25,14 @@ ** hundreds of new commands used for testing ** SQLite. This option implies -DSQLITE_TCLMD5. */ + +/* +** If requested, include the SQLite compiler options file for MSVC. +*/ +#if defined(INCLUDE_MSVC_H) +#include "msvc.h" +#endif + #include "tcl.h" #include @@ -3102,7 +3110,7 @@ static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ ** The EXTERN macros are required by TCL in order to work on windows. */ EXTERN int Sqlite3_Init(Tcl_Interp *interp){ - int rc = Tcl_InitStubs(interp, "8.4", 0)==0 ? TCL_ERROR : TCL_OK; + int rc = Tcl_InitStubs(interp, "8.4", 0) ? TCL_OK : TCL_ERROR; if( rc==TCL_OK ){ Tcl_CreateObjCommand(interp, "sqlite3", (Tcl_ObjCmdProc*)DbMain, 0, 0); #ifndef SQLITE_3_SUFFIX_ONLY diff --git a/src/test1.c b/src/test1.c index 475473d77c..8f21660c27 100644 --- a/src/test1.c +++ b/src/test1.c @@ -567,7 +567,7 @@ static int test_get_table_printf( Tcl_DString str; int rc; char *zErr = 0; - int nRow, nCol; + int nRow = 0, nCol = 0; char **aResult; int i; char zBuf[30]; @@ -2120,7 +2120,7 @@ static int test_stmt_status( Tcl_Obj *CONST objv[] ){ int iValue; - int i, op, resetFlag; + int i, op = 0, resetFlag; const char *zOpName; sqlite3_stmt *pStmt; @@ -3098,7 +3098,7 @@ static int test_bind_double( ){ sqlite3_stmt *pStmt; int idx; - double value; + double value = 0; int rc; const char *zVal; int i; @@ -5458,7 +5458,7 @@ static int test_limit( { "SQLITE_LIMIT_TOOSMALL", -1, }, { "SQLITE_LIMIT_TOOBIG", SQLITE_LIMIT_WORKER_THREADS+1 }, }; - int i, id; + int i, id = 0; int val; const char *zId; diff --git a/src/test2.c b/src/test2.c index 58f271ff27..7192ddfffb 100644 --- a/src/test2.c +++ b/src/test2.c @@ -310,7 +310,7 @@ static int page_get( ){ Pager *pPager; char zBuf[100]; - DbPage *pPage; + DbPage *pPage = 0; int pgno; int rc; if( argc!=3 ){ diff --git a/src/test8.c b/src/test8.c index 407dd54c79..f37a28ced6 100644 --- a/src/test8.c +++ b/src/test8.c @@ -777,11 +777,11 @@ static int echoBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ sqlite3_stmt *pStmt = 0; Tcl_Interp *interp = pVtab->interp; - int nRow; + int nRow = 0; int useIdx = 0; int rc = SQLITE_OK; int useCost = 0; - double cost; + double cost = 0; int isIgnoreUsable = 0; if( Tcl_GetVar(interp, "echo_module_ignore_usable", TCL_GLOBAL_ONLY) ){ isIgnoreUsable = 1; @@ -927,7 +927,7 @@ int echoUpdate( sqlite3 *db = pVtab->db; int rc = SQLITE_OK; - sqlite3_stmt *pStmt; + sqlite3_stmt *pStmt = 0; char *z = 0; /* SQL statement to execute */ int bindArgZero = 0; /* True to bind apData[0] to sql var no. nData */ int bindArgOne = 0; /* True to bind apData[1] to sql var no. 1 */ diff --git a/src/test_journal.c b/src/test_journal.c index e8701a4eea..f9e5c86c82 100644 --- a/src/test_journal.c +++ b/src/test_journal.c @@ -409,7 +409,9 @@ static int openTransaction(jt_file *pMain, jt_file *pJournal){ if( iOff==PENDING_BYTE ) continue; rc = sqlite3OsRead(pMain->pReal, aData, pMain->nPagesize, iOff); pMain->aCksum[ii] = genCksum(aData, pMain->nPagesize); - if( ii+1==pMain->nPage && rc==SQLITE_IOERR_SHORT_READ ) rc = SQLITE_OK; + if( ii+1==(int)pMain->nPage && rc==SQLITE_IOERR_SHORT_READ ){ + rc = SQLITE_OK; + } } } diff --git a/src/test_multiplex.c b/src/test_multiplex.c index 99819371ce..227864844b 100644 --- a/src/test_multiplex.c +++ b/src/test_multiplex.c @@ -535,7 +535,7 @@ static int multiplexOpen( /* assign pointers to extra space allocated */ memset(pGroup, 0, sz); pMultiplexOpen->pGroup = pGroup; - pGroup->bEnabled = -1; + pGroup->bEnabled = (unsigned char)-1; pGroup->bTruncate = sqlite3_uri_boolean(zUri, "truncate", (flags & SQLITE_OPEN_MAIN_DB)==0); pGroup->szChunk = (int)sqlite3_uri_int64(zUri, "chunksize",