All of lore.kernel.org
 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

* Re: [Qemu-devel] Fix the glib deprecated APIs
  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:21 ` Stefan Hajnoczi
  2 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2013-01-11 16:58 UTC (permalink / raw)
  To: Ramesh G; +Cc: stefanha, qemu-devel

On 11 January 2013 16:10, Ramesh G <rameshgx87@gmail.com> wrote:
> I got a couple of below compilation errors while compiling with glib > 2.32.

Stefan: see also commit d1b719e98 which fixed these warnings in
coroutine-gthread.c.

-- PMM

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

* Re: [Qemu-devel] Fix the glib deprecated APIs
  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
  2 siblings, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2013-01-11 17:01 UTC (permalink / raw)
  To: Ramesh G; +Cc: stefanha, qemu-devel

Il 11/01/2013 17:10, Ramesh G ha scritto:
> 
> 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.

Could you instead change it to use qemu-thread?

Paolo

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

* Re: [Qemu-devel] Fix the glib deprecated APIs
  2013-01-11 17:01 ` Paolo Bonzini
@ 2013-01-14  9:17   ` Stefan Hajnoczi
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2013-01-14  9:17 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Ramesh G, qemu-devel

On Fri, Jan 11, 2013 at 06:01:53PM +0100, Paolo Bonzini wrote:
> Il 11/01/2013 17:10, Ramesh G ha scritto:
> > 
> > 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.
> 
> Could you instead change it to use qemu-thread?

The reason to avoid QEMU APIs is to prevent entering an infinite loop if
a trace event is placed into the qemu-thread code.

Stefan

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

* Re: [Qemu-devel] Fix the glib deprecated APIs
  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:21 ` Stefan Hajnoczi
  2 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2013-01-14  9:21 UTC (permalink / raw)
  To: Ramesh G; +Cc: qemu-devel

On Fri, Jan 11, 2013 at 09:40:59PM +0530, Ramesh G wrote:
> 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.

Hi Ramakrishnan,
Please follow the guidelines at http://wiki.qemu.org/Contribute/SubmitAPatch, especially:
 * Please submit patches inline instead of as attachments so reviewiers
   can reply and quote your code easily.
 * Please follow QEMU coding style and run scripts/checkpatch.pl on your
   patch before submitting it.

Thanks,
Stefan

^ permalink raw reply	[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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.