[glib] tests: Fix compilation errors due to Y2K format problems
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] tests: Fix compilation errors due to Y2K format problems
- Date: Mon, 4 Apr 2016 13:10:15 +0000 (UTC)
commit 35bd69202d56957a82251652498f139c4faff5e6
Author: Bastien Nocera <hadess hadess net>
Date: Mon Apr 4 11:13:13 2016 +0200
tests: Fix compilation errors due to Y2K format problems
Newer versions of GCC are particularly verbose in relation to
formatting errors, use GCC pragmas to disable warnings for this
section.
gdatetime.c: In function ‘test_strftime’:
gdatetime.c:1334:3: error: ‘%c’ yields only last 2 digits of year in some locales [-Werror=format-y2k]
"a%a A%A b%b B%B c%c C%C d%d e%e F%F g%g G%G h%h H%H I%I j%j m%m M%M " \
^
gdatetime.c:1334:3: note: in definition of macro ‘TEST_FORMAT’
"a%a A%A b%b B%B c%c C%C d%d e%e F%F g%g G%G h%h H%H I%I j%j m%m M%M " \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gdatetime.c:1334:3: error: ‘%g’ yields only last 2 digits of year [-Werror=format-y2k]
"a%a A%A b%b B%B c%c C%C d%d e%e F%F g%g G%G h%h H%H I%I j%j m%m M%M " \
^
gdatetime.c:1334:3: note: in definition of macro ‘TEST_FORMAT’
"a%a A%A b%b B%B c%c C%C d%d e%e F%F g%g G%G h%h H%H I%I j%j m%m M%M " \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gdatetime.c:1334:3: error: ‘%x’ yields only last 2 digits of year in some locales [-Werror=format-y2k]
"a%a A%A b%b B%B c%c C%C d%d e%e F%F g%g G%G h%h H%H I%I j%j m%m M%M " \
^
gdatetime.c:1334:3: note: in definition of macro ‘TEST_FORMAT’
"a%a A%A b%b B%B c%c C%C d%d e%e F%F g%g G%G h%h H%H I%I j%j m%m M%M " \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gdatetime.c:1334:3: error: ‘%y’ yields only last 2 digits of year [-Werror=format-y2k]
"a%a A%A b%b B%B c%c C%C d%d e%e F%F g%g G%G h%h H%H I%I j%j m%m M%M " \
^
gdatetime.c:1334:3: note: in definition of macro ‘TEST_FORMAT’
"a%a A%A b%b B%B c%c C%C d%d e%e F%F g%g G%G h%h H%H I%I j%j m%m M%M " \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Note that the pragma is outside the function as older versions of GCC
don't support pragma inside functions.
https://bugzilla.gnome.org/show_bug.cgi?id=764575
glib/tests/gdatetime.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/glib/tests/gdatetime.c b/glib/tests/gdatetime.c
index 16a163c..f6c3cf0 100644
--- a/glib/tests/gdatetime.c
+++ b/glib/tests/gdatetime.c
@@ -1326,6 +1326,8 @@ test_z (void)
g_time_zone_unref (tz);
}
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-y2k"
static void
test_strftime (void)
{
@@ -1351,6 +1353,7 @@ test_strftime (void)
}
#endif
}
+#pragma GCC diagnostic pop
static void
test_find_interval (void)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]