summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/attr-malloc.c
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-08-15 00:51:46 +0000
committerTed Kremenek <kremenek@apple.com>2009-08-15 00:51:46 +0000
commit08479ae7fe590ac0d60a282b3e69823caec809bc (patch)
tree522925ad67c0d238f350a90d8c037bd76164ed65 /clang/test/Sema/attr-malloc.c
parent8dc7626f9c73802925c8d63d6dcaf36f4f867875 (diff)
downloadbcm5719-llvm-08479ae7fe590ac0d60a282b3e69823caec809bc.tar.gz
bcm5719-llvm-08479ae7fe590ac0d60a282b3e69823caec809bc.zip
Change handling of attribute 'malloc' to only accept the attribute on function
declarations (and not function pointers). This is consistent with GCC. Accepting this attribute on function pointers means that the attribute should be treated as a type qualifier, which apparently is not what GCC does. We obviously can change this later should we desire to enhance the 'malloc' attribute in this way. llvm-svn: 79060
Diffstat (limited to 'clang/test/Sema/attr-malloc.c')
-rw-r--r--clang/test/Sema/attr-malloc.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/test/Sema/attr-malloc.c b/clang/test/Sema/attr-malloc.c
index 2ad71efebd0..1adcf074a49 100644
--- a/clang/test/Sema/attr-malloc.c
+++ b/clang/test/Sema/attr-malloc.c
@@ -3,16 +3,16 @@
#include <stdlib.h>
-int no_vars __attribute((malloc)); // expected-warning {{only applies to function types}}
+int no_vars __attribute((malloc)); // expected-warning {{functions returning a pointer type}}
-void returns_void (void) __attribute((malloc)); // expected-warning {{functions returning pointer type}}
-int returns_int (void) __attribute((malloc)); // expected-warning {{functions returning pointer type}}
+void returns_void (void) __attribute((malloc)); // expected-warning {{functions returning a pointer type}}
+int returns_int (void) __attribute((malloc)); // expected-warning {{functions returning a pointer type}}
int * returns_intptr(void) __attribute((malloc)); // no-warning
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 *(*f)(); // expected-warning{{'malloc' attribute only applies to functions returning a pointer type}}
+__attribute((malloc)) int (*g)(); // expected-warning{{'malloc' attribute only applies to functions returning a pointer type}}
__attribute((malloc))
void * xalloc(unsigned n) { return malloc(n); } // no-warning
OpenPOWER on IntegriCloud