/ Check-in [f0075d73]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add SQLITE_DISABLE_INTRINSIC define to disable use of intrinsic functions (e.g. for certain older compilers and/or platforms).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f0075d735a76ce326619b6ba7f0d556e492f1c41
User & Date: mistachkin 2015-07-29 21:47:39
Context
2015-07-29
22:38
Support building VSIX packages for UAP using Visual Studio 2015 and the Windows 10 SDK. check-in: 96559adb user: mistachkin tags: trunk
21:47
Add SQLITE_DISABLE_INTRINSIC define to disable use of intrinsic functions (e.g. for certain older compilers and/or platforms). check-in: f0075d73 user: mistachkin tags: trunk
20:24
Fix the releasetest.tcl script so that it ignore cast overflow errors that recent versions of clang generate but which are unavoidable given the test input. check-in: a0020c57 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/btreeInt.h.

   696    696   /*
   697    697   ** get2byteAligned(), unlike get2byte(), requires that its argument point to a
   698    698   ** two-byte aligned address.  get2bytea() is only used for accessing the
   699    699   ** cell addresses in a btree header.
   700    700   */
   701    701   #if SQLITE_BYTEORDER==4321
   702    702   # define get2byteAligned(x)  (*(u16*)(x))
   703         -#elif SQLITE_BYTEORDER==1234 && GCC_VERSION>=4008000
          703  +#elif SQLITE_BYTEORDER==1234 && !defined(SQLITE_DISABLE_INTRINSIC) \
          704  +    && GCC_VERSION>=4008000
   704    705   # define get2byteAligned(x)  __builtin_bswap16(*(u16*)(x))
   705         -#elif SQLITE_BYTEORDER==1234 && defined(_MSC_VER) && _MSC_VER>=1300
          706  +#elif SQLITE_BYTEORDER==1234 && !defined(SQLITE_DISABLE_INTRINSIC) \
          707  +    && defined(_MSC_VER) && _MSC_VER>=1300
   706    708   # define get2byteAligned(x)  _byteswap_ushort(*(u16*)(x))
   707    709   #else
   708    710   # define get2byteAligned(x)  ((x)[0]<<8 | (x)[1])
   709    711   #endif

Changes to src/sqliteInt.h.

   183    183   #  define SQLITE_NOINLINE  __declspec(noinline)
   184    184   #else
   185    185   #  define SQLITE_NOINLINE
   186    186   #endif
   187    187   
   188    188   /*
   189    189   ** Make sure that the compiler intrinsics we desire are enabled when
   190         -** compiling with an appropriate version of MSVC.
          190  +** compiling with an appropriate version of MSVC unless prevented by
          191  +** the SQLITE_DISABLE_INTRINSIC define.
   191    192   */
   192         -#if defined(_MSC_VER) && _MSC_VER>=1300
   193         -#  if !defined(_WIN32_WCE)
   194         -#    include <intrin.h>
   195         -#    pragma intrinsic(_byteswap_ushort)
   196         -#    pragma intrinsic(_byteswap_ulong)
   197         -#  else
   198         -#    include <cmnintrin.h>
          193  +#if !defined(SQLITE_DISABLE_INTRINSIC)
          194  +#  if defined(_MSC_VER) && _MSC_VER>=1300
          195  +#    if !defined(_WIN32_WCE)
          196  +#      include <intrin.h>
          197  +#      pragma intrinsic(_byteswap_ushort)
          198  +#      pragma intrinsic(_byteswap_ulong)
          199  +#    else
          200  +#      include <cmnintrin.h>
          201  +#    endif
   199    202   #  endif
   200    203   #endif
   201    204   
   202    205   /*
   203    206   ** The SQLITE_THREADSAFE macro must be defined as 0, 1, or 2.
   204    207   ** 0 means mutexes are permanently disable and the library is never
   205    208   ** threadsafe.  1 means the library is serialized which is the highest

Changes to src/util.c.

  1078   1078   ** Read or write a four-byte big-endian integer value.
  1079   1079   */
  1080   1080   u32 sqlite3Get4byte(const u8 *p){
  1081   1081   #if SQLITE_BYTEORDER==4321
  1082   1082     u32 x;
  1083   1083     memcpy(&x,p,4);
  1084   1084     return x;
  1085         -#elif SQLITE_BYTEORDER==1234 && defined(__GNUC__) && GCC_VERSION>=4003000
         1085  +#elif SQLITE_BYTEORDER==1234 && !defined(SQLITE_DISABLE_INTRINSIC) \
         1086  +    && defined(__GNUC__) && GCC_VERSION>=4003000
  1086   1087     u32 x;
  1087   1088     memcpy(&x,p,4);
  1088   1089     return __builtin_bswap32(x);
  1089         -#elif SQLITE_BYTEORDER==1234 && defined(_MSC_VER) && _MSC_VER>=1300
         1090  +#elif SQLITE_BYTEORDER==1234 && !defined(SQLITE_DISABLE_INTRINSIC) \
         1091  +    && defined(_MSC_VER) && _MSC_VER>=1300
  1090   1092     u32 x;
  1091   1093     memcpy(&x,p,4);
  1092   1094     return _byteswap_ulong(x);
  1093   1095   #else
  1094   1096     testcase( p[0]&0x80 );
  1095   1097     return ((unsigned)p[0]<<24) | (p[1]<<16) | (p[2]<<8) | p[3];
  1096   1098   #endif