Repository navigation
Facade evidence: attributes are also read from Clang's AST; a package function annotated malloc is an allocator call - #3205
Merged
Merged
Conversation
added 2 commits
November 9, 2026 13:40
…l (either spelling), and a callee with no reason yet is never said as '()' libpng's png_create_info_struct returns `(png_inforp)png_malloc_base(…)`; png_malloc_base returns `void *` and carries PNG_ALLOCATED, which is `__attribute__((__malloc__))` (it may also call a user hook, so only the annotation proves the allocation). The drafter honoured malloc only on a function returning a record pointer and only in the plain spelling, so the producer stayed raw with 'png_malloc_base is unproven ()': the empty cause because the callee's own verdict had not been reached in that pass. A pointer-returning function of the package annotated malloc (or GCC's reserved __malloc__) is now an allocator call, as libc's malloc and a global initialized to it are (D121), and an unreached callee is described from its return type. Found with the #3168 fix (libpng reads 256 functions, was 0). Fixture: conan_facade_malloc_attr_void_test (the macro-spelled __malloc__ before the return type, and the plain malloc after the declarator, both allocators with a user hook); it fails on main with 'thing_alloc is unproven ()'.
…ST, at their spelling with_cimport_fn_attributes read a declaration's attributes from the tokens of its extent. libpng declares every function through a function-like macro whose last argument is the attribute macro (`PNG_INTERNAL_FUNCTION(png_voidp, png_malloc_base, (…), PNG_ALLOCATED)`, PNG_ALLOCATED being `__attribute__((__malloc__))` in pngconf.h): the extent starts in one file and ends in another, its tokens read nothing, and libpng's report showed no attribute on any of its 256 functions. The function cursor's attribute children are now visited too, each tokenized at its spelling (inside the #define that wrote it), and the entries the token scan did not already give are added. Only the facade scan reads these attributes (D121 step 3 evidence); migrated corpora are untouched. Fixture: conan_facade_macro_arg_attr_test (libpng's layout: the attribute macro in one header, a function-like export macro, the attribute as its last argument; fails on main: no attribute, producer raw).
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.
Part of #3115 (found with #3168's libpng). Two commits. (1) CiFacadeDraft: a pointer-returning function of the package annotated
malloc/__malloc__is an allocator call, and a callee with no reason yet is said from its return type, never(). (2) ClangBridge: a function's attributes are also read from its AST attribute children, tokenized at their spelling; libpng passes PNG_ALLOCATED as the last argument of a function-like macro from another header, and the declaration's own tokens read nothing (no attribute on any of libpng's 256 functions). Result on libpng: png_create_read_struct and png_create_info_struct are proven owned; what remains is thepng_structppdestroyer shape (#3177/#3119). Fixtures conan_facade_malloc_attr_void_test, conan_facade_macro_arg_attr_test. Battery GREEN on 2fd9f10 (with run tools/battery.win ~/.local/with-staging/ipngalloc, wall 371 s after a green gate and internals lane; GREEN BATTERY_DONE).