相关文章推荐

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

These are the errors I am seeing:

src/ostree/parse-datetime.c:481:6: error: conflicting types for ‘yyerror’; have ‘void(parser_control *, const char *)’
  481 | void yyerror (parser_control *pc, const char *msg);
      |      ^~~~~~~
src/ostree/parse-datetime.y:231:12: note: previous declaration of ‘yyerror’ with type ‘int(const parser_control *, const char *)’
  231 | static int yyerror (parser_control const *, char const *);
      |            ^~~~~~~
src/ostree/parse-datetime.y:1212:1: error: conflicting types for ‘yyerror’; have ‘int(const parser_control *, const char *)’
 1212 | yyerror (parser_control const *pc,
      | ^~~~~~~
src/ostree/parse-datetime.c:481:6: note: previous declaration of ‘yyerror’ with type ‘void(parser_control *, const char *)’
  481 | void yyerror (parser_control *pc, const char *msg);
      |      ^~~~~~~
src/ostree/parse-datetime.y:1212:1: warning: ‘yyerror’ defined but not used [-Wunused-function]
 1212 | yyerror (parser_control const *pc,
      | ^~~~~~~

From the bison 3.8 release notes:

  To comply with the latest POSIX standard, in Yacc compatibility mode
  (options `-y`/`--yacc`) Bison now generates prototypes for yyerror and
  yylex.  In some situations, this is breaking compatibility: if the user
  has already declared these functions but with some differences (e.g., to
  declare them as static, or to use specific attributes), the generated
  parser will fail to compile.  To disable these prototypes, #define yyerror
  (to `yyerror`), and likewise for yylex.
          

Seems to be fixed with bison 3.8.1. I guess the compatibility break was not intended:

* Noteworthy changes in release 3.8.1 (2021-09-11) [stable]
  The generation of prototypes for yylex and yyerror in Yacc mode is
  breaking existing grammar files.  To avoid breaking too many grammars, the
  prototypes are now generated when `-y/--yacc` is used *and* the
  `POSIXLY_CORRECT` environment variable is defined.
  Avoid using `-y`/`--yacc` simply to comply with Yacc's file name
  conventions, rather, use `-o y.tab.c`.  Autoconf's AC_PROG_YACC macro uses
  `-y`.  Avoid it if possible, for instance by using gnulib's gl_PROG_BISON.
 
推荐文章