aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/analyze.c6
-rw-r--r--src/expr.c5
-rw-r--r--src/func.c9
-rw-r--r--src/mem3.c4
-rw-r--r--src/mem5.c4
-rw-r--r--src/memjournal.c4
-rw-r--r--src/os_unix.c12
-rw-r--r--src/pcache.c4
-rw-r--r--src/pcache.h11
-rw-r--r--src/prepare.c6
-rw-r--r--src/sqliteInt.h31
11 files changed, 66 insertions, 30 deletions
diff --git a/src/analyze.c b/src/analyze.c
index 3d0767694..b7f65dbeb 100644
--- a/src/analyze.c
+++ b/src/analyze.c
@@ -11,7 +11,7 @@
*************************************************************************
** This file contains code associated with the ANALYZE command.
**
-** @(#) $Id: analyze.c,v 1.45 2008/11/19 09:05:27 danielk1977 Exp $
+** @(#) $Id: analyze.c,v 1.46 2008/11/19 16:52:44 danielk1977 Exp $
*/
#ifndef SQLITE_OMIT_ANALYZE
#include "sqliteInt.h"
@@ -363,9 +363,9 @@ static int analysisLoader(void *pData, int argc, char **argv, char **NotUsed){
unsigned int v;
const char *z;
- UNUSED_PARAMETER(NotUsed);
-
assert( argc==2 );
+ UNUSED_PARAMETER2(NotUsed, argc);
+
if( argv==0 || argv[0]==0 || argv[1]==0 ){
return 0;
}
diff --git a/src/expr.c b/src/expr.c
index a7f7ffcc4..c030b385c 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -12,7 +12,7 @@
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
-** $Id: expr.c,v 1.403 2008/11/19 09:05:27 danielk1977 Exp $
+** $Id: expr.c,v 1.404 2008/11/19 16:52:44 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -1460,10 +1460,11 @@ static char *dup8bytes(Vdbe *v, const char *in){
*/
static void codeReal(Vdbe *v, const char *z, int n, int negateFlag, int iMem){
assert( z || v==0 || sqlite3VdbeDb(v)->mallocFailed );
+ assert( !z || !isdigit(z[n]) );
+ UNUSED_PARAMETER(n);
if( z ){
double value;
char *zV;
- assert( !isdigit(z[n]) );
sqlite3AtoF(z, &value);
if( sqlite3IsNaN(value) ){
sqlite3VdbeAddOp2(v, OP_Null, 0, iMem);
diff --git a/src/func.c b/src/func.c
index 57a4b29ee..34a1642f8 100644
--- a/src/func.c
+++ b/src/func.c
@@ -16,7 +16,7 @@
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
** All other code has file scope.
**
-** $Id: func.c,v 1.205 2008/11/19 09:05:27 danielk1977 Exp $
+** $Id: func.c,v 1.206 2008/11/19 16:52:44 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -92,6 +92,7 @@ static void lengthFunc(
int len;
assert( argc==1 );
+ UNUSED_PARAMETER(argc);
switch( sqlite3_value_type(argv[0]) ){
case SQLITE_BLOB:
case SQLITE_INTEGER:
@@ -122,6 +123,7 @@ static void lengthFunc(
*/
static void absFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
assert( argc==1 );
+ UNUSED_PARAMETER(argc);
switch( sqlite3_value_type(argv[0]) ){
case SQLITE_INTEGER: {
i64 iVal = sqlite3_value_int64(argv[0]);
@@ -348,6 +350,7 @@ static void randomBlob(
int n;
unsigned char *p;
assert( argc==1 );
+ UNUSED_PARAMETER(argc);
n = sqlite3_value_int(argv[0]);
if( n<1 ){
n = 1;
@@ -754,6 +757,7 @@ static void hexFunc(
const unsigned char *pBlob;
char *zHex, *z;
assert( argc==1 );
+ UNUSED_PARAMETER(argc);
pBlob = sqlite3_value_blob(argv[0]);
n = sqlite3_value_bytes(argv[0]);
assert( pBlob==sqlite3_value_blob(argv[0]) ); /* No encoding change */
@@ -779,6 +783,7 @@ static void zeroblobFunc(
){
i64 n;
assert( argc==1 );
+ UNUSED_PARAMETER(argc);
n = sqlite3_value_int64(argv[0]);
if( n>SQLITE_MAX_LENGTH ){
sqlite3_result_error_toobig(context);
@@ -810,6 +815,7 @@ static void replaceFunc(
int i, j; /* Loop counters */
assert( argc==3 );
+ UNUSED_PARAMETER(argc);
zStr = sqlite3_value_text(argv[0]);
if( zStr==0 ) return;
nStr = sqlite3_value_bytes(argv[0]);
@@ -1047,6 +1053,7 @@ static void sumStep(sqlite3_context *context, int argc, sqlite3_value **argv){
SumCtx *p;
int type;
assert( argc==1 );
+ UNUSED_PARAMETER(argc);
p = sqlite3_aggregate_context(context, sizeof(*p));
type = sqlite3_value_numeric_type(argv[0]);
if( p && type!=SQLITE_NULL ){
diff --git a/src/mem3.c b/src/mem3.c
index 956d3734f..09a84b673 100644
--- a/src/mem3.c
+++ b/src/mem3.c
@@ -23,7 +23,7 @@
** This version of the memory allocation subsystem is included
** in the build only if SQLITE_ENABLE_MEMSYS3 is defined.
**
-** $Id: mem3.c,v 1.24 2008/11/19 14:35:47 danielk1977 Exp $
+** $Id: mem3.c,v 1.25 2008/11/19 16:52:44 danielk1977 Exp $
*/
#include "sqliteInt.h"
@@ -655,6 +655,8 @@ void sqlite3Memsys3Dump(const char *zFilename){
}else{
fclose(out);
}
+#else
+ UNUSED_PARAMETER(zFilename);
#endif
}
diff --git a/src/mem5.c b/src/mem5.c
index eb95dc177..f9389e9e9 100644
--- a/src/mem5.c
+++ b/src/mem5.c
@@ -23,7 +23,7 @@
** This version of the memory allocation subsystem is included
** in the build only if SQLITE_ENABLE_MEMSYS5 is defined.
**
-** $Id: mem5.c,v 1.18 2008/11/19 14:35:47 danielk1977 Exp $
+** $Id: mem5.c,v 1.19 2008/11/19 16:52:44 danielk1977 Exp $
*/
#include "sqliteInt.h"
@@ -461,6 +461,8 @@ void sqlite3Memsys5Dump(const char *zFilename){
}else{
fclose(out);
}
+#else
+ UNUSED_PARAMETER(zFilename);
#endif
}
diff --git a/src/memjournal.c b/src/memjournal.c
index 5805d2970..9ee6f10f0 100644
--- a/src/memjournal.c
+++ b/src/memjournal.c
@@ -14,7 +14,7 @@
** The in-memory rollback journal is used to journal transactions for
** ":memory:" databases and when the journal_mode=MEMORY pragma is used.
**
-** @(#) $Id: memjournal.c,v 1.4 2008/11/19 09:05:27 danielk1977 Exp $
+** @(#) $Id: memjournal.c,v 1.5 2008/11/19 16:52:44 danielk1977 Exp $
*/
#include "sqliteInt.h"
@@ -123,6 +123,7 @@ static int memjrnlWrite(
** access writes are not required by sqlite.
*/
assert(iOfst==p->endpoint.iOffset);
+ UNUSED_PARAMETER(iOfst);
while( nWrite>0 ){
FileChunk *pChunk = p->endpoint.pChunk;
@@ -162,6 +163,7 @@ static int memjrnlTruncate(sqlite3_file *pJfd, sqlite_int64 size){
MemJournal *p = (MemJournal *)pJfd;
FileChunk *pChunk;
assert(size==0);
+ UNUSED_PARAMETER(size);
pChunk = p->pFirst;
while( pChunk ){
FileChunk *pTmp = pChunk;
diff --git a/src/os_unix.c b/src/os_unix.c
index 867ec96b3..e016fecde 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -12,7 +12,7 @@
**
** This file contains code that is specific to Unix systems.
**
-** $Id: os_unix.c,v 1.215 2008/11/19 14:35:47 danielk1977 Exp $
+** $Id: os_unix.c,v 1.216 2008/11/19 16:52:44 danielk1977 Exp $
*/
#include "sqliteInt.h"
#if SQLITE_OS_UNIX /* This file is used on unix only */
@@ -1201,9 +1201,9 @@ static int full_fsync(int fd, int fullSync, int dataOnly){
UNUSED_PARAMETER(fullSync);
UNUSED_PARAMETER(dataOnly);
#elif HAVE_FULLFSYNC
- UNUSED_PARAMETER(fullSync);
-#else
UNUSED_PARAMETER(dataOnly);
+#else
+ UNUSED_PARAMETER(fullSync);
#endif
/* Record the number of times that we do a normal fsync() and
@@ -2762,8 +2762,9 @@ static int fillInUnixFile(
** used if ENABLE_LOCKING_STYLE is defined. Express this explicitly
** here to prevent compiler warnings about unused parameters.
*/
- if( IS_VXWORKS ) UNUSED_PARAMETER(isDelete);
- if( SQLITE_ENABLE_LOCKING_STYLE ) UNUSED_PARAMETER(pVfs);
+ if( !IS_VXWORKS ) UNUSED_PARAMETER(isDelete);
+ if( !SQLITE_ENABLE_LOCKING_STYLE ) UNUSED_PARAMETER(pVfs);
+ if( !IS_VXWORKS && !SQLITE_ENABLE_LOCKING_STYLE ) UNUSED_PARAMETER(zFilename);
OSTRACE3("OPEN %-3d %s\n", h, zFilename);
pNew->h = h;
@@ -3229,6 +3230,7 @@ static int unixFullPathname(
SimulateIOError( return SQLITE_ERROR );
assert( pVfs->mxPathname==MAX_PATHNAME );
+ UNUSED_PARAMETER(pVfs);
#if IS_VXWORKS
{
diff --git a/src/pcache.c b/src/pcache.c
index 6936b136d..c008f4b60 100644
--- a/src/pcache.c
+++ b/src/pcache.c
@@ -11,7 +11,7 @@
*************************************************************************
** This file implements that page cache.
**
-** @(#) $Id: pcache.c,v 1.37 2008/11/13 14:28:29 danielk1977 Exp $
+** @(#) $Id: pcache.c,v 1.38 2008/11/19 16:52:44 danielk1977 Exp $
*/
#include "sqliteInt.h"
@@ -546,12 +546,14 @@ int sqlite3PcachePagecount(PCache *pCache){
return nPage;
}
+#ifdef SQLITE_TEST
/*
** Get the suggested cache-size value.
*/
int sqlite3PcacheGetCachesize(PCache *pCache){
return pCache->nMax;
}
+#endif
/*
** Set the suggested cache-size value.
diff --git a/src/pcache.h b/src/pcache.h
index 5834196f9..8c44287b3 100644
--- a/src/pcache.h
+++ b/src/pcache.h
@@ -12,7 +12,7 @@
** This header file defines the interface that the sqlite page cache
** subsystem.
**
-** @(#) $Id: pcache.h,v 1.15 2008/11/13 14:28:29 danielk1977 Exp $
+** @(#) $Id: pcache.h,v 1.16 2008/11/19 16:52:44 danielk1977 Exp $
*/
#ifndef _PCACHE_H_
@@ -62,8 +62,6 @@ void sqlite3PcacheShutdown(void);
** These routines implement SQLITE_CONFIG_PAGECACHE.
*/
void sqlite3PCacheBufferSetup(void *, int sz, int n);
-void *sqlite3PCacheMalloc(int sz);
-void sqlite3PCacheFree(void*);
/* Create a new pager cache.
** Under memory stress, invoke xStress to try to make pages clean.
@@ -112,9 +110,6 @@ void sqlite3PcacheClose(PCache*);
/* Clear flags from pages of the page cache */
void sqlite3PcacheClearSyncFlags(PCache *);
-/* Return true if the number of dirty pages is 0 or 1 */
-int sqlite3PcacheZeroOrOneDirtyPages(PCache*);
-
/* Discard the contents of the cache */
int sqlite3PcacheClear(PCache*);
@@ -143,8 +138,10 @@ void sqlite3PcacheIterateDirty(PCache *pCache, void (*xIter)(PgHdr *));
** the total number of pages cached by purgeable pager-caches to the sum
** of the suggested cache-sizes.
*/
-int sqlite3PcacheGetCachesize(PCache *);
void sqlite3PcacheSetCachesize(PCache *, int);
+#ifdef SQLITE_TEST
+int sqlite3PcacheGetCachesize(PCache *);
+#endif
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
/* Try to return memory used by the pcache module to the main memory heap */
diff --git a/src/prepare.c b/src/prepare.c
index 131efa877..cfbd5e0fe 100644
--- a/src/prepare.c
+++ b/src/prepare.c
@@ -13,7 +13,7 @@
** interface, and routines that contribute to loading the database schema
** from disk.
**
-** $Id: prepare.c,v 1.100 2008/11/19 09:05:27 danielk1977 Exp $
+** $Id: prepare.c,v 1.101 2008/11/19 16:52:44 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -57,7 +57,8 @@ int sqlite3InitCallback(void *pInit, int argc, char **argv, char **NotUsed){
sqlite3 *db = pData->db;
int iDb = pData->iDb;
- UNUSED_PARAMETER(NotUsed);
+ assert( argc==3 );
+ UNUSED_PARAMETER2(NotUsed, argc);
assert( sqlite3_mutex_held(db->mutex) );
DbClearProperty(db, iDb, DB_Empty);
if( db->mallocFailed ){
@@ -65,7 +66,6 @@ int sqlite3InitCallback(void *pInit, int argc, char **argv, char **NotUsed){
return SQLITE_NOMEM;
}
- assert( argc==3 );
assert( iDb>=0 && iDb<db->nDb );
if( argv==0 ) return 0; /* Might happen if EMPTY_RESULT_CALLBACKS are on */
if( argv[1]==0 ){
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index f1188f1db..8b6a84bad 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -11,7 +11,7 @@
*************************************************************************
** Internal interface definitions for SQLite.
**
-** @(#) $Id: sqliteInt.h,v 1.797 2008/11/19 09:05:27 danielk1977 Exp $
+** @(#) $Id: sqliteInt.h,v 1.798 2008/11/19 16:52:44 danielk1977 Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
@@ -478,8 +478,24 @@ struct BusyHandler {
#define sqlite3GlobalConfig sqlite3Config
#endif
+/*
+** The following macros are used to suppress compiler warnings and to
+** make it clear to human readers when a function parameter is deliberately
+** left unused within the body of a function. This usually happens when
+** a function is called via a function pointer. For example the
+** implementation of an SQL aggregate step callback may not use the
+** parameter indicating the number of arguments passed to the aggregate,
+** if it knows that this is enforced elsewhere.
+**
+** When a function parameter is not used at all within the body of a function,
+** it is generally named "NotUsed" or "NotUsed2" to make things even clearer.
+** However, these macros may also be used to suppress warnings related to
+** parameters that may or may not be used depending on compilation options.
+** For example those parameters only used in assert() statements. In these
+** cases the parameters are named as per the usual conventions.
+*/
#define UNUSED_PARAMETER(x) (void)(x)
-#define UNUSED_PARAMETER2(x,y) (void)(x),(void)(y)
+#define UNUSED_PARAMETER2(x,y) UNUSED_PARAMETER(x),UNUSED_PARAMETER(y)
/*
** Forward references to structures
@@ -2063,11 +2079,17 @@ void sqlite3ScratchFree(void*);
void *sqlite3PageMalloc(int);
void sqlite3PageFree(void*);
void sqlite3MemSetDefault(void);
-const sqlite3_mem_methods *sqlite3MemGetMemsys3(void);
-const sqlite3_mem_methods *sqlite3MemGetMemsys5(void);
void sqlite3BenignMallocHooks(void (*)(void), void (*)(void));
int sqlite3MemoryAlarm(void (*)(void*, sqlite3_int64, int), void*, sqlite3_int64);
+#ifdef SQLITE_ENABLE_MEMSYS3
+const sqlite3_mem_methods *sqlite3MemGetMemsys3(void);
+#endif
+#ifdef SQLITE_ENABLE_MEMSYS5
+const sqlite3_mem_methods *sqlite3MemGetMemsys5(void);
+#endif
+
+
#ifndef SQLITE_MUTEX_OMIT
sqlite3_mutex_methods *sqlite3DefaultMutex(void);
sqlite3_mutex *sqlite3MutexAlloc(int);
@@ -2240,7 +2262,6 @@ FuncDef *sqlite3FindFunction(sqlite3*,const char*,int,int,u8,int);
void sqlite3RegisterBuiltinFunctions(sqlite3*);
void sqlite3RegisterDateTimeFunctions(void);
void sqlite3RegisterGlobalFunctions(void);
-int sqlite3GetBuiltinFunction(const char *, int, FuncDef **);
#ifdef SQLITE_DEBUG
int sqlite3SafetyOn(sqlite3*);
int sqlite3SafetyOff(sqlite3*);