1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-10 01:02:56 +03:00

Fix some compiler warnings that show up when building the amalgamation only. (CVS 5927)

FossilOrigin-Name: d1abe8a1c9a990b02c71d6c249436381c9fde443
This commit is contained in:
danielk1977
2008-11-19 16:52:44 +00:00
parent a03396aafb
commit f3d3c27a0c
13 changed files with 83 additions and 47 deletions

View File

@@ -1,5 +1,5 @@
C Fix\sa\sfew\smore\scompiler\swarnings.\s(CVS\s5926)
D 2008-11-19T14:35:47
C Fix\ssome\scompiler\swarnings\sthat\sshow\sup\swhen\sbuilding\sthe\samalgamation\sonly.\s(CVS\s5927)
D 2008-11-19T16:52:44
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 0aa7bbe3be6acc4045706e3bb3fd0b8f38f4a3b5
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -95,7 +95,7 @@ F sqlite3.1 6be1ad09113570e1fc8dcaff84c9b0b337db5ffc
F sqlite3.def a1be7b9a4b8b51ac41c6ff6e8e44a14ef66b338b
F sqlite3.pc.in ae6f59a76e862f5c561eb32a380228a02afc3cad
F src/alter.c 0a00c184052b7fd20271e783f65fec4efec6fe30
F src/analyze.c 0c69f21c8063dd0198b65749bf3ee372fa31f85c
F src/analyze.c 301a1358f4f4d84d96608927d8ddcf471c53ad9a
F src/attach.c 85c6a3d0daf11965b47604190d7cf5597dc88382
F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627
F src/bitvec.c 9e922b2577b7e46d8f95349bca6a52f7674d7582
@@ -108,9 +108,9 @@ F src/callback.c e970e5beddbdb23f89a6d05cb1a6419d9f755624
F src/complete.c cb14e06dbe79dee031031f0d9e686ff306afe07c
F src/date.c 88898ae96a0d7f66711caffa40b2cf30e623a387
F src/delete.c 2f85d6d00333343a76824a899e15f241ca383c7c
F src/expr.c fafae5a4590b33c1862a086bf6a1e0b0e1712d94
F src/expr.c 01b1cf0783a6d0093d72b799fcb22c86146362ef
F src/fault.c dc88c821842157460750d2d61a8a8b4197d047ff
F src/func.c bfe4dec1fc90ae9355453caedaa3c71736ed0513
F src/func.c b4570eb73d873041b8e68f5cdbb4556ff13a94c3
F src/global.c 20a3fe46c8287a01ba3a7442558f0eb70c66b19a
F src/hash.c 582c00618efe2051785e66ba1b6430d5a129de3f
F src/hash.h 28f38ebb1006a5beedcb013bcdfe31befe7437ae
@@ -124,9 +124,9 @@ F src/malloc.c 4e7bf5a3fcfd848a09f7ce7abb00f7b358128161
F src/mem0.c f2f84062d1f35814d6535c9f9e33de3bfb3b132c
F src/mem1.c bb8e26adde7d463270e961f045802c61dbabc8f1
F src/mem2.c 5d9968f576ba1babc787adbfb613cf428ab484ec
F src/mem3.c 5644d8eb9a01bc20ee1498d9bbd160a4d4875ef5
F src/mem5.c d0f785214a6a51deb222fb934101df7794d8563a
F src/memjournal.c 9e1f3c19baa566dd3f18f8eab8b70061f2eb5a9f
F src/mem3.c 67153ec933e08b70714055e872efb58a6b287939
F src/mem5.c 838309b521c96a2a34507f74a5a739d28de4aac6
F src/memjournal.c bd536c4d6d701b4fa7428545128c5684d2adf779
F src/mutex.c e9cb5fbe94afb4328869afaf3ac49bd1327559eb
F src/mutex.h 9e686e83a88838dac8b9c51271c651e833060f1e
F src/mutex_noop.c 0004efdbc2fd48d261d5b3416fe537e888c79a54
@@ -137,16 +137,16 @@ F src/os.c 0b411644b87ad689d7250bbfd1834d99b81a3df4
F src/os.h ef8abeb9afc694b82dbd169a91c9b7e26db3c892
F src/os_common.h 24525d8b7bce66c374dfc1810a6c9043f3359b60
F src/os_os2.c d12285d66df674c42f6f544a6f7c21bf1a954ee1
F src/os_unix.c 975cdd3e1bc1de82053db8c0b948db530e778650
F src/os_unix.c 03c76b5269361adcd68cf9d6713181922535ac6e
F src/os_win.c 08d0b059ac01f32e8813bb96fc573486592b83f5
F src/pager.c ae5da38b6415bdd88e56a2a484f29282c4ea09f5
F src/pager.h a02ef8e6cc7e78b54874166e5ce786c9d4c489bf
F src/parse.y 2c4758b4c5ead6de8cf7112f5a7cce7561d313fe
F src/pcache.c 439bcf164f10dd0595cbd63f7472881d46dcbb61
F src/pcache.h b6feb183dea39ede8336bb47c5969403d26fa5c0
F src/pcache.c f3121a531745b20f5b824201eb63949a7e2959ac
F src/pcache.h f20c3e82dd6da622c3fe296170cb1801f9a2d75a
F src/pcache1.c 2453a3e925841fdb610f39bba24def8b2ad4a908
F src/pragma.c 0a5051029c5b687e2f2669d91aa3281ebcbe4fdb
F src/prepare.c 72c8dc897f89ab6bd8354c7a7898a0347abe2291
F src/prepare.c fcadb25d2ad722d87103517333c825b56b79a770
F src/printf.c 5fe6ba48f897caacc8125e3d16c6bbae6b282214
F src/random.c a87afbd598aa877e23ac676ee92fd8ee5c786a51
F src/resolve.c 4af5391d2b4c1d6c583a6805ac6660181de4545b
@@ -154,7 +154,7 @@ F src/select.c e01537d4d8b8b81a6507e07ebb17fc232dacdda7
F src/shell.c 650d1a87408682280d0e9d014d0d328c59c84b38
F src/sqlite.h.in e9a0aa2502dfe01bf166956051528f28871474c3
F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17
F src/sqliteInt.h 21aaa8e2b53735eb2ed8a1a3d3e3246b9a446433
F src/sqliteInt.h beacd5768e55285097fbb419bcd741721b455003
F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8
F src/status.c 237b193efae0cf6ac3f0817a208de6c6c6ef6d76
F src/table.c 22744786199c9195720c15a7a42cb97b2e2728d8
@@ -659,7 +659,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
P 92c91a6cd7bcbe79206bdf7708fe9049a7b7fdd6
R becaca1ce8e489233fe07373da291409
P 70b2f6839ca97dfc08f72875283f5c75c8fcf0cc
R a6290aee52476a40993da5bd0918f0b1
U danielk1977
Z 28a506bcb2c5bad1b973ed3ce4c1ed0f
Z dc69f77ff700b57401f380f9e520f0dd

View File

@@ -1 +1 @@
70b2f6839ca97dfc08f72875283f5c75c8fcf0cc
d1abe8a1c9a990b02c71d6c249436381c9fde443

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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 ){

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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;

View File

@@ -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
{

View File

@@ -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.

View File

@@ -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 */

View File

@@ -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 ){

View File

@@ -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*);