erichkeane 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. > ```
That looks like you got the source-location wrong on your diagnostic. https://github.com/llvm/llvm-project/pull/80040 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits