Document G_GNUC_MALLOC.

2004-11-28  Matthias Clasen  <mclasen@redhat.com>

	* glib/tmpl/macros_misc.sgml: Document G_GNUC_MALLOC.

	* glib/glib-sections.txt: Add G_GNUC_MALLOC
This commit is contained in:
Matthias Clasen 2004-11-28 19:13:36 +00:00 committed by Matthias Clasen
parent 379e87466d
commit 7735d799c5
3 changed files with 41 additions and 23 deletions

View File

@ -1,3 +1,9 @@
2004-11-28 Matthias Clasen <mclasen@redhat.com>
* glib/tmpl/macros_misc.sgml: Document G_GNUC_MALLOC.
* glib/glib-sections.txt: Add G_GNUC_MALLOC
2004-11-12 Matthias Clasen <mclasen@redhat.com> 2004-11-12 Matthias Clasen <mclasen@redhat.com>
* === Released 2.5.6 === * === Released 2.5.6 ===

View File

@ -314,10 +314,11 @@ G_STRINGIFY
<SUBSECTION> <SUBSECTION>
G_GNUC_EXTENSION G_GNUC_EXTENSION
G_GNUC_CONST G_GNUC_CONST
G_GNUC_PURE
G_GNUC_MALLOC
G_GNUC_DEPRECATED G_GNUC_DEPRECATED
G_GNUC_NORETURN G_GNUC_NORETURN
G_GNUC_UNUSED G_GNUC_UNUSED
G_GNUC_PURE
G_GNUC_PRINTF G_GNUC_PRINTF
G_GNUC_SCANF G_GNUC_SCANF
G_GNUC_FORMAT G_GNUC_FORMAT

View File

@ -103,11 +103,10 @@ when compiling with the <option>-pedantic</option> option.
<!-- ##### MACRO G_GNUC_CONST ##### --> <!-- ##### MACRO G_GNUC_CONST ##### -->
<para> <para>
Expands to the GNU C <literal>const</literal> function attribute if the compiler is <command>gcc</command>. Expands to the GNU C <literal>const</literal> function attribute if the compiler is
Declaring a function as const enables better optimization of the function. <command>gcc</command>. Declaring a function as const enables better optimization of calls
A const function doesn't examine any values except its parameters, to the function. A const function doesn't examine any values except its parameters, and has no
and has no effects except its return value. effects except its return value. See the GNU C documentation for details.
See the GNU C documentation for details.
</para> </para>
<note><para> <note><para>
A function that has pointer arguments and examines the data pointed to A function that has pointer arguments and examines the data pointed to
@ -118,6 +117,30 @@ for a const function to return void.
<!-- ##### MACRO G_GNUC_PURE ##### -->
<para>
Expands to the GNU C <literal>pure</literal> function attribute if the compiler is
<command>gcc</command>. Declaring a function as pure enables better optimization of
calls to the function. A pure function has no effects except its return value and the
return value depends only on the parameters and/or global variables.
See the GNU C documentation for details.
</para>
<!-- ##### 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).
See the GNU C documentation for details.
</para>
@Since: 2.6
<!-- ##### MACRO G_GNUC_DEPRECATED ##### --> <!-- ##### MACRO G_GNUC_DEPRECATED ##### -->
<para> <para>
Expands to the GNU C <literal>deprecated</literal> attribute if the compiler Expands to the GNU C <literal>deprecated</literal> attribute if the compiler
@ -134,8 +157,7 @@ See the GNU C documentation for details.
<!-- ##### MACRO G_GNUC_NORETURN ##### --> <!-- ##### MACRO G_GNUC_NORETURN ##### -->
<para> <para>
Expands to the GNU C <literal>noreturn</literal> function attribute if the Expands to the GNU C <literal>noreturn</literal> function attribute if the
compiler is <command>gcc</command>. compiler is <command>gcc</command>. It is used for declaring functions which never return.
It is used for declaring functions which never return.
It enables optimization of the function, and avoids possible compiler It enables optimization of the function, and avoids possible compiler
warnings. See the GNU C documentation for details. warnings. See the GNU C documentation for details.
</para> </para>
@ -144,28 +166,17 @@ warnings. See the GNU C documentation for details.
<!-- ##### MACRO G_GNUC_UNUSED ##### --> <!-- ##### MACRO G_GNUC_UNUSED ##### -->
<para> <para>
Expands to the GNU C <literal>unused</literal> function attribute if the compiler is <command>gcc</command>. Expands to the GNU C <literal>unused</literal> function attribute if the compiler is
It is used for declaring functions which may never be used. <command>gcc</command>. It is used for declaring functions which may never be used.
It avoids possible compiler warnings. See the GNU C documentation for details. It avoids possible compiler warnings. See the GNU C documentation for details.
</para> </para>
<!-- ##### MACRO G_GNUC_PURE ##### -->
<para>
Expands to the GNU C <literal>pure</literal> function attribute if the compiler is <command>gcc</command>.
Declaring a function as pure enables better optimization of the function.
A pure function has no effects except its return value and the return
value depends only on the parameters and/or global variables.
See the GNU C documentation for details.
</para>
<!-- ##### MACRO G_GNUC_PRINTF ##### --> <!-- ##### MACRO G_GNUC_PRINTF ##### -->
<para> <para>
Expands to the GNU C <literal>format</literal> function attribute if the compiler is <command>gcc</command>. Expands to the GNU C <literal>format</literal> function attribute if the compiler is
This is used for declaring functions which take a variable number of <command>gcc</command>. This is used for declaring functions which take a variable number of
arguments, with the same syntax as <function>printf()</function>. arguments, with the same syntax as <function>printf()</function>.
It allows the compiler to type-check the arguments passed to the function. It allows the compiler to type-check the arguments passed to the function.
See the GNU C documentation for details. See the GNU C documentation for details.