[syslog-ng] Compiling 3.4

Balazs Scheidler bazsi at balabit.hu
Tue Aug 14 12:31:17 CEST 2012


Hi,

I've just checked this thing, and now I remember what this is about. The
generic "grammar" framework is capable of passing an additional argument
to the parse function, that's the 3rd arg.

The proper declaration for parse functions includes the 3rd argument,
but as it seems due to the casts in the function initialization, I
didn't notice the invalid declarations as the compiler didn't complain.

now as bison actually declares the parse function (finally!), those
declarations could go away entirely. the issue is that I only run bison
2.5 and most people out there are running an older bison.

the fix is to change the hand-written parse declarations to match the
actual prototype.

This patch should do that:

commit cb62deb8fc7587bd44a68b8039dc6b2e47d00bc3
Author: Balazs Scheidler <bazsi at balabit.hu>
Date:   Tue Aug 14 12:30:24 2012 +0200

    fixed invalid declarations for bison generated yyparse() functions
    
    The new bison finally declares the yyparse() function in its header, which
    revealed a couple of invalid declarations in a couple of parsers.
    
    This patch fixes that.
    
    Reported-By: Conrad Hoffmann <ch at bitfehler.net>
    Signed-off-by: Balazs Scheidler <bazsi at balabit.hu>

Thanks for reporting this!

On Mon, 2012-08-13 at 22:22 +0200, Balazs Scheidler wrote:
> ----- Original message ----- 
> > On 08/13/2012 08:30 PM, Balazs Scheidler wrote: 
> > > ----- Original message ----- 
> > > > Greetings! 
> > > > 
> > > > I am having some difficulties compiling current master (at the
> time 
> > > > of this writing) of syslog-ng 3.4. The first error is this: 
> > > > 
> > > > filter-expr-parser.c:30:5: error: conflicting types for 
> > > > 'filter_expr_parse' In file included from
> filter-expr-parser.c:27:0: 
> > > > filter-expr-grammar.h:404:5: note: previous declaration of 
> > > > 'filter_expr_parse' was here 
> > > > make[4]: *** [filter-expr-parser.lo] Error 
> > > > 
> > > > Now, at first I thought, since filter-expr-grammar.h is
> generated, it 
> > > > might have something to do with my bison version or the likes.
> But 
> > > > then I realized that the offending declaration in 
> > > > filter-expr-parser.c:30: 
> > > > 
> > > > int filter_expr_parse(CfgLexer *lexer, FilterExprNode **node); 
> > > > 
> > > > directly contradicts its use int the same file below (line 74): 
> > > > 
> > > > .parse = (gint (*)(CfgLexer *, gpointer *, gpointer)) 
> > > > filter_expr_parse, 
> > > > 
> > > > filter-expr-parser.c is not generated, so I don't quite get how
> this 
> > > > compiles at all for anyone? Am I missing something? 
> > > > 
> > > > The actual usage (line 74) matches the generated declaration, so
> I 
> > > > can just comment out the offending one in line 30. But I
> suspect 
> > > > this it not how it's supposed to work... 
> > > > 
> > > > Same thing happens for parser-expr-parser and
> rewrite-expr-parser... 
> > > 
> > > hm. earlier bison versions didn't declare the parse function. I
> can't 
> > > remember warnings either, but I'll have to check the code. 
> > 
> > I am using bison 2.6.2, if this information is of any value... 
> > 
> > But still, doesn't the declaration contradict the call below
> anyways 
> > (third parameter)? 
> > 
> 
> these are only called through the pointer, iirc they really only have
> two params, but I don't know why I haven't seen warnings before.
> 
> 
> ______________________________________________________________________________
> Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
> Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng
> FAQ: http://www.balabit.com/wiki/syslog-ng-faq
> 

-- 
Bazsi




More information about the syslog-ng mailing list