summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Nicholson <dbn.lists@gmail.com>2017-03-20 06:01:57 -0500
committerDan Nicholson <dbn.lists@gmail.com>2017-03-20 06:01:57 -0500
commit64cbed988423449dd9f687b3658695a404d4085c (patch)
tree2521094f92bda032df65b841e85be157fb160208
parent325ddf2f4b19a9084dedd3d458f7d02f5b854dec (diff)
glib: Fix bundled build with GCC 6
Backport two patches from upstream glib to handle -Wformat-nonliteral included by default with GCC 6. Ideally the snapshot should be updated, but this fix the issue until that happens. https://bugs.freedesktop.org/show_bug.cgi?id=95326
-rw-r--r--glib-patches/gcc-format-nonliteral-1.patch29
-rw-r--r--glib-patches/gcc-format-nonliteral-2.patch47
-rw-r--r--glib-patches/patchlist5
-rw-r--r--glib/glib/gdate.c5
4 files changed, 86 insertions, 0 deletions
diff --git a/glib-patches/gcc-format-nonliteral-1.patch b/glib-patches/gcc-format-nonliteral-1.patch
new file mode 100644
index 0000000..a092882
--- /dev/null
+++ b/glib-patches/gcc-format-nonliteral-1.patch
@@ -0,0 +1,29 @@
+From 0817af40e8c74c721c30f6ef482b1f53d12044c7 Mon Sep 17 00:00:00 2001
+From: coypu <coypu@sdf.org>
+Date: Mon, 8 Feb 2016 00:06:06 +0200
+Subject: gdate: Suppress string format literal warning
+
+Newer versions of GCC emit an error here, but we know it's safe.
+https://bugzilla.gnome.org/761550
+---
+ glib/gdate.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/glib/gdate.c b/glib/gdate.c
+index 4aece02..cdc735c 100644
+--- a/glib/gdate.c
++++ b/glib/gdate.c
+@@ -2494,7 +2494,10 @@ g_date_strftime (gchar *s,
+ * recognize whether strftime actually failed or just returned "".
+ */
+ tmpbuf[0] = '\1';
++ #pragma GCC diagnostic push
++ #pragma GCC diagnostic ignored "-Wformat-nonliteral"
+ tmplen = strftime (tmpbuf, tmpbufsize, locale_format, &tm);
++ #pragma GCC diagnostic pop
+
+ if (tmplen == 0 && tmpbuf[0] != '\0')
+ {
+--
+cgit v0.12
+
diff --git a/glib-patches/gcc-format-nonliteral-2.patch b/glib-patches/gcc-format-nonliteral-2.patch
new file mode 100644
index 0000000..c5577b1
--- /dev/null
+++ b/glib-patches/gcc-format-nonliteral-2.patch
@@ -0,0 +1,47 @@
+From 8cdbc7fb2c8c876902e457abe46ee18a0b134486 Mon Sep 17 00:00:00 2001
+From: coypu <coypu@sdf.org>
+Date: Wed, 2 Mar 2016 19:38:48 +0200
+Subject: gdate: Move warning pragma outside of function
+
+Commit 0817af40e8c74c721c30f6ef482b1f53d12044c7 breaks the build on
+older versions of GCC, which don't allow pragma inside functions.
+
+https://bugzilla.gnome.org/761550
+---
+ glib/gdate.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/glib/gdate.c b/glib/gdate.c
+index cdc735c..92c34d2 100644
+--- a/glib/gdate.c
++++ b/glib/gdate.c
+@@ -2439,6 +2439,9 @@ win32_strftime_helper (const GDate *d,
+ *
+ * Returns: number of characters written to the buffer, or 0 the buffer was too small
+ */
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wformat-nonliteral"
++
+ gsize
+ g_date_strftime (gchar *s,
+ gsize slen,
+@@ -2494,10 +2497,7 @@ g_date_strftime (gchar *s,
+ * recognize whether strftime actually failed or just returned "".
+ */
+ tmpbuf[0] = '\1';
+- #pragma GCC diagnostic push
+- #pragma GCC diagnostic ignored "-Wformat-nonliteral"
+ tmplen = strftime (tmpbuf, tmpbufsize, locale_format, &tm);
+- #pragma GCC diagnostic pop
+
+ if (tmplen == 0 && tmpbuf[0] != '\0')
+ {
+@@ -2552,3 +2552,5 @@ g_date_strftime (gchar *s,
+ return retval;
+ #endif
+ }
++
++#pragma GCC diagnostic pop
+--
+cgit v0.12
+
diff --git a/glib-patches/patchlist b/glib-patches/patchlist
index e186f38..754ebb1 100644
--- a/glib-patches/patchlist
+++ b/glib-patches/patchlist
@@ -1,3 +1,4 @@
+# pkg-config specific
glib-only.patch
no-installed-files.patch
foreign-automake.patch
@@ -8,3 +9,7 @@ cross-compiling.patch
static-only.patch
win32-static-init.patch
osx-static-framework.patch
+
+# Upstream backports
+gcc-format-nonliteral-1.patch
+gcc-format-nonliteral-2.patch
diff --git a/glib/glib/gdate.c b/glib/glib/gdate.c
index 1978cf7..20e6c4a 100644
--- a/glib/glib/gdate.c
+++ b/glib/glib/gdate.c
@@ -2439,6 +2439,9 @@ win32_strftime_helper (const GDate *d,
*
* Returns: number of characters written to the buffer, or 0 the buffer was too small
*/
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+
gsize
g_date_strftime (gchar *s,
gsize slen,
@@ -2549,3 +2552,5 @@ g_date_strftime (gchar *s,
return retval;
#endif
}
+
+#pragma GCC diagnostic pop