qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Fix the glib deprecated APIs
@ 2013-01-11 16:10 Ramesh G
  2013-01-11 16:58 ` Peter Maydell
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ramesh G @ 2013-01-11 16:10 UTC (permalink / raw)
  To: stefanha; +Cc: qemu-devel


[-- Attachment #1.1: Type: text/plain, Size: 1008 bytes --]

Hi,

I got a couple of below compilation errors while compiling with glib >
2.32.

$ make
  CC    ../trace/simple.o
../trace/simple.c: In function ‘trace_thread_create’:
../trace/simple.c:407:5: error: ‘g_thread_create’ is deprecated (declared
at /usr/include/glib-2.0/glib/deprecated/gthread.h:100): Use 'g_thread_new'
instead [-Werror=deprecated-declarations]
../trace/simple.c: In function ‘trace_backend_init’:
../trace/simple.c:428:5: error: ‘g_cond_new’ is deprecated (declared at
/usr/include/glib-2.0/glib/deprecated/gthread.h:275)
[-Werror=deprecated-declarations]
../trace/simple.c:429:5: error: ‘g_cond_new’ is deprecated (declared at
/usr/include/glib-2.0/glib/deprecated/gthread.h:275)
[-Werror=deprecated-declarations]
cc1: all warnings being treated as errors
make: *** [../trace/simple.o] Error 1
$

I found these APIs have been deprecated in 2.32.  Please find the patch
attached which fixes this problem.  Please let me know your thoughts.

Regards,
Ramakrishnan

[-- Attachment #1.2: Type: text/html, Size: 1324 bytes --]

[-- Attachment #2: fix_deprecated_apis.patch --]
[-- Type: application/octet-stream, Size: 1304 bytes --]

From 6826ec10bd28245ff9d3e89186b1a17b5e53d461 Mon Sep 17 00:00:00 2001
From: Ramakrishnan G <rameshgx87@gmail.com>
Date: Fri, 11 Jan 2013 21:38:09 +0530
Subject: [PATCH] Fix glib deprecated APIs

---
 trace/simple.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/trace/simple.c b/trace/simple.c
index ce17d64..be7cad4 100644
--- a/trace/simple.c
+++ b/trace/simple.c
@@ -404,7 +404,13 @@ static GThread *trace_thread_create(GThreadFunc fn)
     sigfillset(&set);
     pthread_sigmask(SIG_SETMASK, &set, &oldset);
 #endif
+
+#if !GLIB_CHECK_VERSION(2, 32, 0)
     thread = g_thread_create(fn, NULL, FALSE, NULL);
+#else
+    thread = g_thread_new ( "Tracing thread", fn, NULL );
+#endif
+
 #ifndef _WIN32
     pthread_sigmask(SIG_SETMASK, &oldset, NULL);
 #endif
@@ -425,8 +431,15 @@ bool trace_backend_init(const char *events, const char *file)
 #endif
     }
 
+#if !GLIB_CHECK_VERSION(2, 32, 0)
     trace_available_cond = g_cond_new();
     trace_empty_cond = g_cond_new();
+#else
+    trace_available_cond = (GCond*) g_malloc (sizeof(GCond));
+    trace_empty_cond = (GCond*) g_malloc (sizeof(GCond));
+    g_cond_init( trace_available_cond );
+    g_cond_init( trace_empty_cond );
+#endif
 
     thread = trace_thread_create(writeout_thread);
     if (!thread) {
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-01-14  9:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-11 16:10 [Qemu-devel] Fix the glib deprecated APIs Ramesh G
2013-01-11 16:58 ` Peter Maydell
2013-01-11 17:01 ` Paolo Bonzini
2013-01-14  9:17   ` Stefan Hajnoczi
2013-01-14  9:21 ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).