bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: alloc_size attribute


From: Jim Meyering
Subject: Re: alloc_size attribute
Date: Sun, 17 Oct 2010 15:48:29 +0200

Bruno Haible wrote:
> Jim Meyering wrote:
>> ---------------------------------------------
>> While looking through gcc's documentation (latest upstream),
>> I noticed this, which can be put to good use in xalloc.h:
>>
>>     @item alloc_size
>>     @cindex @code{alloc_size} attribute
>>     The @code{alloc_size} attribute is used to tell the compiler that the
>>     function return value points to memory, where the size is given by
>>     one or two of the functions parameters.  GCC uses this
>>     information to improve the correctness of @code{__builtin_object_size}.
>
> Here is a proposed patch:
>
> 2010-10-17  Bruno Haible  <address@hidden>
>
>       Make use of GCC's attribute __alloc_size__.
>       * lib/xalloc.h (ATTRIBUTE_ALLOC_SIZE): New macro.
>       (xmalloc, xzalloc, xcalloc, xrealloc, xmemdup, xnmalloc, xnrealloc,
>       xcharalloc): Declare with ATTRIBUTE_ALLOC_SIZE.
>       * lib/eealloc.h (eemalloc, eerealloc): Declare with attribute
>       __alloc_size__.
>       * lib/pagealign_alloc.h (pagealign_alloc, pagealign_xalloc): Likewise.
>       Suggested by Jim Meyering.
>
> --- lib/eealloc.h.orig        Sun Oct 17 15:33:30 2010
> +++ lib/eealloc.h     Sun Oct 17 15:33:29 2010
> @@ -1,5 +1,5 @@
>  /* Memory allocation with expensive empty allocations.
> -   Copyright (C) 2003, 2008, 2009, 2010 Free Software Foundation, Inc.
> +   Copyright (C) 2003, 2008, 2010 Free Software Foundation, Inc.
...
> --- lib/pagealign_alloc.h.orig        Sun Oct 17 15:33:30 2010
> +++ lib/pagealign_alloc.h     Sun Oct 17 15:27:53 2010
> @@ -1,6 +1,6 @@
>  /* Memory allocation aligned to system page boundaries.
>
> -   Copyright (C) 2005, 2008, 2009, 2010 Free Software Foundation, Inc.
> +   Copyright (C) 2005, 2008, 2010 Free Software Foundation, Inc.

Thanks for the quick patches.
They look fine.  But did you intend to remove 2009 from those
two copyright year lists?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]