From a1c9afcfeb5137099ebcabacb2dca15e7de06d8c Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Wed, 27 May 2026 10:20:22 +0300 Subject: [PATCH] libsql-sqlite3: Skip SQLITE_USER_AUTHENTICATION #warning on MSVC 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 bc4df6079c), 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. --- libsql-ffi/bundled/SQLite3MultipleCiphers/src/sqlite3.c | 9 ++++++++- libsql-ffi/bundled/src/sqlite3.c | 9 ++++++++- libsql-sqlite3/src/sqliteInt.h | 9 ++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/libsql-ffi/bundled/SQLite3MultipleCiphers/src/sqlite3.c b/libsql-ffi/bundled/SQLite3MultipleCiphers/src/sqlite3.c index d9a19f55a1..988693f341 100644 --- a/libsql-ffi/bundled/SQLite3MultipleCiphers/src/sqlite3.c +++ b/libsql-ffi/bundled/SQLite3MultipleCiphers/src/sqlite3.c @@ -18394,7 +18394,14 @@ struct FuncDefHash { }; #define SQLITE_FUNC_HASH(C,L) (((C)+(L))%SQLITE_FUNC_HASH_SZ) -#if defined(SQLITE_USER_AUTHENTICATION) +/* The #warning directive below is a hard error under MSVC's default +** (traditional) C preprocessor (error C1021), which breaks Windows builds. +** Keep the deprecation notice for compilers that accept #warning and skip it +** on MSVC. This is purely a compile-time diagnostic; the extension itself is +** still controlled by SQLITE_USER_AUTHENTICATION below. Upstream SQLite +** removed this extension entirely in 3.48.0 (commit bc4df6079c), so this +** local patch becomes moot once the bundled SQLite is updated past 3.47.0. */ +#if defined(SQLITE_USER_AUTHENTICATION) && !defined(_MSC_VER) # warning "The SQLITE_USER_AUTHENTICATION extension is deprecated. \ See ext/userauth/user-auth.txt for details." #endif diff --git a/libsql-ffi/bundled/src/sqlite3.c b/libsql-ffi/bundled/src/sqlite3.c index d9a19f55a1..988693f341 100644 --- a/libsql-ffi/bundled/src/sqlite3.c +++ b/libsql-ffi/bundled/src/sqlite3.c @@ -18394,7 +18394,14 @@ struct FuncDefHash { }; #define SQLITE_FUNC_HASH(C,L) (((C)+(L))%SQLITE_FUNC_HASH_SZ) -#if defined(SQLITE_USER_AUTHENTICATION) +/* The #warning directive below is a hard error under MSVC's default +** (traditional) C preprocessor (error C1021), which breaks Windows builds. +** Keep the deprecation notice for compilers that accept #warning and skip it +** on MSVC. This is purely a compile-time diagnostic; the extension itself is +** still controlled by SQLITE_USER_AUTHENTICATION below. Upstream SQLite +** removed this extension entirely in 3.48.0 (commit bc4df6079c), so this +** local patch becomes moot once the bundled SQLite is updated past 3.47.0. */ +#if defined(SQLITE_USER_AUTHENTICATION) && !defined(_MSC_VER) # warning "The SQLITE_USER_AUTHENTICATION extension is deprecated. \ See ext/userauth/user-auth.txt for details." #endif diff --git a/libsql-sqlite3/src/sqliteInt.h b/libsql-sqlite3/src/sqliteInt.h index ac30f3ce5f..fbcc24cf71 100644 --- a/libsql-sqlite3/src/sqliteInt.h +++ b/libsql-sqlite3/src/sqliteInt.h @@ -1615,7 +1615,14 @@ struct FuncDefHash { }; #define SQLITE_FUNC_HASH(C,L) (((C)+(L))%SQLITE_FUNC_HASH_SZ) -#if defined(SQLITE_USER_AUTHENTICATION) +/* The #warning directive below is a hard error under MSVC's default +** (traditional) C preprocessor (error C1021), which breaks Windows builds. +** Keep the deprecation notice for compilers that accept #warning and skip it +** on MSVC. This is purely a compile-time diagnostic; the extension itself is +** still controlled by SQLITE_USER_AUTHENTICATION below. Upstream SQLite +** removed this extension entirely in 3.48.0 (commit bc4df6079c), so this +** local patch becomes moot once the bundled SQLite is updated past 3.47.0. */ +#if defined(SQLITE_USER_AUTHENTICATION) && !defined(_MSC_VER) # warning "The SQLITE_USER_AUTHENTICATION extension is deprecated. \ See ext/userauth/user-auth.txt for details." #endif