]> granicus.if.org Git - clang/commitdiff
Add more attribute 'malloc' test cases involving function pointers.
authorTed Kremenek <kremenek@apple.com>
Fri, 14 Aug 2009 22:06:01 +0000 (22:06 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 14 Aug 2009 22:06:01 +0000 (22:06 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79055 91177308-0d34-0410-b5e6-96231b3b80d8

test/Sema/attr-malloc.c
test/SemaObjC/attr-malloc.m

index 36e8b1d69947095cbd8fbdb86f1537d8ad836304..2ad71efebd04e4210f5be799eb9e24d56f72798a 100644 (file)
@@ -12,6 +12,7 @@ typedef int * iptr;
 iptr  returns_iptr  (void) __attribute((malloc)); // no-warning
 
 __attribute((malloc)) void *(*f)(); // no-warning
+__attribute((malloc)) int (*g)(); // expected-warning{{'malloc' attribute only applies to functions returning pointer type}}
 
 __attribute((malloc))
 void * xalloc(unsigned n) { return malloc(n); } // no-warning
index a1a5df96eb163521cbef3441603d3bda1336d110..f18388f4e64c2e602f50d89d179e840e3b1de2f0 100644 (file)
@@ -10,3 +10,6 @@ id bar(void) __attribute((malloc)); // no-warning
 typedef void (^bptr)(void);
 bptr baz(void) __attribute((malloc)); // no-warning
 
+__attribute((malloc)) id (*f)(); // no-warning
+__attribute((malloc)) bptr (*g)(); // no-warning
+