Skip to content

Commit 23c1dd1

Browse files
authored
libsql-sqlite3: Skip SQLITE_USER_AUTHENTICATION #warning on MSVC (#2241)
The SQLITE_USER_AUTHENTICATION deprecation #warning (added upstream in SQLite 3.46.0) is a hard error under MSVC's default traditional C preprocessor (error C1021: invalid preprocessor command 'warning'), breaking Windows builds. SQLite3MultipleCiphers force-enables SQLITE_USER_AUTHENTICATION by default, so the directive is active even though build.rs passes -DSQLITE_USER_AUTHENTICATION=OFF. Guard the directive with !defined(_MSC_VER) so the deprecation notice is kept for GCC/Clang and skipped on MSVC. This is purely a compile-time diagnostic; the extension's runtime behavior is unchanged on all platforms. Upstream removed this extension entirely in SQLite 3.48.0 (commit bc4df60), so this local patch becomes moot once the bundled SQLite is updated past 3.47.0. The patch is applied in libsql-sqlite3/src and mirrored into both regenerated bundled amalgamations.
2 parents d1d48dd + a1c9afc commit 23c1dd1

3 files changed

Lines changed: 24 additions & 3 deletions

File tree

libsql-ffi/bundled/SQLite3MultipleCiphers/src/sqlite3.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18394,7 +18394,14 @@ struct FuncDefHash {
1839418394
};
1839518395
#define SQLITE_FUNC_HASH(C,L) (((C)+(L))%SQLITE_FUNC_HASH_SZ)
1839618396

18397-
#if defined(SQLITE_USER_AUTHENTICATION)
18397+
/* The #warning directive below is a hard error under MSVC's default
18398+
** (traditional) C preprocessor (error C1021), which breaks Windows builds.
18399+
** Keep the deprecation notice for compilers that accept #warning and skip it
18400+
** on MSVC. This is purely a compile-time diagnostic; the extension itself is
18401+
** still controlled by SQLITE_USER_AUTHENTICATION below. Upstream SQLite
18402+
** removed this extension entirely in 3.48.0 (commit bc4df6079c), so this
18403+
** local patch becomes moot once the bundled SQLite is updated past 3.47.0. */
18404+
#if defined(SQLITE_USER_AUTHENTICATION) && !defined(_MSC_VER)
1839818405
# warning "The SQLITE_USER_AUTHENTICATION extension is deprecated. \
1839918406
See ext/userauth/user-auth.txt for details."
1840018407
#endif

libsql-ffi/bundled/src/sqlite3.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18394,7 +18394,14 @@ struct FuncDefHash {
1839418394
};
1839518395
#define SQLITE_FUNC_HASH(C,L) (((C)+(L))%SQLITE_FUNC_HASH_SZ)
1839618396

18397-
#if defined(SQLITE_USER_AUTHENTICATION)
18397+
/* The #warning directive below is a hard error under MSVC's default
18398+
** (traditional) C preprocessor (error C1021), which breaks Windows builds.
18399+
** Keep the deprecation notice for compilers that accept #warning and skip it
18400+
** on MSVC. This is purely a compile-time diagnostic; the extension itself is
18401+
** still controlled by SQLITE_USER_AUTHENTICATION below. Upstream SQLite
18402+
** removed this extension entirely in 3.48.0 (commit bc4df6079c), so this
18403+
** local patch becomes moot once the bundled SQLite is updated past 3.47.0. */
18404+
#if defined(SQLITE_USER_AUTHENTICATION) && !defined(_MSC_VER)
1839818405
# warning "The SQLITE_USER_AUTHENTICATION extension is deprecated. \
1839918406
See ext/userauth/user-auth.txt for details."
1840018407
#endif

libsql-sqlite3/src/sqliteInt.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1615,7 +1615,14 @@ struct FuncDefHash {
16151615
};
16161616
#define SQLITE_FUNC_HASH(C,L) (((C)+(L))%SQLITE_FUNC_HASH_SZ)
16171617

1618-
#if defined(SQLITE_USER_AUTHENTICATION)
1618+
/* The #warning directive below is a hard error under MSVC's default
1619+
** (traditional) C preprocessor (error C1021), which breaks Windows builds.
1620+
** Keep the deprecation notice for compilers that accept #warning and skip it
1621+
** on MSVC. This is purely a compile-time diagnostic; the extension itself is
1622+
** still controlled by SQLITE_USER_AUTHENTICATION below. Upstream SQLite
1623+
** removed this extension entirely in 3.48.0 (commit bc4df6079c), so this
1624+
** local patch becomes moot once the bundled SQLite is updated past 3.47.0. */
1625+
#if defined(SQLITE_USER_AUTHENTICATION) && !defined(_MSC_VER)
16191626
# warning "The SQLITE_USER_AUTHENTICATION extension is deprecated. \
16201627
See ext/userauth/user-auth.txt for details."
16211628
#endif

0 commit comments

Comments
 (0)