Add GST_USING_PRINTF_EXTENSION to gstconfig.h so that we know whether we can use G_GNUC_PRINTF in other header files ...

Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/gstconfig.h.in:
* gst/gstelement.h:
* gst/gstinfo.h:
Add GST_USING_PRINTF_EXTENSION to gstconfig.h so that we know
whether we can use G_GNUC_PRINTF in other header files and at
least check the printf format/arguments of debug messages and
GST_ELEMENT_ERROR messages when the printf extension is not
being used.
Replace more tabs with spaces in gstinfo.h and remove two spurious
function declarations in GST_DISABLE_DEBUG part with macros.
This commit is contained in:
Tim-Philipp Müller 2006-10-05 12:31:07 +00:00
parent c4be4aa916
commit 376f6c34da
6 changed files with 102 additions and 56 deletions

View file

@ -1,3 +1,18 @@
2006-10-05 Tim-Philipp Müller <tim at centricular dot net>
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/gstconfig.h.in:
* gst/gstelement.h:
* gst/gstinfo.h:
Add GST_USING_PRINTF_EXTENSION to gstconfig.h so that we know
whether we can use G_GNUC_PRINTF in other header files and at
least check the printf format/arguments of debug messages and
GST_ELEMENT_ERROR messages when the printf extension is not
being used.
Replace more tabs with spaces in gstinfo.h and remove two spurious
function declarations in GST_DISABLE_DEBUG part with macros.
2006-10-03 Tim-Philipp Müller <tim at centricular dot net>
* gst/gstbus.c: (gst_bus_class_init), (gst_bus_post):

View file

@ -323,14 +323,18 @@ AC_CHECK_FUNC(register_printf_function,
[
GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE="#define GST_PTR_FORMAT \"P\""
GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE="#define GST_SEGMENT_FORMAT \"Q\""
GST_USING_PRINTF_EXTENSION_DEFINE="#define GST_USING_PRINTF_EXTENSION"
AC_DEFINE(HAVE_PRINTF_EXTENSION, 1,
[Defined if we have register_printf_function ()])
],
], [
GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE="#define GST_PTR_FORMAT \"p\""
GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE="#define GST_SEGMENT_FORMAT \"p\""
GST_USING_PRINTF_EXTENSION_DEFINE="#undef GST_USING_PRINTF_EXTENSION"
]
)
AC_SUBST(GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE)
AC_SUBST(GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE)
AC_SUBST(GST_USING_PRINTF_EXTENSION_DEFINE)
dnl test if we have dladdr(); we use it for debugging; see gst/gstinfo.c
save_cflags="$CFLAGS"

View file

@ -394,6 +394,7 @@ GST_PLUGIN_EXPORT
GST_PADDING
GST_PADDING_LARGE
GST_PADDING_INIT
GST_USING_PRINTF_EXTENSION
</SECTION>
<SECTION>

View file

@ -155,6 +155,11 @@
*/
@GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE@
/* whether or not GST_PTR_FORMAT or GST_SEGMENT_FORMAT are using
* the printf extension mechanism. This is for internal use in our
* header files so we know whether we can use G_GNUC_PRINTF or not */
@GST_USING_PRINTF_EXTENSION_DEFINE@
/* whether or not the CPU supports unaligned access */
@GST_HAVE_UNALIGNED_ACCESS_DEFINE@

View file

@ -570,7 +570,11 @@ gboolean gst_element_query (GstElement *element, GstQuery *query);
gboolean gst_element_post_message (GstElement * element, GstMessage * message);
/* error handling */
#ifdef GST_USING_PRINTF_EXTENSION
gchar * _gst_element_error_printf (const gchar *format, ...);
#else
gchar * _gst_element_error_printf (const gchar *format, ...) G_GNUC_PRINTF (1, 2);
#endif
void gst_element_message_full (GstElement * element, GstMessageType type,
GQuark domain, gint code, gchar * text,
gchar * debug, const gchar * file,

View file

@ -240,8 +240,10 @@ typedef void (*GstLogFunction) (GstDebugCategory * category,
void _gst_debug_init (void);
/* note we can't use G_GNUC_PRINTF (7, 8) because gcc chokes on %P, which
* we use for GST_PTR_FORMAT. */
#ifdef GST_USING_PRINTF_EXTENSION
/* not using G_GNUC_PRINTF, since gcc will choke on GST_PTR_FORMAT being %P */
void gst_debug_log (GstDebugCategory * category,
GstDebugLevel level,
const gchar * file,
@ -250,6 +252,20 @@ void gst_debug_log (GstDebugCategory * category,
GObject * object,
const gchar * format,
...) G_GNUC_NO_INSTRUMENT;
#else /* GST_USING_PRINTF_EXTENSION */
void gst_debug_log (GstDebugCategory * category,
GstDebugLevel level,
const gchar * file,
const gchar * function,
gint line,
GObject * object,
const gchar * format,
...) G_GNUC_PRINTF (7, 8) G_GNUC_NO_INSTRUMENT;
#endif /* GST_USING_PRINTF_EXTENSION */
void gst_debug_log_valist (GstDebugCategory * category,
GstDebugLevel level,
const gchar * file,
@ -912,9 +928,10 @@ G_CONST_RETURN gchar *
#define gst_debug_get_default_threshold() (GST_LEVEL_NONE)
#define gst_debug_level_get_name(level) ("NONE")
#define gst_debug_message_get(message) ("NONE")
#define gst_debug_add_log_function(func,data) /* NOP */
guint gst_debug_remove_log_function (GstLogFunction func);
guint gst_debug_remove_log_function_by_data (gpointer data);
#define gst_debug_remove_log_function(func) (0)
#define gst_debug_remove_log_function_by_data(data) (0)
#define gst_debug_set_active(active) /* NOP */
#define gst_debug_is_active() (FALSE)
#define gst_debug_set_colored(colored) /* NOP */