tests: Ignore warning about use of volatile from a test for exactly that

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #2418
This commit is contained in:
Philip Withnall 2021-06-03 13:44:15 +01:00
parent 04739eb4fd
commit 91759dbd63

View File

@ -97,9 +97,12 @@ test_types (void)
/* Note that atomic variables should almost certainly not be marked as
* `volatile` see http://isvolatileusefulwiththreads.in/c/. This test exists
* to make sure that we dont warn when built against older third party code. */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wincompatible-pointer-types"
g_atomic_pointer_set (&vp_str_vol, NULL);
res = g_atomic_pointer_compare_and_exchange (&vp_str_vol, NULL, str);
g_assert_true (res);
#pragma GCC diagnostic pop
g_atomic_pointer_set (&ip, 0);
ip2 = g_atomic_pointer_get (&ip);