Repository navigation
Conversation
Compiled with -DSQLITE_CORE, as when sqlite-vec.c is built into SQLite or
an application, sqlite3_vec_init() never reads its pApi parameter, since
SQLITE_EXTENSION_INIT2() is its only use and SQLITE_CORE leaves it out. With
-Wall -Wextra it warns:
gcc -Ivendor -Wall -Wextra -DSQLITE_CORE -DSQLITE_VEC_STATIC \
-c sqlite-vec.c -o vec.o
sqlite-vec.c:10633:65: warning: unused parameter 'pApi'
It now marks it with UNUSED_PARAMETER() in that case. The command no longer
prints that warning with gcc 14.2 or clang 19.1, and the loadable
extension, built without SQLITE_CORE, is unchanged.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Compiled with
-DSQLITE_CORE, as whensqlite-vec.cis built into SQLite or into an application,sqlite3_vec_init()never reads itspApiparameter:SQLITE_EXTENSION_INIT2()is its only use, andSQLITE_COREleaves it out. A project that compiles the file into its own binary with-Wall -Wextragets a warning for it from main, with gcc 14.2 and with clang 19.1:The Makefile's
statictarget compiles without-Wall -Wextra, so the project's own builds do not print it. The same command prints 12 other warnings with gcc (sign comparisons, variables it reports as maybe used uninitialized, and an unusedp_vectorparameter insqlite-vec-diskann.c), and thep_vectorone with clang; this PR leaves those as they are.sqlite3_vec_init()now markspApiwithUNUSED_PARAMETER()in theSQLITE_COREcase. The change comes from photostructure#9 (d89dbcf), and is open on vlasky/sqlite-vec as vlasky#23, wheresqlite3_vec_numpy_init()andsqlite3_vec_static_blobs_init()have the same warning. No other open or closed PR or issue here marks it.Test. The command above prints the
pApiwarning on main and not on this branch, with either compiler.UNUSED_PARAMETER()is a(void)cast, so the object files are byte-identical before and after, both for the loadable extension and with-DSQLITE_CORE. The Python tests (tests/test-*.py: 239 passed, 66 skipped) pass.make test-unitdoes not compile on main; with #305 and #319 merged it compiles and passes on Linux arm64, with this change and without it. (#305 alone fails there, intest_vec0_parse_partition_key_definition's empty-definition case: the&&guards #319 corrects read the scanner's token after it found none, so the result depends on what the stack held.) It merges cleanly with #327 to #331 and #336 to #340.