mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 12:49:40 +00:00
info: Support new printf extensions in glibc 2.10
The printf extension mechanism changed in glibc 2.10, and the older register_printf_function is deprecated. Detect and use the new mechanism where available.
This commit is contained in:
parent
a3297ad3ed
commit
bd07633cc2
2 changed files with 35 additions and 12 deletions
23
configure.ac
23
configure.ac
|
@ -451,20 +451,21 @@ AM_CONDITIONAL(GST_HAVE_MONOTONIC_CLOCK, test "$gst_cv_monotonic_clock" = "yes")
|
||||||
dnl Check for a way to display the function name in debug output
|
dnl Check for a way to display the function name in debug output
|
||||||
AG_GST_CHECK_FUNCTION
|
AG_GST_CHECK_FUNCTION
|
||||||
|
|
||||||
dnl test for register_printf_function
|
dnl test for register_printf_specifier or register_printf_function
|
||||||
AC_CHECK_FUNC(register_printf_function,
|
AC_CHECK_FUNCS([register_printf_specifier register_printf_function],
|
||||||
[
|
[HAVE_PRINTF_EXTENSION=yes])
|
||||||
GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE="#define GST_PTR_FORMAT \"P\""
|
|
||||||
GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE="#define GST_SEGMENT_FORMAT \"Q\""
|
if test "$HAVE_PRINTF_EXTENSION" = yes; then
|
||||||
GST_USING_PRINTF_EXTENSION_DEFINE="#define GST_USING_PRINTF_EXTENSION"
|
GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE="#define GST_PTR_FORMAT \"P\""
|
||||||
AC_DEFINE(HAVE_PRINTF_EXTENSION, 1,
|
GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE="#define GST_SEGMENT_FORMAT \"Q\""
|
||||||
[Defined if we have register_printf_function ()])
|
GST_USING_PRINTF_EXTENSION_DEFINE="#define GST_USING_PRINTF_EXTENSION"
|
||||||
], [
|
AC_DEFINE(HAVE_PRINTF_EXTENSION, 1,
|
||||||
|
[Defined if we have printf specifier extensions available])
|
||||||
|
else
|
||||||
GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE="#define GST_PTR_FORMAT \"p\""
|
GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE="#define GST_PTR_FORMAT \"p\""
|
||||||
GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE="#define GST_SEGMENT_FORMAT \"p\""
|
GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE="#define GST_SEGMENT_FORMAT \"p\""
|
||||||
GST_USING_PRINTF_EXTENSION_DEFINE="#undef GST_USING_PRINTF_EXTENSION"
|
GST_USING_PRINTF_EXTENSION_DEFINE="#undef GST_USING_PRINTF_EXTENSION"
|
||||||
]
|
fi
|
||||||
)
|
|
||||||
AC_SUBST(GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE)
|
AC_SUBST(GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE)
|
||||||
AC_SUBST(GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE)
|
AC_SUBST(GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE)
|
||||||
AC_SUBST(GST_USING_PRINTF_EXTENSION_DEFINE)
|
AC_SUBST(GST_USING_PRINTF_EXTENSION_DEFINE)
|
||||||
|
|
|
@ -164,9 +164,14 @@ static int _gst_info_printf_extension_ptr (FILE * stream,
|
||||||
const struct printf_info *info, const void *const *args);
|
const struct printf_info *info, const void *const *args);
|
||||||
static int _gst_info_printf_extension_segment (FILE * stream,
|
static int _gst_info_printf_extension_segment (FILE * stream,
|
||||||
const struct printf_info *info, const void *const *args);
|
const struct printf_info *info, const void *const *args);
|
||||||
|
#if HAVE_REGISTER_PRINTF_SPECIFIER
|
||||||
|
static int _gst_info_printf_extension_arginfo (const struct printf_info *info,
|
||||||
|
size_t n, int *argtypes, int *size);
|
||||||
|
#else
|
||||||
static int _gst_info_printf_extension_arginfo (const struct printf_info *info,
|
static int _gst_info_printf_extension_arginfo (const struct printf_info *info,
|
||||||
size_t n, int *argtypes);
|
size_t n, int *argtypes);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
struct _GstDebugMessage
|
struct _GstDebugMessage
|
||||||
{
|
{
|
||||||
|
@ -289,10 +294,17 @@ _gst_debug_init (void)
|
||||||
_priv_gst_info_start_time = gst_util_get_timestamp ();
|
_priv_gst_info_start_time = gst_util_get_timestamp ();
|
||||||
|
|
||||||
#ifdef HAVE_PRINTF_EXTENSION
|
#ifdef HAVE_PRINTF_EXTENSION
|
||||||
|
#if HAVE_REGISTER_PRINTF_SPECIFIER
|
||||||
|
register_printf_specifier (GST_PTR_FORMAT[0], _gst_info_printf_extension_ptr,
|
||||||
|
_gst_info_printf_extension_arginfo);
|
||||||
|
register_printf_specifier (GST_SEGMENT_FORMAT[0],
|
||||||
|
_gst_info_printf_extension_segment, _gst_info_printf_extension_arginfo);
|
||||||
|
#else
|
||||||
register_printf_function (GST_PTR_FORMAT[0], _gst_info_printf_extension_ptr,
|
register_printf_function (GST_PTR_FORMAT[0], _gst_info_printf_extension_ptr,
|
||||||
_gst_info_printf_extension_arginfo);
|
_gst_info_printf_extension_arginfo);
|
||||||
register_printf_function (GST_SEGMENT_FORMAT[0],
|
register_printf_function (GST_SEGMENT_FORMAT[0],
|
||||||
_gst_info_printf_extension_segment, _gst_info_printf_extension_arginfo);
|
_gst_info_printf_extension_segment, _gst_info_printf_extension_arginfo);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* do NOT use a single debug function before this line has been run */
|
/* do NOT use a single debug function before this line has been run */
|
||||||
|
@ -1483,12 +1495,22 @@ _gst_info_printf_extension_segment (FILE * stream,
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if HAVE_REGISTER_PRINTF_SPECIFIER
|
||||||
|
static int
|
||||||
|
_gst_info_printf_extension_arginfo (const struct printf_info *info, size_t n,
|
||||||
|
int *argtypes, int *size)
|
||||||
|
#else
|
||||||
static int
|
static int
|
||||||
_gst_info_printf_extension_arginfo (const struct printf_info *info, size_t n,
|
_gst_info_printf_extension_arginfo (const struct printf_info *info, size_t n,
|
||||||
int *argtypes)
|
int *argtypes)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (n > 0)
|
if (n > 0) {
|
||||||
argtypes[0] = PA_POINTER;
|
argtypes[0] = PA_POINTER;
|
||||||
|
#if HAVE_REGISTER_PRINTF_SPECIFIER
|
||||||
|
*size = sizeof (gpointer);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_PRINTF_EXTENSION */
|
#endif /* HAVE_PRINTF_EXTENSION */
|
||||||
|
|
Loading…
Reference in a new issue