applied fixed patch from Brian

Original commit message from CVS:
applied fixed patch from Brian
This commit is contained in:
Thomas Vander Stichele 2002-11-29 17:05:13 +00:00
parent 7cd8540542
commit 009e8bb2b4
10 changed files with 273 additions and 52 deletions

View file

@ -3,13 +3,7 @@ AC_CANONICAL_TARGET([])
dnl when going to/from release please set the nano (fourth number) right !
dnl releases only do Wall, cvs and prerelease does Werror too
dnl only use Wall or Werror if compiler is gcc.
if test "x$GCC" = "xyes"; then
AS_VERSION(gstreamer, GST_VERSION, 0, 4, 2, 1, GST_ERROR="-Wall", GST_ERROR="-Wall -Werror")
else
AS_VERSION(gstreamer, GST_VERSION, 0, 4, 2, 1, GST_ERROR="", GST_ERROR="")
fi
AS_VERSION(gstreamer, GST_VERSION, 0, 4, 2, 1, GST_ERROR="-Wall", GST_ERROR="-Wall -Werror")
dnl AM_MAINTAINER_MODE only provides the option to configure to enable it
AM_MAINTAINER_MODE
AM_INIT_AUTOMAKE($PACKAGE,$VERSION)
@ -179,39 +173,6 @@ main() { atomic_t t; atomic_set(&t,0); atomic_inc(&t); atomic_add(1,&t);return 0
])
fi
dnl
dnl Check for functions
dnl
AC_MSG_CHECKING(whether $GCC implements __func__)
AC_CACHE_VAL(have_func,
[AC_TRY_LINK([#include <stdio.h>],[printf("%s", __func__);],
have_func=yes,
have_func=no)])
AC_MSG_RESULT($have_func)
if test "$have_func" = yes; then
AC_DEFINE(HAVE_FUNC,1,[defined if gcc have HAVE_FUNC)])
else
AC_MSG_CHECKING(whether $GCC implements __PRETTY_FUNCTION__)
AC_CACHE_VAL(have_pretty_function,
[AC_TRY_LINK([#include <stdio.h>],[printf("%s", __PRETTY_FUNCTION__);],
have_pretty_function=yes,
have_pretty_function=no)])
AC_MSG_RESULT($have_pretty_function)
if test "$have_pretty_function" = yes; then
AC_DEFINE(HAVE_PRETTY_FUNCTION,1,[defined if gcc have HAVE_PRETTY_FUNCTION)])
else
AC_MSG_CHECKING(whether $GCC implements __FUNCTION__)
AC_CACHE_VAL(have_function,
[AC_TRY_LINK([#include <stdio.h>],[printf("%s", __FUNCTION__);],
have_function=yes,
have_function=no)])
AC_MSG_RESULT($have_function)
if test "$have_function" = yes; then
AC_DEFINE(HAVE_FUNCTION,1,[defined if gcc have HAVE_FUNCTION)])
fi
fi
fi
dnl ######################################################################
dnl # Check command line parameters, and set shell variables accordingly #
dnl ######################################################################

View file

@ -58,6 +58,26 @@ struct _GstCaps {
/* factory macros which make it easier for plugins to instantiate */
#ifdef G_HAVE_ISO_VARARGS
#define GST_CAPS_NEW(name, type, ...) \
gst_caps_new ( \
name, \
type, \
gst_props_new ( \
__VA_ARGS__, \
NULL))
#define GST_CAPS_FACTORY(factoryname, ...) \
static GstCaps* \
factoryname (void) \
{ \
static GstCaps *caps = NULL; \
if (!caps) { \
caps = gst_caps_chain (__VA_ARGS_, NULL); \
} \
return caps; \
}
#elif defined(G_HAVE_GNUC_VARARGS)
#define GST_CAPS_NEW(name, type, a...) \
gst_caps_new ( \
name, \
@ -76,6 +96,7 @@ factoryname (void) \
} \
return caps; \
}
#endif
#define GST_CAPS_GET(fact) (fact)()
@ -108,8 +129,13 @@ void gst_caps_set_type_id (GstCaps *caps, guint16 type_id);
GstCaps* gst_caps_set_props (GstCaps *caps, GstProps *props);
GstProps* gst_caps_get_props (GstCaps *caps);
#ifdef G_HAVE_ISO_VARARGS
#define gst_caps_set(caps, ...) gst_props_set ((caps)->properties, __VA_ARGS__)
#define gst_caps_get(caps, ...) gst_props_get ((caps)->properties, __VA_ARGS__)
#elif defined(G_HAVE_GNUC_VARARGS)
#define gst_caps_set(caps, name, args...) gst_props_set ((caps)->properties, name, ##args)
#define gst_caps_get(caps, name, args...) gst_props_get ((caps)->properties, name, ##args)
#endif
#define gst_caps_get_int(caps,name,res) gst_props_entry_get_int(gst_props_get_entry((caps)->properties,name),res)
#define gst_caps_get_float(caps,name,res) gst_props_entry_get_float(gst_props_get_entry((caps)->properties,name),res)

