aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2013-10-11 15:05:05 +0000
committerdrh <drh@noemail.net>2013-10-11 15:05:05 +0000
commit4f991890510bbc30a83f1ef1f70c080a09b45b1a (patch)
tree9947a71c65e7b1bf1b83b713345754e246ed50ef /src
parent80e0b72e8def34ee3b807e4b2e89519a3e590519 (diff)
downloadsqlite-4f991890510bbc30a83f1ef1f70c080a09b45b1a.tar.gz
sqlite-4f991890510bbc30a83f1ef1f70c080a09b45b1a.zip
Fix various harmless compiler warnings. Change the "warnings.sh" script to
work with STAT4 instead of STAT3. FossilOrigin-Name: 7df06684ab36bfdad9e9aca6940b7a665c2a0cb5
Diffstat (limited to 'src')
-rw-r--r--src/analyze.c14
-rw-r--r--src/build.c2
-rw-r--r--src/vdbemem.c5
-rw-r--r--src/where.c17
4 files changed, 28 insertions, 10 deletions
diff --git a/src/analyze.c b/src/analyze.c
index c83133a4d..98687f5ac 100644
--- a/src/analyze.c
+++ b/src/analyze.c
@@ -589,6 +589,11 @@ static void samplePushPrevious(Stat4Accum *p, int iChng){
}
}
#endif
+
+#ifndef SQLITE_ENABLE_STAT3_OR_STAT4
+ UNUSED_PARAMETER( p );
+ UNUSED_PARAMETER( iChng );
+#endif
}
/*
@@ -614,6 +619,8 @@ static void statPush(
Stat4Accum *p = (Stat4Accum*)sqlite3_value_blob(argv[0]);
int iChng = sqlite3_value_int(argv[1]);
+ UNUSED_PARAMETER( argc );
+ UNUSED_PARAMETER( context );
assert( p->nCol>1 ); /* Includes rowid field */
assert( iChng<p->nCol );
@@ -799,6 +806,9 @@ static void statGet(
}
}
#endif /* SQLITE_ENABLE_STAT3_OR_STAT4 */
+#ifndef SQLITE_DEBUG
+ UNUSED_PARAMETER( argc );
+#endif
}
static const FuncDef statGetFuncdef = {
1+IsStat34, /* nArg */
@@ -817,8 +827,10 @@ static void callStatGet(Vdbe *v, int regStat4, int iParam, int regOut){
assert( regOut!=regStat4 && regOut!=regStat4+1 );
#ifdef SQLITE_ENABLE_STAT3_OR_STAT4
sqlite3VdbeAddOp2(v, OP_Integer, iParam, regStat4+1);
-#else
+#elif SQLITE_DEBUG
assert( iParam==STAT_GET_STAT1 );
+#else
+ UNUSED_PARAMETER( iParam );
#endif
sqlite3VdbeAddOp3(v, OP_Function, 0, regStat4, regOut);
sqlite3VdbeChangeP4(v, -1, (char*)&statGetFuncdef, P4_FUNCDEF);
diff --git a/src/build.c b/src/build.c
index e14988ae1..6868e60e0 100644
--- a/src/build.c
+++ b/src/build.c
@@ -1113,7 +1113,7 @@ char sqlite3AffinityType(const char *zIn, u8 *pszEst){
if( zChar ){
while( zChar[0] ){
if( sqlite3Isdigit(zChar[0]) ){
- int v;
+ int v = 0;
sqlite3GetInt32(zChar, &v);
v = v/4 + 1;
if( v>255 ) v = 255;
diff --git a/src/vdbemem.c b/src/vdbemem.c
index 95a879871..91193bf2c 100644
--- a/src/vdbemem.c
+++ b/src/vdbemem.c
@@ -1059,7 +1059,9 @@ static sqlite3_value *valueNew(sqlite3 *db, struct ValueNewStat4Ctx *p){
pRec->nField = p->iVal+1;
return &pRec->aMem[p->iVal];
}
-#endif
+#else
+ UNUSED_PARAMETER(p);
+#endif /* defined(SQLITE_ENABLE_STAT3_OR_STAT4) */
return sqlite3ValueNew(db);
}
@@ -1230,6 +1232,7 @@ static void recordFunc(
sqlite3 *db;
u8 *aRet;
+ UNUSED_PARAMETER( argc );
iSerial = sqlite3VdbeSerialType(argv[0], file_format);
nSerial = sqlite3VarintLen(iSerial);
nVal = sqlite3VdbeSerialTypeLen(iSerial);
diff --git a/src/where.c b/src/where.c
index 545dee2d2..d89ce6513 100644
--- a/src/where.c
+++ b/src/where.c
@@ -2337,6 +2337,9 @@ static void whereKeyStats(
int iTest; /* Next sample to test */
int res; /* Result of comparison operation */
+#ifndef SQLITE_DEBUG
+ UNUSED_PARAMETER( pParse );
+#endif
assert( pRec!=0 || pParse->db->mallocFailed );
if( pRec==0 ) return;
iCol = pRec->nField - 1;
@@ -2454,11 +2457,11 @@ static int whereRangeScanEst(
){
int rc = SQLITE_OK;
int nOut = pLoop->nOut;
- int nEq = pLoop->u.btree.nEq;
LogEst nNew;
#ifdef SQLITE_ENABLE_STAT3_OR_STAT4
Index *p = pLoop->u.btree.pIndex;
+ int nEq = pLoop->u.btree.nEq;
if( p->nSample>0
&& nEq==pBuilder->nRecValid
@@ -4182,7 +4185,7 @@ whereLoopInsert_noop:
** the number of output rows by a factor of 10 and each additional term
** reduces the number of output rows by sqrt(2).
*/
-static void whereLoopOutputAdjust(WhereClause *pWC, WhereLoop *pLoop, int iCur){
+static void whereLoopOutputAdjust(WhereClause *pWC, WhereLoop *pLoop){
WhereTerm *pTerm, *pX;
Bitmask notAllowed = ~(pLoop->prereq|pLoop->maskSelf);
int i, j;
@@ -4357,8 +4360,8 @@ static int whereLoopAddBtreeIndex(
}
assert( nOut==0 || rc==SQLITE_OK );
if( nOut ){
- nOut = sqlite3LogEst(nOut);
- pNew->nOut = MIN(nOut, saved_nOut);
+ pNew->nOut = sqlite3LogEst(nOut);
+ if( pNew->nOut>saved_nOut ) pNew->nOut = saved_nOut;
}
}
#endif
@@ -4369,7 +4372,7 @@ static int whereLoopAddBtreeIndex(
}
/* Step cost for each output row */
pNew->rRun = sqlite3LogEstAdd(pNew->rRun, pNew->nOut);
- whereLoopOutputAdjust(pBuilder->pWC, pNew, pSrc->iCursor);
+ whereLoopOutputAdjust(pBuilder->pWC, pNew);
rc = whereLoopInsert(pBuilder, pNew);
if( (pNew->wsFlags & WHERE_TOP_LIMIT)==0
&& pNew->u.btree.nEq<(pProbe->nColumn + (pProbe->zName!=0))
@@ -4573,7 +4576,7 @@ static int whereLoopAddBtree(
** + The extra 3 factor is to encourage the use of indexed lookups
** over full scans. FIXME */
pNew->rRun = sqlite3LogEstAdd(rSize,rLogSize) + 16;
- whereLoopOutputAdjust(pWC, pNew, pSrc->iCursor);
+ whereLoopOutputAdjust(pWC, pNew);
rc = whereLoopInsert(pBuilder, pNew);
pNew->nOut = rSize;
if( rc ) break;
@@ -4606,7 +4609,7 @@ static int whereLoopAddBtree(
** which we will simplify to just N*log2(N) */
pNew->rRun = rSize + rLogSize;
}
- whereLoopOutputAdjust(pWC, pNew, pSrc->iCursor);
+ whereLoopOutputAdjust(pWC, pNew);
rc = whereLoopInsert(pBuilder, pNew);
pNew->nOut = rSize;
if( rc ) break;