[syslog-ng]1.5.18/bison-1.32/stdio.h problem

Borsenkow Andrej Andrej.Borsenkow@mow.siemens.ru
Thu, 30 May 2002 12:00:45 +0400


Obviously new bison includes stdio.h only when debugging is enabled. Without
it fails miserably in yyerror:

/* Enable debugging if requested.  */
#if YYDEBUG

# ifndef YYFPRINTF
#  ifdef __cplusplus
#   include <cstdio>  /* INFRINGES ON USER NAME SPACE */
#  else
#   include <stdio.h> /* INFRINGES ON USER NAME SPACE */
#  endif
#  define YYFPRINTF YYSTD (fprintf)
# endif

(this is not the original cfg-grammar.c but regenerated locally).

The following patch is bandaid but I am not sure how to do it portably
enough (meaning - accounting for earlier bison versions). One possibility is
of course move yyerror out of cfg-grammar.y to avoid confusion.

-andrej

--- syslog-ng-1.5.18/src/cfg-grammar.y.orig     Thu May 30 11:39:06 2002
+++ syslog-ng-1.5.18/src/cfg-grammar.y  Thu May 30 11:39:52 2002
@@ -698,6 +698,8 @@
 
 extern int linenum;
 
+#include <stdio.h>
+
 void yyerror(char *msg)
 {
        fprintf(stderr, "%s at %d\n", msg, linenum);