[clang] Diagnose misuse of the cleanup attribute (PR #80040)
Bhuminjay Soni via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 6 08:13:38 PST 2024
11happy wrote:
```
extern void free(void *);
extern void *malloc(size_t size);
void t8(void) {
void *p __attribute__((cleanup(free))) = malloc(10); // expected-warning{{attempt to call free on non-heap object 'p'}}
}
```
I added this, but
I am getting this error: (Sorry if its a silly doubt)
```
error: 'expected-warning' diagnostics expected but not seen:
File /home/happy/LLVM/llvm-project/clang/test/Sema/attr-cleanup.c Line 55: attempt to call free on non-heap object 'p'
error: 'expected-warning' diagnostics seen but not expected:
(frontend): attempt to call free on non-heap object 'p'
2 errors generated.
```
https://github.com/llvm/llvm-project/pull/80040
More information about the cfe-commits
mailing list