mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 15:36:17 +01:00
Merge branch 'wip/pwithnall/error-tests-nonliteral' into 'master'
tests: Ignore -Wformat-nonliteral warning in new GError tests See merge request GNOME/glib!1863
This commit is contained in:
commit
673c514e63
@ -100,6 +100,12 @@ static void
|
|||||||
test_new_valist_invalid_va (gpointer dummy,
|
test_new_valist_invalid_va (gpointer dummy,
|
||||||
...)
|
...)
|
||||||
{
|
{
|
||||||
|
#ifdef __linux__
|
||||||
|
/* Only worth testing this on Linux; if other platforms regress on this legacy
|
||||||
|
* behaviour, we don’t care. In particular, calling g_error_new_valist() with
|
||||||
|
* a %NULL format will crash on FreeBSD as its implementation of vasprintf()
|
||||||
|
* is less forgiving than Linux’s. That’s fine: it’s a programmer error in
|
||||||
|
* either case. */
|
||||||
const struct
|
const struct
|
||||||
{
|
{
|
||||||
GQuark domain;
|
GQuark domain;
|
||||||
@ -119,8 +125,13 @@ test_new_valist_invalid_va (gpointer dummy,
|
|||||||
GError *error = NULL, *error_copy = NULL;
|
GError *error = NULL, *error_copy = NULL;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
|
g_test_message ("Test %" G_GSIZE_FORMAT, i);
|
||||||
|
|
||||||
va_start (ap, dummy);
|
va_start (ap, dummy);
|
||||||
|
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||||
|
|
||||||
g_test_expect_message (G_LOG_DOMAIN,
|
g_test_expect_message (G_LOG_DOMAIN,
|
||||||
G_LOG_LEVEL_WARNING,
|
G_LOG_LEVEL_WARNING,
|
||||||
"*g_error_new_valist: runtime check failed*");
|
"*g_error_new_valist: runtime check failed*");
|
||||||
@ -128,6 +139,8 @@ test_new_valist_invalid_va (gpointer dummy,
|
|||||||
g_test_assert_expected_messages ();
|
g_test_assert_expected_messages ();
|
||||||
g_assert_nonnull (error);
|
g_assert_nonnull (error);
|
||||||
|
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
g_test_expect_message (G_LOG_DOMAIN,
|
g_test_expect_message (G_LOG_DOMAIN,
|
||||||
G_LOG_LEVEL_WARNING,
|
G_LOG_LEVEL_WARNING,
|
||||||
"*g_error_copy: runtime check failed*");
|
"*g_error_copy: runtime check failed*");
|
||||||
@ -140,6 +153,9 @@ test_new_valist_invalid_va (gpointer dummy,
|
|||||||
|
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
}
|
}
|
||||||
|
#else /* if !__linux__ */
|
||||||
|
g_test_skip ("g_error_new_valist() programmer error handling is only relevant on Linux");
|
||||||
|
#endif /* !__linux__ */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user