On Fri, 4 Sep 2020 at 14:55, Craig Ringer <cr...@2ndquadrant.com> wrote:
> Using a test program: > > return_stack_escape.c:14:3: warning: Address of stack memory associated > with local variable 'g' is still referred to by the global variable > 'guard_ptr' upon returning to the caller. This will be a dangling reference > return do_fail; > ^~~~~~~~~~~~~~ > 1 warning generated. > > Example here: https://github.com/ringerc/scrapcode/tree/master/c/clang_return_stack_checks So I find that actually, the __attribute__((callback(fn)) approach is unnecessary for the purpose proposed. I still think we should be looking at tidying up the error contexts API, but it's easy enough for extensions to provide a wrapper over it, so that's not a big deal really. I will submit my docs patches separately to ensure they get some attention, and I'll experiment with llvm threadsafety annotations / capabilities. -- Craig Ringer http://www.2ndQuadrant.com/ 2ndQuadrant - PostgreSQL Solutions for the Enterprise