Pelle's C version 4.00.13, IDE 4.00.50 on both XP and W98.
I've been using Timo's SQLite ppj files to build the SQLite library, dll and exe and am suddenly getting a couple of warnings that I am sure I never got before, for example,
build.c(345): warning #2115: Local 'pOld' is initialized but never used.
Line 345 is the second line in the snippet below
static void sqliteDeleteIndex(sqlite3 *db, Index *p){
Index *pOld;
assert( db!=0 && p->zName!=0 );
pOld = sqlite3HashInsert(&db->aDb[p->iDb].idxHash, p->zName,
strlen(p->zName)+1, 0);
assert( pOld==0 || pOld==p );
freeIndex(p);
}
another is
expr.c(1082): warning #2115: Local 'pSrcList' is initialized but never used.
Line 1082 is the third line in the snippet below
static int nameResolverStep(void *pArg, Expr *pExpr){
NameContext *pNC = (NameContext*)pArg;
SrcList *pSrcList;
Parse *pParse;
if( pExpr==0 ) return 1;
assert( pNC!=0 );
pSrcList = pNC->pSrcList;
pParse = pNC->pParse;
if( ExprHasAnyProperty(pExpr, EP_Resolved) ) return 1;
ExprSetProperty(pExpr, EP_Resolved);
#ifndef NDEBUG
if( pSrcList && pSrcList->nAlloc>0 ){
int i;
for(i=0; i<pSrcList->nSrc; i++){
assert( pSrcList->a[i].iCursor>=0 && pSrcList->a[i].iCursor<pParse->nTab);
}
}
#endif
I did a reinstall of the compiler but am still having the problem. Any ideas what the problem may be ?
Robert Wishlaw
The error still persist if you define NDEBUG?
Maybe the code where you use the variables is conditionally not compiled.
I think it's the other way around:
If NDEBUG is defined, assert() will no nothing - so in the first snippet, pOld will be assigned a value, but the value is never used - hence the warning...
Basically same problem with second snippet, but the NDEBUG test is spelled out...
In other words: you must have NDEBUG defined now - but not before (when it "worked")...
Pelle
It is the -Ot, -Os etc., optimizing flag that triggers the production of the warnings. If optimization is turned OFF the warnings do not occur. NDEBUG has no effect on the triggering of the warnings.
Robert Wishlaw
Well, OK - the warning will only be issued when optimizations are on (but NDEBUG will also affect things).
Anyway, it's still not a bug...
Pelle
Thank you Pelle and Frankie. I should have posted this under Beginners Questions.
Robert Wishlaw