https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125269
Bug ID: 125269
Summary: feature request: Support for clang style
ownership_returns/takes
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: analyzer
Assignee: dmalcolm at gcc dot gnu.org
Reporter: andres at anarazel dot de
Target Milestone: ---
Hi,
gcc's attribute((malloc(freeing-func))) is quite useful to find bugs - but it
doesn't compose very well. Needing to know all the functions that free some
type of allocated memory at the time of declaration of the allocator, or
needing to repeat each allocator's declaration aside each freeing function,
doesn't scale that well.
Compared to that, clang's ownership_returns/takes/holds attributes are more
scalable - you can just slap a ownership_returns(myallocator) on each freeing
function as you declare them, and you're good to go.
Greetings,
Andres