From c05a9a8a575aef38931caee1b763a09e926bc54a Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 4 Mar 2010 16:12:34 +0000 Subject: [PATCH] Suppress harmless compiler warnings. FossilOrigin-Name: fc2c63ac78ba7d48fe3232f88093e980ea34eaa9 --- manifest | 20 ++++++++++---------- manifest.uuid | 2 +- src/os_unix.c | 8 ++++---- src/sqliteInt.h | 43 ++++++++++++++++++++----------------------- 4 files changed, 35 insertions(+), 38 deletions(-) diff --git a/manifest b/manifest index 6e64b07d64..6d6843a3fa 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -C Increase\sthe\smaximum\slength\sof\san\ssqlite3_log()\sresult\sstring.\s\sProvide\smore\ndetails\son\sthe\sstatement\sabort\slog\smessage. -D 2010-03-04T00:53:33 +C Suppress\sharmless\scompiler\swarnings. +D 2010-03-04T16:12:34 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 4f2f967b7e58a35bb74fb7ec8ae90e0f4ca7868b F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -153,7 +153,7 @@ F src/os.c 8bc63cf91e9802e2b807198e54e50227fa889306 F src/os.h 534b082c3cb349ad05fa6fa0b06087e022af282c F src/os_common.h 240c88b163b02c21a9f21f87d49678a0aa21ff30 F src/os_os2.c 75a8c7b9a00a2cf1a65f9fa4afbc27d46634bb2f -F src/os_unix.c 97c2d5dd1015c35aabef8f18399c28bb9bcb7664 +F src/os_unix.c 284398041b13abf5a2785a53e9cf5a8923011e3d F src/os_win.c 1c7453c2df4dab26d90ff6f91272aea18bcf7053 F src/pager.c ace73a84f53a551fb8b9334205af210a29874b2c F src/pager.h 1b32faf2e578ac3e7bcf9c9d11217128261c5c54 @@ -171,7 +171,7 @@ F src/select.c 4113ef360430ed4e7533690ef46d06c20204adce F src/shell.c c40427c7245535a04a9cb4a417b6cc05c022e6a4 F src/sqlite.h.in 08a2d9a278ff0dfd65055a7ec9c599f7ae1a3c18 F src/sqlite3ext.h 69dfb8116af51b84a029cddb3b35062354270c89 -F src/sqliteInt.h 32e6eb47d2f6fad587e16b0abbbfe3f7d55f2ec0 +F src/sqliteInt.h dd123c74d150078c5afc572a6bc76e0920cd9c9c F src/sqliteLimit.h 3afab2291762b5d09ae20c18feb8e9fa935a60a6 F src/status.c d329385a2cba3ea49d9d68af0ad84b22d46b4f40 F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e @@ -795,14 +795,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 84d760bfc1d219fda99901061bb5db2cafe9eb1d -R 952c1e46748606994709a17ed2dc102e +P 5322d1df5ba981001d248b7fb2ee02281e4f9723 +R 8518eb4aa88e157fd575727ed4a44d56 U drh -Z 6ab237967302805fc460ab0eaddd0a85 +Z b40a37769134e1c148f3f0d5e007c480 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) -iD8DBQFLjwSQoxKgR168RlERAg4GAJ99wdO6zHQ+BQheTEebbxyfPgVwrwCfYERl -d/IAf2HBq2gWIzTZvGEQx8Q= -=kHv9 +iD8DBQFLj9v2oxKgR168RlERAlDTAJ96DQjq56uSJZBAaoHGSC19cEzB6QCfe07F +8QzCK3CiczCBfiQDcZd+HXw= +=HTRs -----END PGP SIGNATURE----- diff --git a/manifest.uuid b/manifest.uuid index ce171752a3..4e01b5d01d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5322d1df5ba981001d248b7fb2ee02281e4f9723 \ No newline at end of file +fc2c63ac78ba7d48fe3232f88093e980ea34eaa9 \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index 88263df664..0ff6965642 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -1557,7 +1557,7 @@ static int _posixUnlock(sqlite3_file *id, int locktype, int handleNFSUnlock){ lock.l_start = SHARED_FIRST; lock.l_len = divSize; if( fcntl(h, F_SETLK, &lock)==(-1) ){ - int tErrno = errno; + tErrno = errno; rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_UNLOCK); if( IS_LOCK_ERROR(rc) ){ pFile->lastErrno = tErrno; @@ -1569,7 +1569,7 @@ static int _posixUnlock(sqlite3_file *id, int locktype, int handleNFSUnlock){ lock.l_start = SHARED_FIRST; lock.l_len = divSize; if( fcntl(h, F_SETLK, &lock)==(-1) ){ - int tErrno = errno; + tErrno = errno; rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_RDLOCK); if( IS_LOCK_ERROR(rc) ){ pFile->lastErrno = tErrno; @@ -1581,7 +1581,7 @@ static int _posixUnlock(sqlite3_file *id, int locktype, int handleNFSUnlock){ lock.l_start = SHARED_FIRST+divSize; lock.l_len = SHARED_SIZE-divSize; if( fcntl(h, F_SETLK, &lock)==(-1) ){ - int tErrno = errno; + tErrno = errno; rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_UNLOCK); if( IS_LOCK_ERROR(rc) ){ pFile->lastErrno = tErrno; @@ -1594,7 +1594,7 @@ static int _posixUnlock(sqlite3_file *id, int locktype, int handleNFSUnlock){ lock.l_start = SHARED_FIRST; lock.l_len = SHARED_SIZE; if( fcntl(h, F_SETLK, &lock)==(-1) ){ - int tErrno = errno; + tErrno = errno; rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_RDLOCK); if( IS_LOCK_ERROR(rc) ){ pFile->lastErrno = tErrno; diff --git a/src/sqliteInt.h b/src/sqliteInt.h index c14c3c4cb0..86e869663c 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -84,38 +84,35 @@ #define SQLITE_INDEX_SAMPLES 10 /* -** This macro is used to "hide" some ugliness in casting an int -** value to a ptr value under the MSVC 64-bit compiler. Casting -** non 64-bit values to ptr types results in a "hard" error with -** the MSVC 64-bit compiler which this attempts to avoid. +** The following macros are used to cast pointers to integers and +** integers to pointers. The way you do this varies from one compiler +** to the next, so we have developed the following set of #if statements +** to generate appropriate macros for a wide range of compilers. ** -** A simple compiler pragma or casting sequence could not be found -** to correct this in all situations, so this macro was introduced. -** -** It could be argued that the intptr_t type could be used in this -** case, but that type is not available on all compilers, or -** requires the #include of specific headers which differs between -** platforms. +** The correct "ANSI" way to do this is to use the intptr_t type. +** Unfortunately, that typedef is not available on all compilers, or +** if it is available, it requires an #include of specific headers +** that very from one machine to the next. ** ** Ticket #3860: The llvm-gcc-4.2 compiler from Apple chokes on ** the ((void*)&((char*)0)[X]) construct. But MSVC chokes on ((void*)(X)). ** So we have to define the macros in different ways depending on the ** compiler. */ -#if defined(__GNUC__) -# if defined(HAVE_STDINT_H) -# define SQLITE_INT_TO_PTR(X) ((void*)(intptr_t)(X)) -# define SQLITE_PTR_TO_INT(X) ((int)(intptr_t)(X)) -# else -# define SQLITE_INT_TO_PTR(X) ((void*)(X)) -# define SQLITE_PTR_TO_INT(X) ((int)(X)) -# endif -#else -# define SQLITE_INT_TO_PTR(X) ((void*)&((char*)0)[X]) -# define SQLITE_PTR_TO_INT(X) ((int)(((char*)X)-(char*)0)) +#if defined(__PTRDIFF_TYPE__) /* This case should work for GCC */ +# define SQLITE_INT_TO_PTR(X) ((void*)(__PTRDIFF_TYPE__)(X)) +# define SQLITE_PTR_TO_INT(X) ((int)(__PTRDIFF_TYPE__)(X)) +#elif !defined(__GNUC__) /* Works for compilers other than LLVM */ +# define SQLITE_INT_TO_PTR(X) ((void*)&((char*)0)[X]) +# define SQLITE_PTR_TO_INT(X) ((int)(((char*)X)-(char*)0)) +#elif defined(HAVE_STDINT_H) /* Use this case if we have ANSI headers */ +# define SQLITE_INT_TO_PTR(X) ((void*)(intptr_t)(X)) +# define SQLITE_PTR_TO_INT(X) ((int)(intptr_t)(X)) +#else /* Generates a warning - but it always works */ +# define SQLITE_INT_TO_PTR(X) ((void*)(X)) +# define SQLITE_PTR_TO_INT(X) ((int)(X)) #endif - /* ** The SQLITE_THREADSAFE macro must be defined as either 0 or 1. ** Older versions of SQLite used an optional THREADSAFE macro. -- 2.47.2