Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 1 | From 9474655eb21d64519b293e780bb686976cbdb790 Mon Sep 17 00:00:00 2001 |
| 2 | From: Philip Withnall <pwithnall@endlessos.org> |
| 3 | Date: Wed, 11 Nov 2020 18:38:36 +0000 |
| 4 | Subject: [PATCH 14/29] gatomic: Drop unnecessary volatile qualifiers from |
| 5 | macro variables |
| 6 | MIME-Version: 1.0 |
| 7 | Content-Type: text/plain; charset=UTF-8 |
| 8 | Content-Transfer-Encoding: 8bit |
| 9 | |
| 10 | It’s not necessary and provides no thread safety guarantees. |
| 11 | |
| 12 | The `volatile` qualifiers on the function arguments have to be kept, as |
| 13 | they are (unfortunately) part of the API. |
| 14 | |
| 15 | Signed-off-by: Philip Withnall <pwithnall@endlessos.org> |
| 16 | |
| 17 | Helps: #600 |
| 18 | Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719] |
| 19 | --- |
| 20 | glib/gatomic.h | 6 +++--- |
| 21 | 1 file changed, 3 insertions(+), 3 deletions(-) |
| 22 | |
| 23 | diff --git a/glib/gatomic.h b/glib/gatomic.h |
| 24 | index bb1435c70..e6eccfada 100644 |
| 25 | --- a/glib/gatomic.h |
| 26 | +++ b/glib/gatomic.h |
| 27 | @@ -211,7 +211,7 @@ G_END_DECLS |
| 28 | })) |
| 29 | #define g_atomic_pointer_and(atomic, val) \ |
| 30 | (G_GNUC_EXTENSION ({ \ |
| 31 | - volatile gsize *gapa_atomic = (volatile gsize *) (atomic); \ |
| 32 | + gsize *gapa_atomic = (gsize *) (atomic); \ |
| 33 | G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ |
| 34 | G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gsize)); \ |
| 35 | (void) (0 ? (gpointer) *(atomic) : NULL); \ |
| 36 | @@ -220,7 +220,7 @@ G_END_DECLS |
| 37 | })) |
| 38 | #define g_atomic_pointer_or(atomic, val) \ |
| 39 | (G_GNUC_EXTENSION ({ \ |
| 40 | - volatile gsize *gapo_atomic = (volatile gsize *) (atomic); \ |
| 41 | + gsize *gapo_atomic = (gsize *) (atomic); \ |
| 42 | G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ |
| 43 | G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gsize)); \ |
| 44 | (void) (0 ? (gpointer) *(atomic) : NULL); \ |
| 45 | @@ -229,7 +229,7 @@ G_END_DECLS |
| 46 | })) |
| 47 | #define g_atomic_pointer_xor(atomic, val) \ |
| 48 | (G_GNUC_EXTENSION ({ \ |
| 49 | - volatile gsize *gapx_atomic = (volatile gsize *) (atomic); \ |
| 50 | + gsize *gapx_atomic = (gsize *) (atomic); \ |
| 51 | G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ |
| 52 | G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gsize)); \ |
| 53 | (void) (0 ? (gpointer) *(atomic) : NULL); \ |
| 54 | -- |
| 55 | 2.30.1 |
| 56 | |