--- glib/gmacros.h	2007/08/11 18:00:25	1.1
+++ glib/gmacros.h	2007/08/11 18:10:30
@@ -57,6 +57,14 @@
 #define G_GNUC_MALLOC
 #endif
 
+/* Requested at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32911
+ */
+#if 0
+#define G_GNUC_IDEMPOTENT __attribute__((idempotent))
+#else
+#define G_GNUC_IDEMPOTENT
+#endif
+
 #if     __GNUC__ >= 4
 #define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__))
 #else
--- docs/reference/glib/tmpl/macros_misc.sgml	2007/08/11 18:18:35	1.1
+++ docs/reference/glib/tmpl/macros_misc.sgml	2007/08/11 18:28:36
@@ -139,6 +139,23 @@ See the GNU C documentation for details.
 
 
 
+<!-- ##### MACRO G_GNUC_IDEMPOTENT ##### -->
+<para>
+Expands to the GNU C <literal>idempotent</literal> function attribute if the
+compiler is <command>gcc</command>. Declaring a function as idempotent enables
+better optimization of calls to the function. An idempotent function may have
+side effects and access global variables on its first invocation, but subsequent
+invocations (with the same parameters) return the same value and have no side
+effects. Examples of idempotent functions include g_type_init() as well as any
+#GType get_type function.
+</para>
+<note><para>
+This attribute has not yet been added to gcc.
+</para></note>
+
+@Since: 2.16
+
+
 <!-- ##### MACRO G_GNUC_MALLOC ##### -->
 <para>
 Expands to the GNU C <literal>malloc</literal> function attribute if the compiler is 
--- ./tests/gobject/testmodule.h	2007/08/11 18:30:57	1.1
+++ ./tests/gobject/testmodule.h	2007/08/11 18:31:23
@@ -49,7 +49,7 @@ struct _TestModuleClass
   GTypeModuleClass parent_class;
 };
 
-GType        test_module_get_type      (void);
+GType        test_module_get_type      (void) G_GNUC_IDEMPOTENT;
 GTypeModule *test_module_new           (TestModuleRegisterFunc register_func);
 
 G_END_DECLS
--- ./gobject/gsourceclosure.h	2007/08/11 18:30:57	1.1
+++ ./gobject/gsourceclosure.h	2007/08/11 18:31:57
@@ -30,8 +30,8 @@ G_BEGIN_DECLS
 void g_source_set_closure (GSource  *source,
 			   GClosure *closure);
 
-GType g_io_channel_get_type   (void);
-GType g_io_condition_get_type (void);
+GType g_io_channel_get_type   (void) G_GNUC_IDEMPOTENT;
+GType g_io_condition_get_type (void) G_GNUC_IDEMPOTENT;
 
 #define G_TYPE_IO_CHANNEL (g_io_channel_get_type ())
 #define G_TYPE_IO_CONDITION (g_io_condition_get_type ())
