As detailed in
gitlab.gnome.org/GNOME/glib/-/issues/600#note_877282, volatile
isn't actually needed in these contexts because the atomic operations
already give us strong enough guarantees. In GCC 11, this triggers a
diagnostic due to the volatile qualifier getting dropped anyway.
There is a WIP to do the same in glib:
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719
This obsoletes this downstream patch:
https://src.fedoraproject.org/rpms/ostree/c/
b8c5a6fb
typedef struct _OstreeDiffItem OstreeDiffItem;
struct _OstreeDiffItem
{
- volatile gint refcount;
+ gint refcount; /* atomic */
GFile *src;
GFile *target;
GType
_@enum_name@_get_type (void)
{
- static volatile gsize the_type__volatile = 0;
+ static gsize static_the_type = 0;
- if (g_once_init_enter (&the_type__volatile))
+ if (g_once_init_enter (&static_the_type))
{
static const G@Type@Value values[] = {
/*** END value-header ***/
g_intern_static_string ("@EnumName@"),
values);
- g_once_init_leave (&the_type__volatile, the_type);
+ g_once_init_leave (&static_the_type, the_type);
}
- return the_type__volatile;
+ return static_the_type;
}
/*** END value-tail ***/
} OstreeFetcherState;
typedef struct {
- volatile int ref_count;
+ int ref_count; /* atomic */
SoupSession *session; /* not referenced */
GMainContext *main_context;
} ThreadClosure;
typedef struct {
- volatile int ref_count;
+ int ref_count; /* atomic */
ThreadClosure *thread_closure;
GPtrArray *mirrorlist; /* list of base URIs */
* remote which this one inherits from, and is what should be used in refspecs
* for pulls from this remote. If it’s %NULL, @name should be used instead. */
struct OstreeRemote {
- volatile int ref_count;
+ int ref_count; /* atomic */
char *name; /* (not nullable) */
char *refspec_name; /* (nullable) */
char *group; /* group name in options (not nullable) */
} OstreeRepoTestErrorFlags;
struct OstreeRepoCommitModifier {
- volatile gint refcount;
+ gint refcount; /* atomic */
OstreeRepoCommitModifierFlags flags;
OstreeRepoCommitFilter filter;
GType
ostree_sysroot_upgrader_flags_get_type (void)
{
- static volatile gsize g_define_type_id__volatile = 0;
+ static gsize static_g_define_type_id = 0;
- if (g_once_init_enter (&g_define_type_id__volatile))
+ if (g_once_init_enter (&static_g_define_type_id))
{
static const GFlagsValue values[] = {
{ OSTREE_SYSROOT_UPGRADER_FLAGS_IGNORE_UNCONFIGURED, "OSTREE_SYSROOT_UPGRADER_FLAGS_IGNORE_UNCONFIGURED", "ignore-unconfigured" },
};
GType g_define_type_id =
g_flags_register_static (g_intern_static_string ("OstreeSysrootUpgraderFlags"), values);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
+ g_once_init_leave (&static_g_define_type_id, g_define_type_id);
}
- return g_define_type_id__volatile;
+ return static_g_define_type_id;
}