]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Attempt to provide a version of the SQLITE_INT_TO_PTR macro that works
authordrh <drh@noemail.net>
Sat, 16 May 2009 17:38:21 +0000 (17:38 +0000)
committerdrh <drh@noemail.net>
Sat, 16 May 2009 17:38:21 +0000 (17:38 +0000)
on both llvm-gcc-4.2 and MSVC.  Ticket #3860. (CVS 6641)

FossilOrigin-Name: ddee7ff23e9a396cab89d20ff9fc4cf3dfd4561c

manifest
manifest.uuid
src/sqliteInt.h

index bd81ac80f8ab717cfcfaee9f77d7d9da203e1afe..311b3af7fb1b946794270ffbf3f344152ee2c54f 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Re-enable\sfile\slocking\sin\sasync4.test.\s(CVS\s6640)
-D 2009-05-15T14:41:40
+C Attempt\sto\sprovide\sa\sversion\sof\sthe\sSQLITE_INT_TO_PTR\smacro\sthat\sworks\non\sboth\sllvm-gcc-4.2\sand\sMSVC.\s\sTicket\s#3860.\s(CVS\s6641)
+D 2009-05-16T17:38:21
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -162,7 +162,7 @@ F src/select.c 2877098ffabd751c274aa5f993d515484d955896
 F src/shell.c 0a11f831603f17fea20ca97133c0f64e716af4a7
 F src/sqlite.h.in 85c4398938ee2fd1382fee24bbedd5342a2bc2ed
 F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17
-F src/sqliteInt.h d20ac97b4daf97621d641f52ac16e8ff26fb53fd
+F src/sqliteInt.h f45e2a34e91803d1f10406dd73a2327bee894865
 F src/sqliteLimit.h ffe93f5a0c4e7bd13e70cd7bf84cfb5c3465f45d
 F src/status.c 237b193efae0cf6ac3f0817a208de6c6c6ef6d76
 F src/table.c cc86ad3d6ad54df7c63a3e807b5783c90411a08d
@@ -729,7 +729,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P e8ca932d8c7e1753c159041499355724d3e78b35
-R 4039bbedaa716152755b0bba07446db3
-U danielk1977
-Z 79003871abff44e9b110627807ec8d3b
+P f7098187280866a56563c7614513a40becd172e0
+R 7dde16074ccb85e393d78533a8d161b4
+U drh
+Z 8b4c2b5d43c85ad0807aa2ba5ab2e1e1
index 583f1f630ef24f42fb1ce789ec2e7a4288e492b7..4096ff90551dc409301e4540e92a86dea6e72ccc 100644 (file)
@@ -1 +1 @@
-f7098187280866a56563c7614513a40becd172e0
\ No newline at end of file
+ddee7ff23e9a396cab89d20ff9fc4cf3dfd4561c
\ No newline at end of file
index ceba6b073768697a90db2e1c3b4ffc04645b5ffa..db12c58a2ab603347dd40ad309e812e5479400eb 100644 (file)
@@ -11,7 +11,7 @@
 *************************************************************************
 ** Internal interface definitions for SQLite.
 **
-** @(#) $Id: sqliteInt.h,v 1.871 2009/05/13 17:21:14 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.872 2009/05/16 17:38:21 drh Exp $
 */
 #ifndef _SQLITEINT_H_
 #define _SQLITEINT_H_
 #endif
 
 /*
- * 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.  
- *
- * 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.
- */
-#define SQLITE_INT_TO_PTR(X)   ((void*)&((char*)0)[X])
-#define SQLITE_PTR_TO_INT(X)   ((int)(((char*)X)-(char*)0))
+** 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.  
+**
+** 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.
+**
+** Ticket #3860:  The llvm-gcc-4.2 compiler from Apple chokes on
+** the ((void*)&((char*)0)[X]) construct.  But MSVC chokes on ((void*)(X)).
+** We we have to define the macros in different ways depending on the
+** compiler.
+*/
+#if defined(__GNUC__)
+# define SQLITE_INT_TO_PTR(X)  ((void*)(X))
+# define SQLITE_PTR_TO_INT(X)  ((int)(X))
+#else
+# define SQLITE_INT_TO_PTR(X)   ((void*)&((char*)0)[X])
+# define SQLITE_PTR_TO_INT(X)   ((int)(((char*)X)-(char*)0))
+#endif
 
 /*
 ** These #defines should enable >2GB file support on POSIX if the