Repository navigation
cimport: resolve amalgamation unit prototypes against installed <stem>.h header - #3651
Merged
Merged
Conversation
Contributor
Author
|
Battery &
|
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.
Fixes
with get c.sqlite3drafting0 functions, 0 presented safely(part of #3146).Root cause
Amalgamation C libraries (
sqlite3.c) embed their public prototypes directly inside the.cunit instead of#include "sqlite3.h".CiMigrate.withleftsymbol.header_fileempty whenever the prototype's location was not a header file (ci_migrate_location_is_header(loc)), somigrate_c_facade_for_packagedemoted every publicsqlite3_*function as "declared only by headers the package does not install".Fix
src/CiMigrate.with: when aheader_declaredsymbol has an emptyheader_file, fall back to its owning.cunit inci_facade_import_spelling. For a.cfile withdeclaresnon-empty, match a unique installed<stem>.hunderimport_dirsmentioningdeclares, then letprocess_c_import_with_defines+with_cimport_is_name_emittedverify with clang that the installed header actually declares the function (excluding.c-only internal forward declarations). Record the resolved header onsymbol.header_filesouse c_import("<stem>.h", ...)is emitted.test/internals/conan_facade_amalgamation_header_test.with: verifies an amalgamation.cunit (amalg.c+ installedinclude/amalg.h) presents public functions, emitsuse c_import("amalg.h", ...), and excludes.c-only forward declarations.Measured impact on
sqlite3 3.54.10 functions, 0 presented safely, 0 raw285 functions, 35 presented safely, 250 raw, emittinguse c_import("sqlite3.h", link: "sqlite3")