View file

@ -78,6 +78,18 @@ typedef struct
GstEventFlag flags;
} GstEventMask;
#ifdef G_HAVE_ISO_VARARGS
#define GST_EVENT_MASK_FUNCTION(functionname, ...) \
static const GstEventMask* \
functionname (GstPad *pad) \
{ \
static const GstEventMask masks[] = { \
__VA_ARGS__, \
{ 0, } \
}; \
return masks; \
}
#elif defined(G_HAVE_GNUC_VARARGS)
#define GST_EVENT_MASK_FUNCTION(functionname, a...) \
static const GstEventMask* \
functionname (GstPad *pad) \
@ -88,6 +100,7 @@ functionname (GstPad *pad) \
}; \
return masks; \
}
#endif
/* seek events, extends GstEventFlag */
typedef enum {

View file

@ -48,6 +48,18 @@ struct _GstFormatDefinition
gchar *description;
};
#ifdef G_HAVE_ISO_VARARGS
#define GST_FORMATS_FUNCTION(functionname, ...) \
static const GstFormat* \
functionname (GstPad *pad) \
{ \
static const GstFormat formats[] = { \
__VA_ARGS__, \
0 \
}; \
return formats; \
}
#elif defined(G_HAVE_GNUC_VARARGS)
#define GST_FORMATS_FUNCTION(functionname, a...) \
static const GstFormat* \
functionname (GstPad *pad) \
@ -58,6 +70,7 @@ functionname (GstPad *pad) \
}; \
return formats; \
}
#endif
void _gst_format_initialize (void);

View file

