diff --git a/tests/child-test.c b/tests/child-test.c index 2fbc741d8..9ebc202b4 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 9d6a522a1..492b47e20 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 4bcb05f3f..f4a805e3c 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 9b95b0a2a..dd99b710f 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 fa513d10e..f142fbff8 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 f4031441d..202cfe78d 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 16844010a..93c01585e 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 eb7c16282..07420df18 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;