mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-15 22:53:34 +02:00
Add macros wrapping the gcc alloc_size function attribute. (#523019,
2008-03-30 Matthias Clasen <mclasen@redhat.com> * glib/gmacros.h: Add macros wrapping the gcc alloc_size function attribute. (#523019, Rodrigo Moya) * glib/gmem.h: * glib/gslice.h: * glib/gstrfuncs.h: Use the new attribute where appropriate. svn path=/trunk/; revision=6781
This commit is contained in:
committed by
Matthias Clasen
parent
f0c679e3bf
commit
2af49e60a1
@ -1,3 +1,9 @@
|
||||
2008-03-30 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* glib/glib-sections.txt:
|
||||
* glib/tmpl/macros-misc.sgml: Document G_GNUC_ALLOC_SIZE
|
||||
macros
|
||||
|
||||
2008-03-28 A. Walton <awalton@svn.gnome.org>
|
||||
|
||||
* gio/overview.xml:
|
||||
|
@ -324,6 +324,8 @@ G_GNUC_EXTENSION
|
||||
G_GNUC_CONST
|
||||
G_GNUC_PURE
|
||||
G_GNUC_MALLOC
|
||||
G_GNUC_ALLOC_SIZE
|
||||
G_GNUC_ALLOC_SIZE2
|
||||
G_GNUC_DEPRECATED
|
||||
G_GNUC_NORETURN
|
||||
G_GNUC_UNUSED
|
||||
|
@ -141,17 +141,44 @@ See the GNU C documentation for details.
|
||||
|
||||
<!-- ##### MACRO G_GNUC_MALLOC ##### -->
|
||||
<para>
|
||||
Expands to the GNU C <literal>malloc</literal> function attribute if the compiler is
|
||||
<command>gcc</command>. Declaring a function as malloc enables better optimization of the
|
||||
function. A function can have the malloc attribute if it returns a pointer which is guaranteed
|
||||
to not alias with any other pointer when the function returns (in practice, this means newly
|
||||
allocated memory).
|
||||
Expands to the GNU C <literal>malloc</literal> function attribute if the
|
||||
compiler is <command>gcc</command>. Declaring a function as malloc enables
|
||||
better optimization of the function. A function can have the malloc attribute
|
||||
if it returns a pointer which is guaranteed to not alias with any other pointer
|
||||
when the function returns (in practice, this means newly allocated memory).
|
||||
See the GNU C documentation for details.
|
||||
</para>
|
||||
|
||||
@Since: 2.6
|
||||
|
||||
|
||||
<!-- ##### MACRO G_GNUC_ALLOC_SIZE ##### -->
|
||||
<para>
|
||||
Expands to the GNU C <literal>alloc_size</literal> function attribute if the
|
||||
compiler is a new enough <command>gcc</command>. This attribute tells the
|
||||
compiler that the function returns a pointer to memory of a size that is
|
||||
specified by the @x<!-- -->th function parameter.
|
||||
See the GNU C documentation for details.
|
||||
</para>
|
||||
|
||||
@x: the index of the argument specifying the allocation size
|
||||
@Since: 2.18
|
||||
|
||||
|
||||
<!-- ##### MACRO G_GNUC_ALLOC_SIZE2 ##### -->
|
||||
<para>
|
||||
Expands to the GNU C <literal>alloc_size</literal> function attribute if the
|
||||
compiler is a new enough <command>gcc</command>. This attribute tells the
|
||||
compiler that the function returns a pointer to memory of a size that is
|
||||
specified by the product of two function parameters.
|
||||
See the GNU C documentation for details.
|
||||
</para>
|
||||
|
||||
@x: the index of the argument specifying one factor of the allocation size
|
||||
@y: the index of the argument specifying the second factor of the allocation size
|
||||
@Since: 2.18
|
||||
|
||||
|
||||
<!-- ##### MACRO G_GNUC_DEPRECATED ##### -->
|
||||
<para>
|
||||
Expands to the GNU C <literal>deprecated</literal> attribute if the compiler
|
||||
|
Reference in New Issue
Block a user