@ -81,8 +81,9 @@ static gchar *_gst_info_category_strings[] = {
"REFCOUNTING",
"EVENT",
"PARAMS",
[30] = "CALL_TRACE",
"",
"",
"CALL_TRACE",
};
/**

View file

@ -31,6 +31,15 @@
#include <config.h>
#endif
#ifdef HAVE_FUNC
#define FUNCTION __func__
#elif HAVE_PRETTY_FUNCTION
#define FUNCTION __PRETTY_FUNCTION__
#elif HAVE_FUNCTION
#define FUNCTION __FUNCTION__
#else
#define FUNCTION ""
#endif
/***** are we in the core or not? *****/
#ifdef __GST_PRIVATE_H__
@ -136,17 +145,38 @@ G_GNUC_UNUSED static gchar *_debug_string = NULL;
#ifdef G_HAVE_ISO_VARARGS
#ifdef GST_DEBUG_ENABLED
#define GST_DEBUG(cat, ...) G_STMT_START{ \
if ((1<<cat) & _gst_debug_categories) \
_gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
NULL,g_strdup_printf( __VA_ARGS__ )); \
}G_STMT_END
#define GST_DEBUG_ELEMENT(cat, element, ...) G_STMT_START{ \
if ((1<<cat) & _gst_debug_categories) \
_gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
element,g_strdup_printf( __VA_ARGS__ )); \
}G_STMT_END
#else
#define GST_DEBUG(cat, ...)
#define GST_DEBUG_ELEMENT(cat,element, ...)
#endif
#elif defined(G_HAVE_GNUC_VARARGS)
#ifdef GST_DEBUG_ENABLED
#define GST_DEBUG(cat,format,args...) G_STMT_START{ \
if ((1<<cat) & _gst_debug_categories) \
_gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \
_gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
NULL,g_strdup_printf( format , ## args )); \
}G_STMT_END
#define GST_DEBUG_ELEMENT(cat,element,format,args...) G_STMT_START{ \
if ((1<<cat) & _gst_debug_categories) \
_gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \
_gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
element,g_strdup_printf( format , ## args )); \
}G_STMT_END
@ -155,6 +185,8 @@ G_GNUC_UNUSED static gchar *_debug_string = NULL;
#define GST_DEBUG_ELEMENT(cat,element,format,args...)
#endif
#endif
@ -164,6 +196,18 @@ G_GNUC_UNUSED static gchar *_debug_string = NULL;
GST_OBJECT_NAME (GST_OBJECT_PARENT(pad)) : \
"''", GST_OBJECT_NAME (pad)
#ifdef G_HAVE_ISO_VARARGS
#ifdef GST_DEBUG_COLOR
#define GST_DEBUG_ENTER(...) GST_DEBUG( 31 , "\033[00;37mentering\033[00m :" __VA_ARGS__ )
#define GST_DEBUG_LEAVE(...) GST_DEBUG( 31 , "\033[00;37mleaving\033[00m :" __VA_ARGS__ )
#else
#define GST_DEBUG_ENTER(...) GST_DEBUG( 31 , "entering :" __VA_ARGS__ )
#define GST_DEBUG_LEAVE(...) GST_DEBUG( 31 , "leaving :" __VA_ARGS__ )
#endif
#elif defined(G_HAVE_GNUC_VARARGS)
#ifdef GST_DEBUG_COLOR
#define GST_DEBUG_ENTER(format, args...) GST_DEBUG( 31 , format ": \033[00;37mentering\033[00m" , ##args )
#define GST_DEBUG_LEAVE(format, args...) GST_DEBUG( 31 , format ": \033[00;37mleaving\033[00m" , ##args )
@ -172,6 +216,8 @@ G_GNUC_UNUSED static gchar *_debug_string = NULL;
#define GST_DEBUG_LEAVE(format, args...) GST_DEBUG( 31 , format ": leaving" , ##args )
#endif
#endif
/***** Colorized debug for thread ids *****/
#ifdef GST_DEBUG_COLOR
@ -194,6 +240,38 @@ typedef void (*_debug_function_f)();
G_GNUC_UNUSED static gchar *_debug_string_pointer = NULL;
G_GNUC_UNUSED static GModule *_debug_self_module = NULL;
#ifdef G_HAVE_ISO_VARARGS
#define _DEBUG_ENTER_BUILTIN(...) \
static int _debug_in_wrapper = 0; \
gchar *_debug_string = ({ \
if (!_debug_in_wrapper) { \
void *_return_value; \
gchar *_debug_string; \
_debug_function_f function; \
void *_function_args = __builtin_apply_args(); \
_debug_in_wrapper = 1; \
_debug_string = g_strdup_printf(GST_DEBUG_PREFIX("")); \
_debug_string_pointer = _debug_string; \
fprintf(stderr,"%s: entered " FUNCTION, _debug_string); \
fprintf(stderr, __VA_ARGS__ ); \
fprintf(stderr,"\n"); \
if (_debug_self_module == NULL) _debug_self_module = g_module_open(NULL,0); \
g_module_symbol(_debug_self_module,FUNCTION,(gpointer *)&function); \
_return_value = __builtin_apply(function,_function_args,64); \
fprintf(stderr,"%s: left " FUNCTION, _debug_string); \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr,"\n"); \
g_free(_debug_string); \
__builtin_return(_return_value); \
} else { \
_debug_in_wrapper = 0; \
} \
_debug_string_pointer; \
});
#elif defined(G_HAVE_GNUC_VARARGS)
#define _DEBUG_ENTER_BUILTIN(format,args...) \
static int _debug_in_wrapper = 0; \
gchar *_debug_string = ({ \
@ -205,11 +283,11 @@ G_GNUC_UNUSED static GModule *_debug_self_module = NULL;
_debug_in_wrapper = 1; \
_debug_string = g_strdup_printf(GST_DEBUG_PREFIX("")); \
_debug_string_pointer = _debug_string; \
fprintf(stderr,"%s: entered " __PRETTY_FUNCTION__ format "\n" , _debug_string , ## args ); \
fprintf(stderr,"%s: entered " FUNCTION format "\n" , _debug_string , ## args ); \
if (_debug_self_module == NULL) _debug_self_module = g_module_open(NULL,0); \
g_module_symbol(_debug_self_module,__FUNCTION__,(gpointer *)&function); \
g_module_symbol(_debug_self_module,FUNCTION,(gpointer *)&function); \
_return_value = __builtin_apply(function,_function_args,64); \
fprintf(stderr,"%s: left " __PRETTY_FUNCTION__ format "\n" , _debug_string , ## args ); \
fprintf(stderr,"%s: left " FUNCTION format "\n" , _debug_string , ## args ); \
g_free(_debug_string); \
__builtin_return(_return_value); \
} else { \
@ -218,9 +296,26 @@ G_GNUC_UNUSED static GModule *_debug_self_module = NULL;
_debug_string_pointer; \
});
#endif
* WARNING: there's a gcc CPP bug lurking in here. The extra space before the ##args *
* somehow make the preprocessor leave the _debug_string. If it's removed, the *
* _debug_string somehow gets stripped along with the ##args, and that's all she wrote. *
#ifdef G_HAVE_ISO_VARARGS
#define _DEBUG_BUILTIN(...) \
if (_debug_string != (void *)-1) { \
if (_debug_string) { \
fprintf(stderr, "%s: " _debug_string); \
fprintf(stderr, __VA_ARGS__); \
} else { \
fprintf(stderr,GST_DEBUG_PREFIX(": " __VA_ARGS__)); \
} \
}
#elif defined(G_HAVE_GNUC_VARARGS)
#define _DEBUG_BUILTIN(format,args...) \
if (_debug_string != (void *)-1) { \
if (_debug_string) \
@ -229,6 +324,8 @@ G_GNUC_UNUSED static GModule *_debug_self_module = NULL;
fprintf(stderr,GST_DEBUG_PREFIX(": " format , ## args)); \
}
#endif
*/
@ -259,16 +356,38 @@ extern guint32 _gst_info_categories;
#define GST_INFO_ENABLED
#endif
#ifdef G_HAVE_ISO_VARARGS
#ifdef GST_INFO_ENABLED
#define GST_INFO(cat,...) G_STMT_START{ \
if ((1<<cat) & _gst_info_categories) \
_gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
NULL,g_strdup_printf( __VA_ARGS__ )); \
}G_STMT_END
#define GST_INFO_ELEMENT(cat,element,...) G_STMT_START{ \
if ((1<<cat) & _gst_info_categories) \
_gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
element,g_strdup_printf( __VA_ARGS__ )); \
}G_STMT_END
#else
#define GST_INFO(cat,...)
#define GST_INFO_ELEMENT(cat,element,...)
#endif
#elif defined(G_HAVE_GNUC_VARARGS)
#ifdef GST_INFO_ENABLED
#define GST_INFO(cat,format,args...) G_STMT_START{ \
if ((1<<cat) & _gst_info_categories) \
_gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \
_gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
NULL,g_strdup_printf( format , ## args )); \
}G_STMT_END
#define GST_INFO_ELEMENT(cat,element,format,args...) G_STMT_START{ \
if ((1<<cat) & _gst_info_categories) \
_gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \
_gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
element,g_strdup_printf( format , ## args )); \
}G_STMT_END
@ -277,6 +396,8 @@ extern guint32 _gst_info_categories;
#define GST_INFO_ELEMENT(cat,element,format,args...)
#endif
#endif
void gst_info_set_categories (guint32 categories);
guint32 gst_info_get_categories (void);
@ -305,14 +426,28 @@ void gst_default_error_handler (gchar *file,gchar *function,
extern GstErrorHandler _gst_error_handler;
#ifdef G_HAVE_ISO_VARARGS
#define GST_ERROR(element,...) \
_gst_error_handler(__FILE__,FUNCTION,__LINE__,_debug_string, \
element,NULL,g_strdup_printf( __VA_ARGS__ ))
#define GST_ERROR_OBJECT(element,object,...) \
_gst_error_handler(__FILE__,FUNCTION,__LINE__,_debug_string, \
element,object,g_strdup_printf( __VA_ARGS__ ))
#elif defined(G_HAVE_GNUC_VARARGS)
#define GST_ERROR(element,format,args...) \
_gst_error_handler(__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \
_gst_error_handler(__FILE__,FUNCTION,__LINE__,_debug_string, \
element,NULL,g_strdup_printf( format , ## args ))
#define GST_ERROR_OBJECT(element,object,format,args...) \
_gst_error_handler(__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \
_gst_error_handler(__FILE__,FUNCTION,__LINE__,_debug_string, \
element,object,g_strdup_printf( format , ## args ))
#endif

View file

@ -25,6 +25,18 @@
extern const char *g_log_domain_gstreamer;
#ifdef G_HAVE_ISO_VARARGS
/* information messages */
#define GST_SHOW_INFO
#ifdef GST_SHOW_INFO
#define gst_info(...) fprintf(stderr, __VA_ARGS__)
#else
#define gst_info(...)
#endif
#elif defined(G_HAVE_GNUC_VARARGS)
/* information messages */
#define GST_SHOW_INFO
#ifdef GST_SHOW_INFO
@ -32,5 +44,6 @@ extern const char *g_log_domain_gstreamer;
#else
#define gst_info(format,args...)
#endif
#endif
#endif /* __GST_LOG_H__ */

View file

@ -128,6 +128,18 @@ typedef enum {
GST_PAD_QUERY_RATE
} GstPadQueryType;
#ifdef G_HAVE_ISO_VARARGS
#define GST_PAD_QUERY_TYPE_FUNCTION(functionname, ...) \
static const GstPadQueryType* \
functionname (GstPad *pad) \
{ \
static const GstPadQueryType types[] = { \
__VA_ARGS__, \
0 \
}; \
return types; \
}
#elif defined(G_HAVE_GNUC_VARARGS)
#define GST_PAD_QUERY_TYPE_FUNCTION(functionname, a...) \
static const GstPadQueryType* \
functionname (GstPad *pad) \
@ -138,6 +150,7 @@ functionname (GstPad *pad) \
}; \
return types; \
}
#endif
/* this defines the functions used to chain buffers
@ -335,6 +348,30 @@ struct _GstPadTemplateClass {
void (*pad_created) (GstPadTemplate *templ, GstPad *pad);
};
#ifdef G_HAVE_ISO_VARARGS
#define GST_PAD_TEMPLATE_NEW(padname, dir, pres, ...) \
gst_pad_template_new ( \
padname, \
dir, \
pres, \
__VA_ARGS__ , \
NULL)
#define GST_PAD_TEMPLATE_FACTORY(name, padname, dir, pres, ...) \
static GstPadTemplate* \
name (void) \
{ \
static GstPadTemplate *templ = NULL; \
if (!templ) { \
templ = GST_PAD_TEMPLATE_NEW ( \
padname, \
dir, \
pres, \
__VA_ARGS__ ); \
} \
return templ; \
}
#elif defined(G_HAVE_GNUC_VARARGS)
/* CR1: the space after 'a' is necessary because of preprocessing in gcc */
#define GST_PAD_TEMPLATE_NEW(padname, dir, pres, a...) \
gst_pad_template_new ( \
@ -358,6 +395,7 @@ name (void) \
} \
return templ; \
}
#endif
#define GST_PAD_TEMPLATE_GET(fact) (fact)()

View file

@ -59,7 +59,16 @@ typedef enum {
#define GST_MAKE_FOURCC(a,b,c,d) (guint32)((a)|(b)<<8|(c)<<16|(d)<<24)
#define GST_STR_FOURCC(f) (guint32)(((f)[0])|((f)[1]<<8)|((f)[2]<<16)|((f)[3]<<24))
#define GST_PROPS_LIST(a...) GST_PROPS_LIST_TYPE,##a,NULL
#ifdef G_HAVE_ISO_VARARGS
#define GST_PROPS_LIST(...) GST_PROPS_LIST_TYPE,__VA_ARGS__,NULL
#elif defined(G_HAVE_GNUC_VARARGS)
#define GST_PROPS_LIST(a...) GST_PROPS_LIST_TYPE,a,NULL
#endif
#define GST_PROPS_GLIST(a) GST_PROPS_GLIST_TYPE,(a)
#define GST_PROPS_INT(a) GST_PROPS_INT_TYPE,(a)
#define GST_PROPS_INT_RANGE(a,b) GST_PROPS_INT_RANGE_TYPE,(a),(b)

View file

@ -5,12 +5,24 @@
#include "types.h"
#include <grammar.tab.h>
#ifdef G_HAVE_ISO_VARARGS
#ifdef DEBUG
# define PRINT(...) printf(__VAR_ARGS__)
#else
#define PRINT(...)
#endif
#elif defined(G_HAVE_GNUC_VARARGS)
#ifdef DEBUG
# define PRINT(a...) printf(##a)
#else
#define PRINT(a...)
#endif
#endif
#define CHAR(x) PRINT ("char: %c\n", *yytext); return *yytext;
#define YY_DECL int _gst_parse_yylex (YYSTYPE *lvalp)