From ea0970e9ca2e875d47a5bb8982bcd42bcc4f76f6 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Fri, 26 Sep 2008 16:00:45 +0000 Subject: [PATCH] make this a "const gpointer" rather than a gconstpointer to avoid warnings * glib/gthreadpool.c (wakeup_thread_marker): make this a "const gpointer" rather than a gconstpointer to avoid warnings later * glib/pcre/pcre_ucp_searchfuncs.c: * glib/pcre/pcre_valid_utf8.c: #include "config.h" * glib/tests/printf.c (test_d): fool gcc into not warning about some printf format strings that we know are dubious svn path=/trunk/; revision=7552 --- ChangeLog | 11 +++++++++++ glib/gthreadpool.c | 2 +- glib/pcre/pcre_ucp_searchfuncs.c | 4 ++++ glib/pcre/pcre_valid_utf8.c | 1 + glib/tests/printf.c | 24 ++++++++++++++++-------- 5 files changed, 33 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 62a5cad..2534193 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2008-09-26 Dan Winship + + * glib/gthreadpool.c (wakeup_thread_marker): make this a "const + gpointer" rather than a gconstpointer to avoid warnings later + + * glib/pcre/pcre_ucp_searchfuncs.c: + * glib/pcre/pcre_valid_utf8.c: #include "config.h" + + * glib/tests/printf.c (test_d): fool gcc into not warning about + some printf format strings that we know are dubious + 2008-09-26 Matthias Clasen Bug 553857 – gbacktrace.h requires signal.h diff --git a/glib/gthreadpool.c b/glib/gthreadpool.c index ec50609..2059a99 100644 --- a/glib/gthreadpool.c +++ b/glib/gthreadpool.c @@ -51,7 +51,7 @@ struct _GRealThreadPool /* The following is just an address to mark the wakeup order for a * thread, it could be any address (as long, as it isn't a valid * GThreadPool address) */ -static gconstpointer const wakeup_thread_marker = (gconstpointer) &g_thread_pool_new; +static const gpointer wakeup_thread_marker = (gpointer) &g_thread_pool_new; static gint wakeup_thread_serial = 0; /* Here all unused threads are waiting */ diff --git a/glib/pcre/pcre_ucp_searchfuncs.c b/glib/pcre/pcre_ucp_searchfuncs.c index b95d279..77ec8d1 100644 --- a/glib/pcre/pcre_ucp_searchfuncs.c +++ b/glib/pcre/pcre_ucp_searchfuncs.c @@ -43,6 +43,10 @@ POSSIBILITY OF SUCH DAMAGE. /* This module contains code for searching the table of Unicode character properties. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "pcre_internal.h" #include "ucp.h" /* Category definitions */ diff --git a/glib/pcre/pcre_valid_utf8.c b/glib/pcre/pcre_valid_utf8.c index a5766b4..b7671a9 100644 --- a/glib/pcre/pcre_valid_utf8.c +++ b/glib/pcre/pcre_valid_utf8.c @@ -1,3 +1,4 @@ +#include "config.h" #include "pcre_internal.h" /* diff --git a/glib/tests/printf.c b/glib/tests/printf.c index f15ace0..ff8eee2 100644 --- a/glib/tests/printf.c +++ b/glib/tests/printf.c @@ -69,6 +69,7 @@ test_d (void) { gchar buf[128]; gint res; + const gchar *fmt; /* %d basic formatting */ @@ -172,21 +173,28 @@ test_d (void) g_assert_cmpint (res, ==, 1); g_assert_cmpstr (buf, ==, " "); - res = g_snprintf (buf, 128, "% +d", 5); - g_assert_cmpint (res, ==, 2); - g_assert_cmpstr (buf, ==, "+5"); - res = g_snprintf (buf, 128, "%03d", 5); g_assert_cmpint (res, ==, 3); g_assert_cmpstr (buf, ==, "005"); - res = g_snprintf (buf, 128, "%-03d", -5); - g_assert_cmpint (res, ==, 3); - g_assert_cmpstr (buf, ==, "-5 "); - res = g_snprintf (buf, 128, "%03d", -5); g_assert_cmpint (res, ==, 3); g_assert_cmpstr (buf, ==, "-05"); + + /* gcc emits warnings for the following formats, since the C spec + * says some of the flags must be ignored. (The " " in "% +d" and + * the "0" in "%-03d".) But we need to test that our printf gets + * those rules right. So we fool gcc into not warning. + */ + fmt = "% +d"; + res = g_snprintf (buf, 128, fmt, 5); + g_assert_cmpint (res, ==, 2); + g_assert_cmpstr (buf, ==, "+5"); + + fmt = "%-03d"; + res = g_snprintf (buf, 128, fmt, -5); + g_assert_cmpint (res, ==, 3); + g_assert_cmpstr (buf, ==, "-5 "); } static void -- 2.7.4