mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
gst/gstutils.h: Try to fix 'dereferencing type-punned pointer will break strict aliasing rules' warnings with C++ com...
Original commit message from CVS: * gst/gstutils.h: (GST_BOILERPLATE_FULL): Try to fix 'dereferencing type-punned pointer will break strict aliasing rules' warnings with C++ compilers and GLib >= 2.14.0: GLib changed the default GType typedef from gulong to gsize at some point, but kept GType typedef'ed to gulong for C++ for ABI reasons; the g_once_* functions all take a gsize * though, so work around the type mismatch for C++ by doing everything in gsize and casting to GType later.
This commit is contained in:
parent
4fa54750f6
commit
7c0437a9da
2 changed files with 18 additions and 4 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2008-05-09 Tim-Philipp Müller <tim.muller at collabora co uk>
|
||||
|
||||
* gst/gstutils.h: (GST_BOILERPLATE_FULL):
|
||||
Try to fix 'dereferencing type-punned pointer will break strict
|
||||
aliasing rules' warnings with C++ compilers and GLib >= 2.14.0: GLib
|
||||
changed the default GType typedef from gulong to gsize at some point,
|
||||
but kept GType typedef'ed to gulong for C++ for ABI reasons; the
|
||||
g_once_* functions all take a gsize * though, so work around the type
|
||||
mismatch for C++ by doing everything in gsize and casting to GType
|
||||
later.
|
||||
|
||||
2008-05-09 Jan Schmidt <jan.schmidt@sun.com>
|
||||
|
||||
* plugins/elements/gstmultiqueue.c:
|
||||
|
|
|
@ -137,8 +137,11 @@ GType type_as_function ## _get_type (void); \
|
|||
GType \
|
||||
type_as_function ## _get_type (void) \
|
||||
{ \
|
||||
static volatile GType object_type = 0; \
|
||||
if (__gst_once_init_enter ((gsize *) &object_type)) { \
|
||||
/* The typedef for GType may be gulong or gsize, depending on the \
|
||||
* system and whether the compiler is c++ or not. The g_once_init_* \
|
||||
* functions always take a gsize * though ... */ \
|
||||
static volatile gsize gonce_data; \
|
||||
if (__gst_once_init_enter (&gonce_data)) { \
|
||||
GType _type; \
|
||||
_type = gst_type_register_static_full (parent_type_macro, \
|
||||
g_intern_static_string (#type), \
|
||||
|
@ -154,9 +157,9 @@ type_as_function ## _get_type (void) \
|
|||
NULL, \
|
||||
(GTypeFlags) 0); \
|
||||
additional_initializations (_type); \
|
||||
__gst_once_init_leave ((gsize *) &object_type, (gsize) _type); \
|
||||
__gst_once_init_leave (&gonce_data, (gsize) _type); \
|
||||
} \
|
||||
return object_type; \
|
||||
return (GType) gonce_data; \
|
||||
}
|
||||
|
||||
#define __GST_DO_NOTHING(type) /* NOP */
|
||||
|
|
Loading…
Reference in a new issue