From: drh Date: Tue, 16 Aug 2011 17:06:21 +0000 (+0000) Subject: Fix a few harmless compiler warnings. Add SQLITE_ENABLE_STAT3 to the X-Git-Tag: version-3.7.9~67^2~11^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6825719667cd6c7a15f6cc160e01e8d11641f172;p=thirdparty%2Fsqlite.git Fix a few harmless compiler warnings. Add SQLITE_ENABLE_STAT3 to the standard compiler warning script. FossilOrigin-Name: 3d68f9afee02f95103eb1682b8f2362f8d249437 --- diff --git a/manifest b/manifest index b75563c2cb..e28f8e0d61 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Allow\sthe\ssqlite3VdbeJumpHere()\sroutine\sto\saccept\sa\snegative\sor\szero\saddress\nif\sa\sprior\smemory\sallocation\serror\shas\soccurred.\s\sThe\snew\ssqlite_stat3\slogic\nneeds\sthis. -D 2011-08-16T02:07:04.573 +C Fix\sa\sfew\sharmless\scompiler\swarnings.\s\sAdd\sSQLITE_ENABLE_STAT3\sto\sthe\nstandard\scompiler\swarning\sscript. +D 2011-08-16T17:06:21.985 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1e6988b3c11dee9bd5edc0c804bd4468d74a9cdc F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -118,7 +118,7 @@ F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b F sqlite3.1 6be1ad09113570e1fc8dcaff84c9b0b337db5ffc F sqlite3.pc.in ae6f59a76e862f5c561eb32a380228a02afc3cad F src/alter.c ac80a0f31189f8b4a524ebf661e47e84536ee7f5 -F src/analyze.c 8a41063db56d2fe4735a1ae4dd556b37df1702e1 +F src/analyze.c f436b0f53be47fbc03c661ec7c2b4c5fec14077e F src/attach.c 12c6957996908edc31c96d7c68d4942c2474405f F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34 F src/backup.c 986c15232757f2873dff35ee3b35cbf935fc573c @@ -250,7 +250,7 @@ F src/vtab.c 901791a47318c0562cd0c676a2c6ff1bc530e582 F src/wal.c 3154756177d6219e233d84291d5b05f4e06ff5e9 F src/wal.h 66b40bd91bc29a5be1c88ddd1f5ade8f3f48728a F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f -F src/where.c 118896232fe70b1ac9c2ef2811675d5bef8b9c40 +F src/where.c 3d9a78a422726c1b3a57188c3099e537cb18e18a F test/8_3_names.test 631ea964a3edb091cf73c3b540f6bcfdb36ce823 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87 @@ -958,8 +958,8 @@ F tool/split-sqlite3c.tcl d9be87f1c340285a3e081eb19b4a247981ed290c F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P 2c83ac89dc5a6017587defb541c9f3731b98892a -R 1450328cb5bbd53defdba59501aa7ba3 +F tool/warnings.sh 682b359e1531c8d4c805e2c1b5656b2d76e481e3 +P 9650d7962804d61f56cac944ff9bb2c7bc111957 +R f1db5c89fee04ee43fcb815b658cde4c U drh -Z d5f58e0bf7dc218c29e54b5a642cee65 +Z 935e4c47860333dc9df37a80ab259764 diff --git a/manifest.uuid b/manifest.uuid index fdfada439b..80c96250c0 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9650d7962804d61f56cac944ff9bb2c7bc111957 \ No newline at end of file +3d68f9afee02f95103eb1682b8f2362f8d249437 \ No newline at end of file diff --git a/src/analyze.c b/src/analyze.c index 0ba9b2bfae..f7dba4b6b8 100644 --- a/src/analyze.c +++ b/src/analyze.c @@ -254,6 +254,7 @@ static void stat3Init( int mxSample; int n; + UNUSED_PARAMETER(argc); nRow = (tRowcnt)sqlite3_value_int64(argv[0]); mxSample = sqlite3_value_int(argv[1]); n = sizeof(*p) + sizeof(p->a[0])*mxSample; @@ -309,8 +310,10 @@ static void stat3Push( struct Stat3Sample *pSample; int i; u32 h; - if( nEq==0 ) return; + UNUSED_PARAMETER(context); + UNUSED_PARAMETER(argc); + if( nEq==0 ) return; h = p->iPrn = p->iPrn*1103515245 + 12345; if( (nLt/p->nPSample)!=((nEq+nLt)/p->nPSample) ){ doInsert = isPSample = 1; @@ -497,7 +500,7 @@ static void analyzeOneTable( for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ int nCol; KeyInfo *pKey; - int addrIfNot; /* address of OP_IfNot */ + int addrIfNot = 0; /* address of OP_IfNot */ int *aChngAddr; /* Array of jump instruction addresses */ if( pOnlyIdx && pOnlyIdx!=pIdx ) continue; @@ -907,6 +910,7 @@ void sqlite3DeleteIndexSamples(sqlite3 *db, Index *pIdx){ } sqlite3_free(pIdx->aSample); } + UNUSED_PARAMETER(db); pIdx->nSample = 0; pIdx->aSample = 0; #else @@ -925,7 +929,7 @@ static int loadStat3(sqlite3 *db, const char *zDb){ sqlite3_stmt *pStmt = 0; /* An SQL statement being run */ char *zSql; /* Text of the SQL statement */ Index *pPrevIdx = 0; /* Previous index in the loop */ - int idx; /* slot in pIdx->aSample[] for next sample */ + int idx = 0; /* slot in pIdx->aSample[] for next sample */ int eType; /* Datatype of a sample */ IndexSample *pSample; /* A slot in pIdx->aSample[] */ diff --git a/src/where.c b/src/where.c index fe8bd90498..33969c0439 100644 --- a/src/where.c +++ b/src/where.c @@ -2499,7 +2499,6 @@ static int whereKeyStats( sqlite3 *db = pParse->db; CollSeq *pColl; const u8 *z; - int n; if( eType==SQLITE_BLOB ){ z = (const u8 *)sqlite3_value_blob(pVal); pColl = db->pDfltColl; @@ -2796,10 +2795,10 @@ static int whereInScanEst( ExprList *pList, /* The value list on the RHS of "x IN (v1,v2,v3,...)" */ double *pnRow /* Write the revised row estimate here */ ){ - int rc = SQLITE_OK; /* Subfunction return code */ - double nEst; /* Number of rows for a single term */ - double nRowEst; /* New estimate of the number of rows */ - int i; /* Loop counter */ + int rc = SQLITE_OK; /* Subfunction return code */ + double nEst; /* Number of rows for a single term */ + double nRowEst = (double)0; /* New estimate of the number of rows */ + int i; /* Loop counter */ assert( p->aSample!=0 ); for(i=0; rc==SQLITE_OK && inExpr; i++){ diff --git a/tool/warnings.sh b/tool/warnings.sh index 2eb3992f09..29b54374ef 100644 --- a/tool/warnings.sh +++ b/tool/warnings.sh @@ -8,9 +8,9 @@ echo '********** No optimizations. Includes FTS4 and RTREE *********' gcc -c -Wshadow -Wall -Wextra -pedantic-errors -Wno-long-long -std=c89 \ -ansi -DHAVE_STDINT_H -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_RTREE \ sqlite3.c -echo '********** No optimizations. ENABLE_STAT2. THREADSAFE=0 *******' +echo '********** No optimizations. ENABLE_STAT3. THREADSAFE=0 *******' gcc -c -Wshadow -Wall -Wextra -pedantic-errors -Wno-long-long -std=c89 \ - -ansi -DSQLITE_ENABLE_STAT2 -DSQLITE_THREADSAFE=0 \ + -ansi -DSQLITE_ENABLE_STAT3 -DSQLITE_THREADSAFE=0 \ sqlite3.c echo '********** Optimized -O3. Includes FTS4 and RTREE ************' gcc -O3 -c -Wshadow -Wall -Wextra -pedantic-errors -Wno-long-long -std=c89 \