Hi,

The first patch adds support to the alloc_size attribute.

http://llvm.org/bugs/show_bug.cgi?id=10516

Thanks to Eli Friedman for the earlier comments.

The second patch demonstrates one use of alloc_size.  It extends
the malloc overflow checker to support custom allocators:

void *my_malloc(size_t) __attribute__((alloc_size(1)));

void *foo(int n)
{
  return my_malloc(n * sizeof(int));  // warning
}

Please review.  Thanks.

- xi

Attachment: alloc_size.patch
Description: Binary data

Attachment: malloc-overflow.patch
Description: Binary data

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to