mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-15 16:56:14 +01:00
Merge branch 'fix-refcount-macro-non-gcc' into 'master'
glib/tests/refcount.c: Fix tests on non-GCC-isque compilers See merge request GNOME/glib!919
This commit is contained in:
commit
8c990d9889
@ -76,7 +76,8 @@ test_grefcount (void)
|
|||||||
|
|
||||||
/* test_grefcount_saturation: Saturating a grefcount counter
|
/* test_grefcount_saturation: Saturating a grefcount counter
|
||||||
* does not cause an overflow; additionally, if we're building
|
* does not cause an overflow; additionally, if we're building
|
||||||
* with checks enabled, it'll cause a warning
|
* with checks enabled or with non-GCC compilers, it'll cause a
|
||||||
|
* warning
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
test_grefcount_saturation (void)
|
test_grefcount_saturation (void)
|
||||||
@ -99,16 +100,16 @@ test_grefcount_saturation (void)
|
|||||||
|
|
||||||
g_test_trap_subprocess (NULL, 0, 0);
|
g_test_trap_subprocess (NULL, 0, 0);
|
||||||
|
|
||||||
#ifndef G_DISABLE_CHECKS
|
#if defined (G_DISABLE_CHECKS) && defined (__GNUC__)
|
||||||
/* Ensure that we got a warning when building with checks; the
|
/* With checks disabled we don't get any warning */
|
||||||
* test will fail because of the critical warning being caught
|
g_test_trap_assert_passed ();
|
||||||
* by GTest
|
#else
|
||||||
|
/* Ensure that we got a warning when building with checks or with
|
||||||
|
* non-GCC compilers; the test will fail because of the critical
|
||||||
|
* warning being caught by GTest
|
||||||
*/
|
*/
|
||||||
g_test_trap_assert_failed ();
|
g_test_trap_assert_failed ();
|
||||||
g_test_trap_assert_stderr ("*saturation*");
|
g_test_trap_assert_stderr ("*saturation*");
|
||||||
#else
|
|
||||||
/* With checks disabled we don't get any warning */
|
|
||||||
g_test_trap_assert_passed ();
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,9 +168,9 @@ test_gatomicrefcount (void)
|
|||||||
g_assert_true (g_atomic_ref_count_dec (&a));
|
g_assert_true (g_atomic_ref_count_dec (&a));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* test_grefcount_saturation: Saturating a gatomicrefcount counter
|
/* test_gatomicrefcount_saturation: Saturating a gatomicrefcount counter
|
||||||
* does not cause an overflow; additionally, if we're building
|
* does not cause an overflow; additionally, if we're building with
|
||||||
* with checks enabled, it'll cause a warning
|
* checks enabled or with non-GCC compilers, it'll cause a warning
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
test_gatomicrefcount_saturation (void)
|
test_gatomicrefcount_saturation (void)
|
||||||
@ -192,16 +193,16 @@ test_gatomicrefcount_saturation (void)
|
|||||||
|
|
||||||
g_test_trap_subprocess (NULL, 0, 0);
|
g_test_trap_subprocess (NULL, 0, 0);
|
||||||
|
|
||||||
#ifndef G_DISABLE_CHECKS
|
#if defined (G_DISABLE_CHECKS) && defined (__GNUC__)
|
||||||
/* Ensure that we got a warning when building with checks; the
|
/* With checks disabled we don't get any warning */
|
||||||
* test will fail because of the critical warning being caught
|
g_test_trap_assert_passed ();
|
||||||
* by GTest
|
#else
|
||||||
|
/* Ensure that we got a warning when building with checks or with
|
||||||
|
* non-GCC compilers; the test will fail because of the critical
|
||||||
|
* warning being caught by GTest
|
||||||
*/
|
*/
|
||||||
g_test_trap_assert_failed ();
|
g_test_trap_assert_failed ();
|
||||||
g_test_trap_assert_stderr ("*saturation*");
|
g_test_trap_assert_stderr ("*saturation*");
|
||||||
#else
|
|
||||||
/* With checks disabled we don't get any warning */
|
|
||||||
g_test_trap_assert_passed ();
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user