#include <stdio.h> typedef struct foo foo_t; void foo_cleanup(foo_t *f); struct foo { int i; }; void foo_cleanup(foo_t *f) { printf("f %d\n", f->i); } int main() { foo_t a __attribute__((cleanup(foo_cleanup))) = { 7 }; printf("l %d\n", __LINE__); { foo_t b __attribute__((cleanup(foo_cleanup))) = { 8 }; printf("l %d\n", __LINE__); } printf("l %d\n", __LINE__); } l 18 l 23 f 8 l 26 f 7