Merge branch '1177-quark-not-cxx-globals-docs' into 'master'

gquark: Document that some functions can’t initialise C++ globals

Closes #1177

See merge request GNOME/glib!714
This commit is contained in:
Matthias Clasen 2019-03-07 12:10:19 +00:00
commit 23a99f71cc

View File

@ -126,6 +126,9 @@ g_quark_init (void)
* If you want the GQuark to be created if it doesn't already exist, * If you want the GQuark to be created if it doesn't already exist,
* use g_quark_from_string() or g_quark_from_static_string(). * use g_quark_from_string() or g_quark_from_static_string().
* *
* This function must not be used before library constructors have finished
* running.
*
* Returns: the #GQuark associated with the string, or 0 if @string is * Returns: the #GQuark associated with the string, or 0 if @string is
* %NULL or there is no #GQuark associated with it * %NULL or there is no #GQuark associated with it
*/ */
@ -214,6 +217,10 @@ quark_from_string_locked (const gchar *string,
* not currently have an associated #GQuark, a new #GQuark is created, * not currently have an associated #GQuark, a new #GQuark is created,
* using a copy of the string. * using a copy of the string.
* *
* This function must not be used before library constructors have finished
* running. In particular, this means it cannot be used to initialize global
* variables in C++.
*
* Returns: the #GQuark identifying the string, or 0 if @string is %NULL * Returns: the #GQuark identifying the string, or 0 if @string is %NULL
*/ */
GQuark GQuark
@ -239,6 +246,10 @@ g_quark_from_string (const gchar *string)
* expect to ever unload the module again (e.g. do not use this * expect to ever unload the module again (e.g. do not use this
* function in GTK+ theme engines). * function in GTK+ theme engines).
* *
* This function must not be used before library constructors have finished
* running. In particular, this means it cannot be used to initialize global
* variables in C++.
*
* Returns: the #GQuark identifying the string, or 0 if @string is %NULL * Returns: the #GQuark identifying the string, or 0 if @string is %NULL
*/ */
GQuark GQuark
@ -325,6 +336,10 @@ quark_intern_string_locked (const gchar *string,
* can be compared for equality by comparing the pointers, instead of * can be compared for equality by comparing the pointers, instead of
* using strcmp(). * using strcmp().
* *
* This function must not be used before library constructors have finished
* running. In particular, this means it cannot be used to initialize global
* variables in C++.
*
* Returns: a canonical representation for the string * Returns: a canonical representation for the string
* *
* Since: 2.10 * Since: 2.10
@ -344,6 +359,10 @@ g_intern_string (const gchar *string)
* using strcmp(). g_intern_static_string() does not copy the string, * using strcmp(). g_intern_static_string() does not copy the string,
* therefore @string must not be freed or modified. * therefore @string must not be freed or modified.
* *
* This function must not be used before library constructors have finished
* running. In particular, this means it cannot be used to initialize global
* variables in C++.
*
* Returns: a canonical representation for the string * Returns: a canonical representation for the string
* *
* Since: 2.10 * Since: 2.10