Define G_GNUC_NULL_TERMINATED. (#164706, Marc Meissner)
authorMatthias Clasen <mclasen@redhat.com>
Tue, 8 Mar 2005 05:41:45 +0000 (05:41 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Tue, 8 Mar 2005 05:41:45 +0000 (05:41 +0000)
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.

12 files changed:
ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-8
docs/reference/ChangeLog
docs/reference/glib/glib-sections.txt
docs/reference/glib/tmpl/macros_misc.sgml
glib/gfileutils.h
glib/gmacros.h
glib/gstrfuncs.h
gobject/ChangeLog
gobject/gobject.h

index e9c5d4d..5f0fc52 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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)
 
index e9c5d4d..5f0fc52 100644 (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)
 
index e9c5d4d..5f0fc52 100644 (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)
 
index e9c5d4d..5f0fc52 100644 (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)
 
index 34aaade..d6ed02f 100644 (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:
index a68bb2f..0d9e58d 100644 (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
index 2c57c77..eacb95d 100644 (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 
index cc3b494..94dcaea 100644 (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
 
index 10bae03..84e8e10 100644 (file)
 #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)))
index 7319cd9..9c41dca 100644 (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.
index 47aaf02..50eb694 100644 (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)
 
index 6522a00..f3935ca 100644 (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);