gcc/testsuite/c-c++-common/analyzer/pr94399.c
raw| 1 | /* { dg-skip-if "requires hosted libstdc++ for stdlib free" { ! hostedlib } } */ |
| 2 | |
| 3 | #include <stdlib.h> |
| 4 | |
| 5 | #define _cleanup_(f) __attribute__((cleanup(f))) |
| 6 | |
| 7 | static inline void freep(void **p) { |
| 8 | free(*p); |
| 9 | } |
| 10 | |
| 11 | void test(void) { |
| 12 | _cleanup_(freep) void *ptr; |
| 13 | |
| 14 | ptr = malloc(3); |
| 15 | } /* { dg-bogus "leak" } */ |