What does "clang -v" show on your machine? On 2/15/17, Domingo Alvarez Duarte <mingo...@gmail.com> wrote: > Hello Anthony ! > > I also got those errors and did a dirty change to sqlite3 to compile, > your proposal makes an all or nothing use of builtins, probably a one by > one check/enable could give better result. > > Cheers ! > > > On 14/02/17 21:38, Anthony Chan (antchan2) wrote: >> Hello, >> >> I tried building SQLite 3.17.0 with OSX/Xcode and got the following >> errors: >> >> - >> sqlite3.c:28836:10: error: use of unknown builtin '__builtin_add_overflow' >> [-Wimplicit-function-declaration] >> return __builtin_add_overflow(*pA, iB, pA); >> ^ >> sqlite3.c:28856:10: error: use of unknown builtin '__builtin_sub_overflow' >> [-Wimplicit-function-declaration] >> return __builtin_sub_overflow(*pA, iB, pA); >> ^ >> sqlite3.c:28856:10: note: did you mean '__builtin_add_overflow'? >> sqlite3.c:28836:10: note: '__builtin_add_overflow' declared here >> return __builtin_add_overflow(*pA, iB, pA); >> ^ >> sqlite3.c:28871:10: error: use of unknown builtin '__builtin_mul_overflow' >> [-Wimplicit-function-declaration] >> return __builtin_mul_overflow(*pA, iB, pA); >> ^ >> sqlite3.c:28871:10: note: did you mean '__builtin_sub_overflow'? >> sqlite3.c:28856:10: note: '__builtin_sub_overflow' declared here >> return __builtin_sub_overflow(*pA, iB, pA); >> ^ >> 3 errors generated. >> - >> >> I believe this is related to the recent change “Cleanup the usage of the >> SQLITE_DISABLE_INTRINSIC compile-time option…” >> (http://www.sqlite.org/src/info/798fb9d70d2e5f95) and the use of >> CLANG_VERSION to decide whether to use builtin functions: >> >> #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 >> >> … >> >> #elif SQLITE_BYTEORDER==1234 && (GCC_VERSION>=4003000 || >> CLANG_VERSION>=3000000) >> u32 x; >> memcpy(&x,p,4); >> return __builtin_bswap32(x); >> >> According to Clang documentation >> (http://clang.llvm.org/docs/LanguageExtensions.html): “marketing version >> numbers should not be used to check for language features, as different >> vendors use different numbering schemes. Instead, use the Feature Checking >> Macros.” >> >> With this in mind, I suggest creating a new macro that uses feature >> checking macros. For example: >> >> #if defined(__clang__) && !defined(_WIN32) && >> !defined(SQLITE_DISABLE_INTRINSIC) >> # if __has_builtin(__builtin_add_overflow) && \ >> __has_builtin(__builtin_sub_overflow) && \ >> __has_builtin(__builtin_mul_overflow) && \ >> __has_builtin(__builtin_bswap32) && \ >> __has_builtin(__builtin_bswap64) >> # define CLANG_USE_INTRINSIC 1 >> # else >> # define CLANG_USE_INTRINSIC 0 >> # endif >> #else >> # define CLANG_USE_INTRINSIC 0 >> #endif >> >> The tests would look like this: >> >> #elif SQLITE_BYTEORDER==1234 && (GCC_VERSION>=4003000 || >> CLANG_USE_INTRINSIC!=0) >> u32 x; >> memcpy(&x,p,4); >> return __builtin_bswap32(x); >> >> Your comments are welcome. >> >> Thanks, >> >> Anthony >> antch...@cisco.com >> >> >> >> _______________________________________________ >> sqlite-users mailing list >> sqlite-users@mailinglists.sqlite.org >> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > > _______________________________________________ > sqlite-users mailing list > sqlite-users@mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users >
-- D. Richard Hipp d...@sqlite.org _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users