aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-08-14 22:06:01 +0000
committerTed Kremenek <kremenek@apple.com>2009-08-14 22:06:01 +0000
commit2733b669ae5424c4a0fff49f7361b21a730eb3df (patch)
treed9d9ec725f50c1469dac4d93c7466c1014e74b09
parentb109069995b44f3ef182bcd1b02ad05e9ea9d21d (diff)
Add more attribute 'malloc' test cases involving function pointers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79055 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/Sema/attr-malloc.c1
-rw-r--r--test/SemaObjC/attr-malloc.m3
2 files changed, 4 insertions, 0 deletions
diff --git a/test/Sema/attr-malloc.c b/test/Sema/attr-malloc.c
index 36e8b1d699..2ad71efebd 100644
--- a/test/Sema/attr-malloc.c
+++ b/test/Sema/attr-malloc.c
@@ -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
diff --git a/test/SemaObjC/attr-malloc.m b/test/SemaObjC/attr-malloc.m
index a1a5df96eb..f18388f4e6 100644
--- a/test/SemaObjC/attr-malloc.m
+++ b/test/SemaObjC/attr-malloc.m
@@ -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
+