]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Remove the CLANG_VERSION macro, since we have learned that version numbers in
authordrh <drh@noemail.net>
Wed, 15 Feb 2017 15:11:05 +0000 (15:11 +0000)
committerdrh <drh@noemail.net>
Wed, 15 Feb 2017 15:11:05 +0000 (15:11 +0000)
clang are "marketing" and are inconsistent and unreliable.  Builds using clang
will still use the GCC_VERSION macro since clang works hard to be gcc
compatible.

FossilOrigin-Name: 8d3f485d86b2f2d87a5c622acf95a5d15c4b371a

ext/rtree/rtree.c
manifest
manifest.uuid
src/sqliteInt.h
src/util.c

index 205939ddc6bf648946e23f6cdc4ef000fff8587a..63838a4eef8546ee996cc218b922470f32011c12 100644 (file)
@@ -368,7 +368,11 @@ struct RtreeMatchArg {
 # define MIN(x,y) ((x) > (y) ? (y) : (x))
 #endif
 
-/* What version of GCC is being used.  0 means GCC is not being used */
+/* What version of GCC is being used.  0 means GCC is not being used .
+** Note that the GCC_VERSION macro will also be set correctly when using
+** clang, since clang works hard to be gcc compatible.  So the gcc
+** optimizations will also work when compiling with clang.
+*/
 #ifndef GCC_VERSION
 #if defined(__GNUC__) && !defined(SQLITE_DISABLE_INTRINSIC)
 # define GCC_VERSION (__GNUC__*1000000+__GNUC_MINOR__*1000+__GNUC_PATCHLEVEL__)
@@ -377,16 +381,6 @@ struct RtreeMatchArg {
 #endif
 #endif
 
-/* What version of CLANG is being used.  0 means CLANG is not being used */
-#ifndef CLANG_VERSION
-#if defined(__clang__) && !defined(_WIN32) && !defined(SQLITE_DISABLE_INTRINSIC)
-# define CLANG_VERSION \
-            (__clang_major__*1000000+__clang_minor__*1000+__clang_patchlevel__)
-#else
-# define CLANG_VERSION 0
-#endif
-#endif
-
 /* The testcase() macro should already be defined in the amalgamation.  If
 ** it is not, make it a no-op.
 */
@@ -437,7 +431,7 @@ static void readCoord(u8 *p, RtreeCoord *pCoord){
   assert( ((((char*)p) - (char*)0)&3)==0 );  /* p is always 4-byte aligned */
 #if SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
   pCoord->u = _byteswap_ulong(*(u32*)p);
-#elif SQLITE_BYTEORDER==1234 && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
+#elif SQLITE_BYTEORDER==1234 && GCC_VERSION>=4003000
   pCoord->u = __builtin_bswap32(*(u32*)p);
 #elif SQLITE_BYTEORDER==4321
   pCoord->u = *(u32*)p;
@@ -455,7 +449,7 @@ static i64 readInt64(u8 *p){
   u64 x;
   memcpy(&x, p, 8);
   return (i64)_byteswap_uint64(x);
-#elif SQLITE_BYTEORDER==1234 && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
+#elif SQLITE_BYTEORDER==1234 && GCC_VERSION>=4003000
   u64 x;
   memcpy(&x, p, 8);
   return (i64)__builtin_bswap64(x);
@@ -491,7 +485,7 @@ static int writeCoord(u8 *p, RtreeCoord *pCoord){
   assert( ((((char*)p) - (char*)0)&3)==0 );  /* p is always 4-byte aligned */
   assert( sizeof(RtreeCoord)==4 );
   assert( sizeof(u32)==4 );
-#if SQLITE_BYTEORDER==1234 && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
+#if SQLITE_BYTEORDER==1234 && GCC_VERSION>=4003000
   i = __builtin_bswap32(pCoord->u);
   memcpy(p, &i, 4);
 #elif SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
@@ -510,7 +504,7 @@ static int writeCoord(u8 *p, RtreeCoord *pCoord){
   return 4;
 }
 static int writeInt64(u8 *p, i64 i){
-#if SQLITE_BYTEORDER==1234 && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
+#if SQLITE_BYTEORDER==1234 && GCC_VERSION>=4003000
   i = (i64)__builtin_bswap64((u64)i);
   memcpy(p, &i, 8);
 #elif SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
@@ -1066,7 +1060,7 @@ static int rtreeEof(sqlite3_vtab_cursor *cur){
     c.u = _byteswap_ulong(*(u32*)a);                            \
     r = eInt ? (sqlite3_rtree_dbl)c.i : (sqlite3_rtree_dbl)c.f; \
 }
-#elif SQLITE_BYTEORDER==1234 && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
+#elif SQLITE_BYTEORDER==1234 && GCC_VERSION>=4003000
 #define RTREE_DECODE_COORD(eInt, a, r) {                        \
     RtreeCoord c;    /* Coordinate decoded */                   \
     c.u = __builtin_bswap32(*(u32*)a);                          \
index 2e7a8d98dc346dd55d88a02934661430988ac5e9..cf5ca7ebd3f0c13c96e52a5f5fb44a815d443f4b 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Version\s3.17.0
-D 2017-02-13T16:02:40.361
+C Remove\sthe\sCLANG_VERSION\smacro,\ssince\swe\shave\slearned\sthat\sversion\snumbers\sin\nclang\sare\s"marketing"\sand\sare\sinconsistent\sand\sunreliable.\s\sBuilds\susing\sclang\nwill\sstill\suse\sthe\sGCC_VERSION\smacro\ssince\sclang\sworks\shard\sto\sbe\sgcc\ncompatible.
+D 2017-02-15T15:11:05.423
 F Makefile.in edb6bcdd37748d2b1c3422ff727c748df7ffe918
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc 067a6766f800cc8d72845ab61f8de4ffe8f3fc99
@@ -264,7 +264,7 @@ F ext/rbu/sqlite3rbu.c bb0de6cdbdb14a7d55a097238a434b7e99caf318
 F ext/rbu/sqlite3rbu.h 6fb6294c34a9ca93b5894a33bca530c6f08decba
 F ext/rbu/test_rbu.c 5aa22616afac6f71ebd3d9bc9bf1006cfabcca88
 F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
-F ext/rtree/rtree.c 358796a385de74e40ed66c103df77ba3c2e98fab
+F ext/rtree/rtree.c 3f3a595dba485e340246fa2c8ba330a6b9768b00
 F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e
 F ext/rtree/rtree1.test 42dadfc7b44a436cd74a1bebc0b9b689e4eaf7ec
 F ext/rtree/rtree2.test acbb3a4ce0f4fbc2c304d2b4b784cfa161856bba
@@ -399,7 +399,7 @@ F src/shell.c a84e453c213f3e0d6935a582024da4e242f85a19
 F src/sqlite.h.in 751ff125eb159c8f92c182b8df980a5e4f50e966
 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
 F src/sqlite3ext.h 8648034aa702469afb553231677306cc6492a1ae
-F src/sqliteInt.h 4dc66ec1948765f151899333f7a55267d807d099
+F src/sqliteInt.h 2e3a663814058181048c3c7204ebc325affd8738
 F src/sqliteLimit.h c0373387c287c8d0932510b5547ecde31b5da247
 F src/status.c a9e66593dfb28a9e746cba7153f84d49c1ddc4b1
 F src/table.c b46ad567748f24a326d9de40e5b9659f96ffff34
@@ -459,7 +459,7 @@ F src/treeview.c 4e44ade3bfe59d82005039f72e09333ce2b4162c
 F src/trigger.c c9f0810043b265724fdb1bdd466894f984dfc182
 F src/update.c 456d4a4656f8a03c2abc88a51b19172197400e58
 F src/utf.c 699001c79f28e48e9bcdf8a463da029ea660540c
-F src/util.c 3d2ce209a89b95cf35bffa16440f57368576e2ee
+F src/util.c ca8440ede81e155d15cff7c101654f60b55a9ae6
 F src/vacuum.c 33c174b28886b2faf26e503b5a49a1c01a9b1c16
 F src/vdbe.c e7b1e860140f1d1803c6f4176b1e8f3801f3a290
 F src/vdbe.h 59998ffd71d7caa8886bc78dafaf8caeccd4c13c
@@ -1555,10 +1555,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 25ebadd096ce98fd0f9fab809969d34b958794f6
-R 26d6be3bef13897430f30b09b94a6365
-T +bgcolor * #d0c0ff
-T +sym-release *
-T +sym-version-3.17.0 *
+P ada05cfa86ad7f5645450ac7a2a21c9aa6e57d2c
+Q +810d29320b853b3a01aa50d8f2a0bceacf79e0aa
+R 9daa2aaf287837264843b6d62b7e5aa5
 U drh
-Z 05d3704e9807a2fa92650f94b28a08f4
+Z 59bf4fbf4662683e6ba954acbe1164fa
index ef33d31047b8fea0dc82e72866dd3cdde03d2610..b7d07c033319793b1c954c2e8f2c31bf45ec1c01 100644 (file)
@@ -1 +1 @@
-ada05cfa86ad7f5645450ac7a2a21c9aa6e57d2c
\ No newline at end of file
+8d3f485d86b2f2d87a5c622acf95a5d15c4b371a
\ No newline at end of file
index f9768895ae98760c914d6b2850d602b7e6ada7f6..db7faf1445e1d5aa8c54ec84ab44ea37253312da 100644 (file)
 # define _LARGEFILE_SOURCE 1
 #endif
 
-/* The GCC_VERSION, CLANG_VERSION, and MSVC_VERSION macros are used to
+/* The GCC_VERSION and MSVC_VERSION macros are used to
 ** conditionally include optimizations for each of these compilers.  A
 ** value of 0 means that compiler is not being used.  The
 ** SQLITE_DISABLE_INTRINSIC macro means do not use any compiler-specific
 ** optimizations, and hence set all compiler macros to 0
+**
+** There was once also a CLANG_VERSION macro.  However, we learn that the
+** version numbers in clang are for "marketing" only and are inconsistent
+** and unreliable.  Fortunately, all versions of clang also recognize the
+** gcc version numbers and have reasonable settings for gcc version numbers,
+** so the GCC_VERSION macro will be set to a correct non-zero value even
+** when compiling with clang.
 */
 #if defined(__GNUC__) && !defined(SQLITE_DISABLE_INTRINSIC)
 # define GCC_VERSION (__GNUC__*1000000+__GNUC_MINOR__*1000+__GNUC_PATCHLEVEL__)
 #else
 # define GCC_VERSION 0
 #endif
-#if defined(__clang__) && !defined(_WIN32) && !defined(SQLITE_DISABLE_INTRINSIC)
-# define CLANG_VERSION \
-            (__clang_major__*1000000+__clang_minor__*1000+__clang_patchlevel__)
-#else
-# define CLANG_VERSION 0
-#endif
 #if defined(_MSC_VER) && !defined(SQLITE_DISABLE_INTRINSIC)
 # define MSVC_VERSION _MSC_VER
 #else
index c6d2bae3a7b4e3440a551bb78fd71cb8aef693d5..9b6f4f9e1df8a5363cc2fca3e61966592dca77b1 100644 (file)
@@ -1140,7 +1140,7 @@ u32 sqlite3Get4byte(const u8 *p){
   u32 x;
   memcpy(&x,p,4);
   return x;
-#elif SQLITE_BYTEORDER==1234 && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
+#elif SQLITE_BYTEORDER==1234 && GCC_VERSION>=4003000
   u32 x;
   memcpy(&x,p,4);
   return __builtin_bswap32(x);
@@ -1156,7 +1156,7 @@ u32 sqlite3Get4byte(const u8 *p){
 void sqlite3Put4byte(unsigned char *p, u32 v){
 #if SQLITE_BYTEORDER==4321
   memcpy(p,&v,4);
-#elif SQLITE_BYTEORDER==1234 && (GCC_VERSION>=4003000 || CLANG_VERSION>=3000000)
+#elif SQLITE_BYTEORDER==1234 && GCC_VERSION>=4003000
   u32 x = __builtin_bswap32(v);
   memcpy(p,&x,4);
 #elif SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
@@ -1275,7 +1275,7 @@ int sqlite3SafetyCheckSickOrOk(sqlite3 *db){
 ** overflow, leave *pA unchanged and return 1.
 */
 int sqlite3AddInt64(i64 *pA, i64 iB){
-#if GCC_VERSION>=5004000 || CLANG_VERSION>=4000000
+#if GCC_VERSION>=5004000
   return __builtin_add_overflow(*pA, iB, pA);
 #else
   i64 iA = *pA;
@@ -1295,7 +1295,7 @@ int sqlite3AddInt64(i64 *pA, i64 iB){
 #endif
 }
 int sqlite3SubInt64(i64 *pA, i64 iB){
-#if GCC_VERSION>=5004000 || CLANG_VERSION>=4000000
+#if GCC_VERSION>=5004000
   return __builtin_sub_overflow(*pA, iB, pA);
 #else
   testcase( iB==SMALLEST_INT64+1 );
@@ -1310,7 +1310,7 @@ int sqlite3SubInt64(i64 *pA, i64 iB){
 #endif
 }
 int sqlite3MulInt64(i64 *pA, i64 iB){
-#if GCC_VERSION>=5004000 || CLANG_VERSION>=4000000
+#if GCC_VERSION>=5004000
   return __builtin_mul_overflow(*pA, iB, pA);
 #else
   i64 iA = *pA;