From: Sebastian Dröge Date: Wed, 12 Mar 2008 15:36:38 +0000 (+0000) Subject: Bug 316221 - G_LOCK warns about breaking strict-aliasing rules X-Git-Tag: GLIB_2_16_2~44 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0dc34bf29a1a5a9e2ef1000ba9ace7e2c2b1f5e0;p=platform%2Fupstream%2Fglib.git Bug 316221 - G_LOCK warns about breaking strict-aliasing rules * configure.in: * glib/gthread.h: Prevent the compiler from warning about breaking strict-aliasing rules when using gcc 4.3 and G_LOCK on C sources. svn path=/trunk/; revision=6691 --- diff --git a/ChangeLog b/ChangeLog index a79283e..310bb59 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-03-12 Sebastian Dröge + + Bug 316221 - G_LOCK warns about breaking strict-aliasing rules + + * configure.in: + * glib/gthread.h: Prevent the compiler from warning about breaking + strict-aliasing rules when using gcc 4.3 and G_LOCK on C sources. + 2008-03-12 Tor Lillqvist Bug 520914 - win_iconv doesn't support UCS-2 diff --git a/configure.in b/configure.in index e4c1521..22ac455 100644 --- a/configure.in +++ b/configure.in @@ -2820,9 +2820,15 @@ struct _GStaticMutex } static_mutex; }; #define G_STATIC_MUTEX_INIT { NULL, { { $g_mutex_contents} } } +#ifdef __cplusplus #define g_static_mutex_get_mutex(mutex) \\ (g_thread_use_default_impl ? ((GMutex*) ((mutex)->static_mutex.pad)) : \\ g_static_mutex_get_mutex_impl_shortcut (&((mutex)->runtime_mutex))) +#else +#define g_static_mutex_get_mutex(mutex) \\ + (g_thread_use_default_impl ? ((GMutex*) (void*) ((mutex)->static_mutex.pad)) : \\ + g_static_mutex_get_mutex_impl_shortcut (&((mutex)->runtime_mutex))) +#endif _______EOF else cat >>$outfile <<_______EOF diff --git a/glib/gthread.h b/glib/gthread.h index b627b66..515be1a 100644 --- a/glib/gthread.h +++ b/glib/gthread.h @@ -140,9 +140,15 @@ void g_thread_init_with_errorcheck_mutexes (GThreadFunctions* vtable); /* internal function for fallback static mutex implementation */ GMutex* g_static_mutex_get_mutex_impl (GMutex **mutex); +#ifdef __cplusplus #define g_static_mutex_get_mutex_impl_shortcut(mutex) \ (g_atomic_pointer_get ((gpointer*)(void*)mutex) ? *(mutex) : \ g_static_mutex_get_mutex_impl (mutex)) +#else +#define g_static_mutex_get_mutex_impl_shortcut(mutex) \ + (g_atomic_pointer_get (mutex) ? *(mutex) : \ + g_static_mutex_get_mutex_impl (mutex)) +#endif /* shorthands for conditional and unconditional function calls */