widora/openwrt_widora

gdate.c:2497:7: error: format not a string literal, format string not checked [-Werror=format-nonliteral]

time-river opened this issue · 2 comments

GCC version: 6.3, maybe it occurs when GCC version >= 6 .
So I suggest you add patch for pkg-config in tools directory.

My patch:

diff --git a/glib/glib/gdate.c b/glib/glib/gdate.c
index 1978cf7..9be9b97 100644
--- a/glib/glib/gdate.c
+++ b/glib/glib/gdate.c
@@ -2439,6 +2439,10 @@ 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 +2553,5 @@ g_date_strftime (gchar       *s,
   return retval;
 #endif
 }
+
+#pragma GCC diagnostic pop

Reference: Bug 95326 - pkg-config 0.29 compilation error after gcc update (5.3 -> 6.1)

The same error happens when building package/feeds/packages/glib2/.
There is a little difference, just change patch file path like the flowing:

/* orig */
--- a/glib/glib/gdate.c
+++ b/glib/glib/gdate.c

/* new */
--- a/glib/gdate.c
+++ b/glib/gdate.c