Define G_GNUC_NULL_TERMINATED. (#164706, Marc Meissner)

2005-03-08  Matthias Clasen  <mclasen@redhat.com>

	* glib/gmacros.h: Define G_GNUC_NULL_TERMINATED.
	(#164706, Marc Meissner)

	* glib/gstrfuncs.h:
	* glib/gfileutils.h: Use G_GNUC_NULL_TERMINATED where
	appropriate.
This commit is contained in:
Matthias Clasen 2005-03-08 05:41:45 +00:00 committed by Matthias Clasen
parent 0fa2c2b366
commit 6aac5ce82c
12 changed files with 64 additions and 9 deletions

View File

@ -1,5 +1,12 @@
2005-03-08 Matthias Clasen <mclasen@redhat.com>
* glib/gmacros.h: Define G_GNUC_NULL_TERMINATED.
(#164706, Marc Meissner)
* glib/gstrfuncs.h:
* glib/gfileutils.h: Use G_GNUC_NULL_TERMINATED where
appropriate.
* glib/goption.c (parse_int): Fix an error message.
(#168751, Hazael Maldonado Torres)

View File

@ -1,5 +1,12 @@
2005-03-08 Matthias Clasen <mclasen@redhat.com>
* glib/gmacros.h: Define G_GNUC_NULL_TERMINATED.
(#164706, Marc Meissner)
* glib/gstrfuncs.h:
* glib/gfileutils.h: Use G_GNUC_NULL_TERMINATED where
appropriate.
* glib/goption.c (parse_int): Fix an error message.
(#168751, Hazael Maldonado Torres)

View File

@ -1,5 +1,12 @@
2005-03-08 Matthias Clasen <mclasen@redhat.com>
* glib/gmacros.h: Define G_GNUC_NULL_TERMINATED.
(#164706, Marc Meissner)
* glib/gstrfuncs.h:
* glib/gfileutils.h: Use G_GNUC_NULL_TERMINATED where
appropriate.
* glib/goption.c (parse_int): Fix an error message.
(#168751, Hazael Maldonado Torres)

View File

@ -1,5 +1,12 @@
2005-03-08 Matthias Clasen <mclasen@redhat.com>
* glib/gmacros.h: Define G_GNUC_NULL_TERMINATED.
(#164706, Marc Meissner)
* glib/gstrfuncs.h:
* glib/gfileutils.h: Use G_GNUC_NULL_TERMINATED where
appropriate.
* glib/goption.c (parse_int): Fix an error message.
(#168751, Hazael Maldonado Torres)

View File

@ -1,3 +1,8 @@
2005-03-08 Matthias Clasen <mclasen@redhat.com>
* glib/glib-sections.txt:
* glib/tmpl/macros_misc.sgml: Document G_GNUC_NULL_TERMINATED.
2005-03-07 Matthias Clasen <mclasen@redhat.com>
* gobject/tmpl/gtype.sgml:

View File

@ -322,6 +322,7 @@ G_GNUC_UNUSED
G_GNUC_PRINTF
G_GNUC_SCANF
G_GNUC_FORMAT
G_GNUC_NULL_TERMINATED
G_GNUC_FUNCTION
G_GNUC_PRETTY_FUNCTION
G_GNUC_NO_INSTRUMENT

View File

@ -227,6 +227,17 @@ gchar *g_dgettext (gchar *domain_name, gchar *msgid) G_GNUC_FORMAT (2);
@arg_idx: the index of the argument.
<!-- ##### MACRO G_GNUC_NULL_TERMINATED ##### -->
<para>
Expands to the GNU C <literal>sentinel</literal> function attribute if the
compiler is <command>gcc</command>, or "" if it isn't. This function attribute
only applies to variadic functions and instructs the compiler to check that
the argument list is terminated with an explicit %NULL.
See the GNU C documentation for details.
</para>
Since: 2.8
<!-- ##### MACRO G_GNUC_FUNCTION ##### -->
<para>
Expands to the GNU C <literal>__FUNCTION__</literal> variable if the

View File

@ -99,9 +99,9 @@ gint g_file_open_tmp (const gchar *tmpl,
gchar *g_build_path (const gchar *separator,
const gchar *first_element,
...);
...) G_GNUC_NULL_TERMINATED;
gchar *g_build_filename (const gchar *first_element,
...);
...) G_GNUC_NULL_TERMINATED;
G_END_DECLS

View File

@ -57,6 +57,12 @@
#define G_GNUC_MALLOC
#endif
#if __GNUC__ >= 4
#define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__))
#else
#define G_GNUC_NULL_TERMINATED
#endif
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
#define G_GNUC_PRINTF( format_idx, arg_idx ) \
__attribute__((__format__ (__printf__, format_idx, arg_idx)))

View File

@ -189,9 +189,10 @@ gchar* g_strndup (const gchar *str,
gchar* g_strnfill (gsize length,
gchar fill_char) G_GNUC_MALLOC;
gchar* g_strconcat (const gchar *string1,
...) G_GNUC_MALLOC; /* NULL terminated */
...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED;
gchar* g_strjoin (const gchar *separator,
...) G_GNUC_MALLOC; /* NULL terminated */
...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED;
/* Make a copy of a string interpreting C string -style escape
* sequences. Inverse of g_strescape. The recognized sequences are \b
* \f \n \r \t \\ \" and the octal format.

View File

@ -1,5 +1,8 @@
2005-03-08 Matthias Clasen <mclasen@redhat.com>
* gobject.h: Use G_GNUC_NULL_TERMINATED where
appropriate. (#164706, Marc Meissner)
* gvaluearray.h: Small cleanup (use G_BEGIN/END_DECLS).
(#168474, Fabricio Barros Cabral)

View File

@ -131,7 +131,7 @@ GParamSpec**g_object_interface_list_properties (gpointer g_iface,
gpointer g_object_new (GType object_type,
const gchar *first_property_name,
...);
...) G_GNUC_NULL_TERMINATED;
gpointer g_object_newv (GType object_type,
guint n_parameters,
GParameter *parameters);
@ -140,16 +140,16 @@ GObject* g_object_new_valist (GType object_type,
va_list var_args);
void g_object_set (gpointer object,
const gchar *first_property_name,
...);
...) G_GNUC_NULL_TERMINATED;
void g_object_get (gpointer object,
const gchar *first_property_name,
...);
...) G_GNUC_NULL_TERMINATED;
gpointer g_object_connect (gpointer object,
const gchar *signal_spec,
...);
...) G_GNUC_NULL_TERMINATED;
void g_object_disconnect (gpointer object,
const gchar *signal_spec,
...);
...) G_GNUC_NULL_TERMINATED;
void g_object_set_valist (GObject *object,
const gchar *first_property_name,
va_list var_args);