From 1fa28d4534b5b32b24d57d9442035166d1c85f65 Mon Sep 17 00:00:00 2001 From: Aaron Paterson Date: Fri, 23 Oct 2026 01:54:07 -0500 Subject: [PATCH] Mark the init functions' pApi unused under SQLITE_CORE Compiled with -DSQLITE_CORE, as when sqlite-vec.c is built into SQLite or an application, sqlite3_vec_init(), sqlite3_vec_numpy_init() and sqlite3_vec_static_blobs_init() never read their pApi parameter, since SQLITE_EXTENSION_INIT2() is its only use and SQLITE_CORE leaves it out. With -Wall -Wextra each of them warns: gcc -Ivendor -Wall -Wextra -DSQLITE_CORE -DSQLITE_VEC_STATIC \ -c sqlite-vec.c -o vec.o sqlite-vec.c:11535:65: warning: unused parameter 'pApi' sqlite-vec.c:11620:73: warning: unused parameter 'pApi' sqlite-vec.c:11638:59: warning: unused parameter 'pApi' Each now marks it with UNUSED_PARAMETER() in that case, as two of them do for pzErrMsg. The command prints no warning with gcc 14.2 or clang 19.1, and the loadable extension, built without SQLITE_CORE, is unchanged. --- sqlite-vec.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sqlite-vec.c b/sqlite-vec.c index ab77083c..9bcd05b3 100644 --- a/sqlite-vec.c +++ b/sqlite-vec.c @@ -11535,6 +11535,8 @@ SQLITE_VEC_API int sqlite3_vec_init(sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi) { #ifndef SQLITE_CORE SQLITE_EXTENSION_INIT2(pApi); +#else + UNUSED_PARAMETER(pApi); #endif int rc = SQLITE_OK; @@ -11621,6 +11623,8 @@ SQLITE_VEC_API int sqlite3_vec_numpy_init(sqlite3 *db, char **pzErrMsg, UNUSED_PARAMETER(pzErrMsg); #ifndef SQLITE_CORE SQLITE_EXTENSION_INIT2(pApi); +#else + UNUSED_PARAMETER(pApi); #endif int rc = SQLITE_OK; rc = sqlite3_create_function_v2(db, "vec_npy_file", 1, SQLITE_RESULT_SUBTYPE, @@ -11639,6 +11643,8 @@ sqlite3_vec_static_blobs_init(sqlite3 *db, char **pzErrMsg, UNUSED_PARAMETER(pzErrMsg); #ifndef SQLITE_CORE SQLITE_EXTENSION_INIT2(pApi); +#else + UNUSED_PARAMETER(pApi); #endif int rc = SQLITE_OK;