parse: fix segfaulting prototype-mismatch

Now YYDEBUG is always set, so check it's value

https://bugzilla.gnome.org/show_bug.cgi?id=712679
This commit is contained in:
Fabian Kirsch 2013-11-19 15:03:35 +01:00 committed by Olivier Crête
parent 73a58cb0a2
commit 56d74ddb64
3 changed files with 15 additions and 16 deletions

View file

@ -4,6 +4,7 @@ grammar.tab.c
grammar.tab.h
lex.yy.c
parse.c
parse_lex.h
lex.priv_gst_parse_yy.c
*.bb
*.bbg

View file

@ -1,25 +1,23 @@
# libgstparse.la is an optionally built helper library linked into core
noinst_LTLIBRARIES = libgstparse.la
CLEANFILES = grammar.tab.h grammar.output
CLEANFILES = grammar.tab.h parse_lex.h grammar.output
EXTRA_DIST = \
grammar.y \
parse.l
# uncomment these lines to dist the generated sources
#BUILT_SOURCES = grammar.tab.h grammar.tab.c lex.priv_gst_parse_yy.c
#BUILT_SOURCES = grammar.tab.h grammar.tab.c parse_lex.h lex.priv_gst_parse_yy.c
#libgstparse_la_SOURCES = lex.priv_gst_parse_yy.c grammar.tab.c
# uncomment these lines to _NOT_ dist the generated sources
nodist_libgstparse_la_SOURCES = lex.priv_gst_parse_yy.c grammar.tab.c
CLEANFILES += grammar.tab.c lex.priv_gst_parse_yy.c
# can't use GST_ALL_CFLAGS here because that'd pull in -Werror
libgstparse_la_CFLAGS = -I$(top_srcdir) -I$(top_builddir) \
$(GLIB_CFLAGS) $(GST_OPTION_CFLAGS)
libgstparse_la_CFLAGS = $(GST_ALL_CFLAGS)
libgstparse_la_LIBADD = $(GST_ALL_LIBS)
noinst_HEADERS = grammar.tab.h types.h
noinst_HEADERS = grammar.tab.h parse_lex.h types.h
Android.mk: Makefile.am
androgenizer -:PROJECT gstreamer -:STATIC libgstparse -:TAGS eng debug \
@ -40,13 +38,11 @@ grammar.tab.c grammar.tab.h: grammar.y
mv grammar.tab_tmp2.c grammar.tab.c
lex.priv_gst_parse_yy.c: parse.l grammar.tab.h
$(AM_V_GEN)$(FLEX_PATH) -Ppriv_gst_parse_yy $^ && \
$(AM_V_GEN)$(FLEX_PATH) --header-file=parse_lex.h -Ppriv_gst_parse_yy $^ && \
mv lex.priv_gst_parse_yy.c lex.priv_gst_parse_yy_tmp.c && \
echo '#ifdef HAVE_CONFIG_H' > lex.priv_gst_parse_yy_tmp2.c && \
echo '#include <config.h>' >> lex.priv_gst_parse_yy_tmp2.c && \
echo '#endif' >> lex.priv_gst_parse_yy_tmp2.c && \
echo 'static inline int priv_gst_parse_yyget_column (void * yyscanner);' >> lex.priv_gst_parse_yy_tmp2.c && \
echo 'static inline void priv_gst_parse_yyset_column (int column_no , void * yyscanner);' >> lex.priv_gst_parse_yy_tmp2.c && \
cat lex.priv_gst_parse_yy_tmp.c >> lex.priv_gst_parse_yy_tmp2.c && \
rm lex.priv_gst_parse_yy_tmp.c && \
mv lex.priv_gst_parse_yy_tmp2.c lex.priv_gst_parse_yy.c

View file

@ -35,12 +35,6 @@
typedef void* yyscan_t;
int priv_gst_parse_yylex (void * yylval_param , yyscan_t yyscanner);
int priv_gst_parse_yylex_init (yyscan_t scanner);
int priv_gst_parse_yylex_destroy (yyscan_t scanner);
struct yy_buffer_state * priv_gst_parse_yy_scan_string (char* , yyscan_t);
void _gst_parse_yypush_buffer_state (void * new_buffer ,yyscan_t yyscanner );
void _gst_parse_yypop_buffer_state (yyscan_t yyscanner );
#ifdef __GST_PARSE_TRACE
static guint __strings;
@ -206,6 +200,14 @@ YYPRINTF(const char *format, ...)
#endif /* GST_DISABLE_GST_DEBUG */
/*
* include headers generated by bison & flex, after defining (or not defining) YYDEBUG
*/
#include "grammar.tab.h"
#include "parse_lex.h"
#define ADD_MISSING_ELEMENT(graph,name) G_STMT_START { \
if ((graph)->ctx) { \
(graph)->ctx->missing_elements = \
@ -933,7 +935,7 @@ priv_gst_parse_launch (const gchar *str, GError **error, GstParseContext *ctx,
priv_gst_parse_yylex_init (&scanner);
priv_gst_parse_yy_scan_string (dstr, scanner);
#ifndef YYDEBUG
#if YYDEBUG
yydebug = 1;
#endif