[glib] Fix more warning-addition fallout
- From: Simon McVittie <smcv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Fix more warning-addition fallout
- Date: Fri, 2 Nov 2012 16:27:55 +0000 (UTC)
commit 837db1a026a451f2785be18593bf3fa631acabd6
Author: Simon McVittie <simon mcvittie collabora co uk>
Date: Fri Nov 2 15:45:14 2012 +0000
Fix more warning-addition fallout
I'm normally a big fan of small atomic commits, but I also want to get
things done this afternoon...
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=687441
Reviewed-by: Colin Walters <walters verbum org>
tests/child-test.c | 4 ++--
tests/iochannel-test.c | 2 +-
tests/mainloop-test.c | 18 +++++++++---------
tests/module-test.c | 2 ++
tests/onceinit.c | 6 ++++--
tests/slice-concurrent.c | 17 +++++++++++------
tests/thread-test.c | 6 +++---
tests/threadpool-test.c | 2 +-
8 files changed, 33 insertions(+), 24 deletions(-)
---
diff --git a/tests/child-test.c b/tests/child-test.c
index 2fbc741..9ebc202 100644
--- a/tests/child-test.c
+++ b/tests/child-test.c
@@ -51,7 +51,7 @@ gint alive;
char *argv0;
#endif
-GPid
+static GPid
get_a_child (gint ttl)
{
GPid pid;
@@ -89,7 +89,7 @@ get_a_child (gint ttl)
#endif /* G_OS_WIN32 */
}
-gboolean
+static gboolean
child_watch_callback (GPid pid, gint status, gpointer data)
{
#ifdef VERBOSE
diff --git a/tests/iochannel-test.c b/tests/iochannel-test.c
index 9d6a522..492b47e 100644
--- a/tests/iochannel-test.c
+++ b/tests/iochannel-test.c
@@ -15,7 +15,7 @@ static void
test_small_writes (void)
{
GIOChannel *io;
- GIOStatus status;
+ GIOStatus status = G_IO_STATUS_ERROR;
guint cnt;
gchar tmp;
GError *error = NULL;
diff --git a/tests/mainloop-test.c b/tests/mainloop-test.c
index 4bcb05f..f4a805e 100644
--- a/tests/mainloop-test.c
+++ b/tests/mainloop-test.c
@@ -54,7 +54,7 @@ struct _TestData
static void cleanup_crawlers (GMainContext *context);
-gboolean
+static gboolean
read_all (GIOChannel *channel, char *buf, gsize len)
{
gsize bytes_read = 0;
@@ -78,7 +78,7 @@ read_all (GIOChannel *channel, char *buf, gsize len)
return TRUE;
}
-gboolean
+static gboolean
write_all (GIOChannel *channel, char *buf, gsize len)
{
gsize bytes_written = 0;
@@ -97,7 +97,7 @@ write_all (GIOChannel *channel, char *buf, gsize len)
return TRUE;
}
-gboolean
+static gboolean
adder_callback (GIOChannel *source,
GIOCondition condition,
gpointer data)
@@ -122,7 +122,7 @@ adder_callback (GIOChannel *source,
return TRUE;
}
-gboolean
+static gboolean
timeout_callback (gpointer data)
{
AddrData *addr_data = data;
@@ -132,7 +132,7 @@ timeout_callback (gpointer data)
return TRUE;
}
-gpointer
+static gpointer
adder_thread (gpointer data)
{
GMainContext *context;
@@ -194,7 +194,7 @@ adder_thread (gpointer data)
return NULL;
}
-void
+static void
io_pipe (GIOChannel **channels)
{
gint fds[2];
@@ -212,7 +212,7 @@ io_pipe (GIOChannel **channels)
g_io_channel_set_close_on_unref (channels[1], TRUE);
}
-void
+static void
do_add (GIOChannel *in, gint a, gint b)
{
char buf1[32];
@@ -225,7 +225,7 @@ do_add (GIOChannel *in, gint a, gint b)
write_all (in, buf2, 32);
}
-gboolean
+static gboolean
adder_response (GIOChannel *source,
GIOCondition condition,
gpointer data)
@@ -261,7 +261,7 @@ adder_response (GIOChannel *source,
return TRUE;
}
-void
+static void
create_adder_thread (void)
{
GError *err = NULL;
diff --git a/tests/module-test.c b/tests/module-test.c
index 9b95b0a..dd99b71 100644
--- a/tests/module-test.c
+++ b/tests/module-test.c
@@ -32,6 +32,8 @@
gchar* global_state;
+G_MODULE_EXPORT void g_clash_func (void);
+
G_MODULE_EXPORT void
g_clash_func (void)
{
diff --git a/tests/onceinit.c b/tests/onceinit.c
index fa513d1..f142fbf 100644
--- a/tests/onceinit.c
+++ b/tests/onceinit.c
@@ -112,13 +112,15 @@ int
main (int argc,
char *argv[])
{
- GThread *threads[N_THREADS];
+ G_GNUC_UNUSED GThread *threads[N_THREADS];
int i;
+ void *p;
+
/* test simple initializer */
initializer1();
initializer1();
/* test pointer initializer */
- void *p = initializer2();
+ p = initializer2();
g_assert (p == &dummy_value);
p = initializer2();
g_assert (p == &dummy_value);
diff --git a/tests/slice-concurrent.c b/tests/slice-concurrent.c
index f403144..202cfe7 100644
--- a/tests/slice-concurrent.c
+++ b/tests/slice-concurrent.c
@@ -37,7 +37,7 @@ struct ThreadData
int n_freed;
} tdata[N_THREADS];
-void*
+static void *
thread_func (void *arg)
{
struct ThreadData *td = arg;
@@ -45,18 +45,23 @@ thread_func (void *arg)
/* g_print ("Thread %d starting\n", td->thread_id); */
for (i = 0; i < N_ALLOCS; i++)
{
+ int bytes;
+ char *mem;
+ int f;
+ int t;
+
if (rand() % (N_ALLOCS / 20) == 0)
g_print ("%c", 'a' - 1 + td->thread_id);
/* allocate block of random size and randomly fill */
- int bytes = rand() % MAX_BLOCK_SIZE + 1;
- char *mem = g_slice_alloc (bytes);
- int f;
+ bytes = rand() % MAX_BLOCK_SIZE + 1;
+ mem = g_slice_alloc (bytes);
+
for (f = 0; f < bytes; f++)
mem[f] = rand();
/* associate block with random thread */
- int t = rand() % N_THREADS;
+ t = rand() % N_THREADS;
g_mutex_lock (&tdata[t].to_free_mutex);
tdata[t].to_free[tdata[t].n_to_free] = mem;
tdata[t].bytes_to_free[tdata[t].n_to_free] = bytes;
@@ -87,7 +92,7 @@ thread_func (void *arg)
}
int
-main()
+main (void)
{
int t;
diff --git a/tests/thread-test.c b/tests/thread-test.c
index 1684401..93c0158 100644
--- a/tests/thread-test.c
+++ b/tests/thread-test.c
@@ -277,7 +277,7 @@ test_g_static_rw_lock_thread (gpointer data)
}
static void
-test_g_static_rw_lock ()
+test_g_static_rw_lock (void)
{
GThread *threads[THREADS];
guint i;
@@ -368,8 +368,8 @@ test_g_thread_once (void)
}
/* run all the tests */
-void
-run_all_tests()
+static void
+run_all_tests (void)
{
test_g_mutex ();
test_g_static_rec_mutex ();
diff --git a/tests/threadpool-test.c b/tests/threadpool-test.c
index eb7c162..07420df 100644
--- a/tests/threadpool-test.c
+++ b/tests/threadpool-test.c
@@ -332,7 +332,7 @@ test_thread_idle_timeout (gpointer data)
}
static void
-test_thread_idle_time ()
+test_thread_idle_time (void)
{
guint limit = 50;
guint interval = 10000;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]