SQLite Forum

OMIT warning squishers
Login

OMIT warning squishers

(1) By Warren Young (wyoung) on 2024-05-10 04:20:55 [source]

If you define SQLITE_OMIT_BLOB_LITERAL, the function sqlite3HexToBlob() is ifdef'd out of the amalgamation build, but you still get a warning from recent GCC versions:

sqlite_db/sqlite3/sqlite3.c:21175:22: warning: ‘sqlite3HexToBlob’ declared ‘static’ but never defined [-Wunused-function]

The fix is to also ifdef out the corresponding function declaration:

SQLITE_PRIVATE void *sqlite3HexToBlob(sqlite3*, const char *z, int n);

Unrelated to that, defining SQLITE_OMIT_FOREIGN_KEY yields this:

sqlite_db/sqlite3/sqlite3.c: In function ‘sqlite3VdbeHalt’:
sqlite_db/sqlite3/sqlite3.c:23743:34: warning: statement with no effect [-Wunused-value]
 # define sqlite3VdbeCheckFk(p,i) 0
                                  ^
sqlite_db/sqlite3/sqlite3.c:87746:7: note: in expansion of macro ‘sqlite3VdbeCheckFk’
       sqlite3VdbeCheckFk(p, 0);
       ^~~~~~~~~~~~~~~~~~

The macro expansion referenced in the first part of the message is fine in a context like "rc = sqlite3VdbeCheckFk(p, 1);" but not in a context a few lines up, shortly after the "Check for immediate foreign key violations." comment, where it doesn't do anything with the macro's "0" result. "0" is a legal C statement, but you can see why GCC would gripe about it.


In case anyone's wondering why I'm defining these OMIT macros, it's merely because my code doesn't use those features of SQLite, so why bring in the extra code?

(2) By Stephan Beal (stephan) on 2024-05-10 09:26:59 in reply to 1 [link] [source]

The fix is to also ifdef out ... it doesn't do anything with the macro's "0" result.

Those have both been properly squelched. Thank you for the report!