--- ./gobject/gboxed.h	2007/08/11 18:30:57	1.1
+++ ./gobject/gboxed.h	2007/08/11 18:32:21
@@ -73,14 +73,14 @@ void    g_value_take_boxed      (GValue	
 void	g_value_set_boxed_take_ownership	(GValue		*value,
 						 gconstpointer	 v_boxed);
 #endif
-GType	g_closure_get_type	(void)	G_GNUC_CONST;
-GType	g_value_get_type	(void)	G_GNUC_CONST;
-GType	g_value_array_get_type	(void)	G_GNUC_CONST;
-GType	g_date_get_type	        (void)	G_GNUC_CONST;
-GType	g_strv_get_type	        (void)	G_GNUC_CONST;
-GType	g_gstring_get_type      (void)	G_GNUC_CONST;
-GType   g_hash_table_get_type   (void)  G_GNUC_CONST;
-GType   g_regex_get_type        (void)  G_GNUC_CONST;
+GType	g_closure_get_type	(void)	G_GNUC_IDEMPOTENT;
+GType	g_value_get_type	(void)	G_GNUC_IDEMPOTENT;
+GType	g_value_array_get_type	(void)	G_GNUC_IDEMPOTENT;
+GType	g_date_get_type	        (void)	G_GNUC_IDEMPOTENT;
+GType	g_strv_get_type	        (void)	G_GNUC_IDEMPOTENT;
+GType	g_gstring_get_type      (void)	G_GNUC_IDEMPOTENT;
+GType   g_hash_table_get_type   (void)  G_GNUC_IDEMPOTENT;
+GType   g_regex_get_type        (void)  G_GNUC_IDEMPOTENT;
 
 typedef gchar** GStrv;
      
--- ./gobject/gtypeplugin.h	2007/08/11 18:30:57	1.1
+++ ./gobject/gtypeplugin.h	2007/08/11 18:32:35
@@ -62,7 +62,7 @@ struct _GTypePluginClass
 
 
 /* --- prototypes --- */
-GType	g_type_plugin_get_type			(void)	G_GNUC_CONST;
+GType	g_type_plugin_get_type			(void)	G_GNUC_IDEMPOTENT;
 void	g_type_plugin_use			(GTypePlugin	 *plugin);
 void	g_type_plugin_unuse			(GTypePlugin	 *plugin);
 void	g_type_plugin_complete_type_info	(GTypePlugin     *plugin,
--- ./gobject/gobject.h	2007/08/11 18:30:57	1.1
+++ ./gobject/gobject.h	2007/08/11 18:32:47
@@ -125,7 +125,7 @@ struct _GObjectConstructParam
 
 
 /* --- prototypes --- */
-GType       g_initially_unowned_get_type      (void);
+GType       g_initially_unowned_get_type      (void) G_GNUC_IDEMPOTENT;
 void        g_object_class_install_property   (GObjectClass   *oclass,
 					       guint           property_id,
 					       GParamSpec     *pspec);
--- ./gobject/gtypemodule.h	2007/08/11 18:30:57	1.1
+++ ./gobject/gtypemodule.h	2007/08/11 18:33:05
@@ -107,7 +107,7 @@ type_name##_register_type (GTypeModule *
 }
 
 
-GType    g_type_module_get_type       (void) G_GNUC_CONST;
+GType    g_type_module_get_type       (void) G_GNUC_IDEMPOTENT;
 gboolean g_type_module_use            (GTypeModule          *module);
 void     g_type_module_unuse          (GTypeModule          *module);
 void     g_type_module_set_name       (GTypeModule          *module,
--- ./gobject/gvaluetypes.h	2007/08/11 18:30:57	1.1
+++ ./gobject/gvaluetypes.h	2007/08/11 18:34:12
@@ -90,7 +90,7 @@ gchar*		      g_value_dup_string	(const 
 void		      g_value_set_pointer	(GValue	      *value,
 						 gpointer      v_pointer);
 gpointer	      g_value_get_pointer	(const GValue *value);
-GType		      g_gtype_get_type		(void);
+GType		      g_gtype_get_type		(void) G_GNUC_IDEMPOTENT;
 void		      g_value_set_gtype	        (GValue	      *value,
 						 GType         v_gtype);
 GType	              g_value_get_gtype	        (const GValue *value);
--- gobject/gobject.symbols	2007/08/11 18:36:12	1.1
+++ gobject/gobject.symbols	2007/08/11 18:37:22
@@ -16,14 +16,14 @@
 g_boxed_copy
 g_boxed_free
 g_boxed_type_register_static
-g_date_get_type G_GNUC_CONST
-g_gstring_get_type G_GNUC_CONST
-g_strv_get_type G_GNUC_CONST
-g_hash_table_get_type G_GNUC_CONST
-g_regex_get_type G_GNUC_CONST
-g_closure_get_type G_GNUC_CONST
-g_value_get_type G_GNUC_CONST
-g_value_array_get_type G_GNUC_CONST
+g_date_get_type G_GNUC_IDEMPOTENT
+g_gstring_get_type G_GNUC_IDEMPOTENT
+g_strv_get_type G_GNUC_IDEMPOTENT
+g_hash_table_get_type G_GNUC_IDEMPOTENT
+g_regex_get_type G_GNUC_IDEMPOTENT
+g_closure_get_type G_GNUC_IDEMPOTENT
+g_value_get_type G_GNUC_IDEMPOTENT
+g_value_array_get_type G_GNUC_IDEMPOTENT
 g_value_set_boxed
 g_value_take_boxed
 g_value_dup_boxed
@@ -102,8 +102,8 @@ g_value_get_flags
 
 #if IN_HEADER(__G_SOURCECLOSURE_H__)
 #if IN_FILE(__G_SOURCECLOSURE_C__)
-g_io_channel_get_type
-g_io_condition_get_type
+g_io_channel_get_type G_GNUC_IDEMPOTENT
+g_io_condition_get_type G_GNUC_IDEMPOTENT
 g_source_set_closure
 #endif
 #endif
@@ -113,7 +113,7 @@ g_source_set_closure
 g_cclosure_new_object
 g_cclosure_new_object_swap
 g_closure_new_object
-g_initially_unowned_get_type
+g_initially_unowned_get_type G_GNUC_IDEMPOTENT
 g_object_add_weak_pointer
 g_object_class_find_property
 g_object_class_install_property
@@ -268,7 +268,7 @@ g_value_get_uint
 g_value_get_uint64
 g_value_get_ulong
 g_value_take_string
-g_gtype_get_type
+g_gtype_get_type G_GNUC_IDEMPOTENT
 g_value_set_gtype
 g_value_get_gtype
 #endif
@@ -377,7 +377,7 @@ g_type_value_table_peek
 #if IN_HEADER(__G_TYPE_MODULE_H__)
 #if IN_FILE(__G_TYPE_MODULE_C__)
 g_type_module_add_interface
-g_type_module_get_type G_GNUC_CONST
+g_type_module_get_type G_GNUC_IDEMPOTENT
 g_type_module_register_enum
 g_type_module_register_flags
 g_type_module_register_type
@@ -406,7 +406,7 @@ g_value_array_sort_with_data
 #if IN_FILE(__G_TYPE_PLUGIN_C__)
 g_type_plugin_complete_interface_info
 g_type_plugin_complete_type_info
-g_type_plugin_get_type G_GNUC_CONST
+g_type_plugin_get_type G_GNUC_IDEMPOTENT
 g_type_plugin_unuse
 g_type_plugin_use
 #endif
