bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bison 3.6.1 generates (internal) tokentype and (yyerror) function wi


From: Akim Demaille
Subject: Re: Bison 3.6.1 generates (internal) tokentype and (yyerror) function with same name: <filename>_error
Date: Fri, 15 May 2020 07:10:14 +0200

Hi!

> Le 14 mai 2020 à 18:47, Chuan-kai Lin <address@hidden> a écrit :
> 
> Hi Akim,
> 
> I am forwarding a bug report that the libexplain and the fhist Debian
> packages fail to build with Bison 3.6.1.
> 
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=960608
> https://tests.reproducible-builds.org/debian/rb-pkg/unstable/amd64/libexplain.html
> 
> I have also attached the build log with this email.  Can you look into
> this issue and see if it is a bug in Bison?  Thanks!

In the log file you sent, I see:

> libtool: compile:  gcc -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 
> -ffile-prefix-map=/build/1st/libexplain-1.4.D001=. -fstack-protector-strong 
> -Wformat -Werror=format-security -Wall -Wextra -Wl,--as-needed -I. -c 
> libexplain/acl_get_file_or_die.c -o libexplain/acl_get_file_or_die.o 
> >/dev/null 2>&1
> bison -y -d  libexplain/acl_grammar.y
> libexplain/acl_grammar.y:62.16-18: warning: POSIX yacc reserves %type to 
> nonterminals [-Wyacc]
>    62 | %type <lv_tag> TAG
>       |                ^~~
> libexplain/acl_grammar.y:63.19-24: warning: POSIX yacc reserves %type to 
> nonterminals [-Wyacc]
>    63 | %type <lv_number> NUMBER
>       |                   ^~~~~~
> libexplain/acl_grammar.y:66.18-22: warning: POSIX yacc reserves %type to 
> nonterminals [-Wyacc]
>    66 | %type <lv_perms> PERMS
>       |                  ^~~~~
> libexplain/acl_grammar.y:68.17-20: warning: POSIX yacc reserves %type to 
> nonterminals [-Wyacc]
>    68 | %type <lv_name> NAME
>       |                 ^~~~
> sed -e 's/[yY][yY]/acl_grammar_/g' -e '/<stdio.h>/d' -e \
>       '/<stdlib.h>/d' -e '/<stddef.h>/d' y.tab.c > \
>       libexplain/acl_grammar.yacc.c
> sed -e 's/[yY][yY]/acl_grammar_/g' -e \
>       's/Y_TAB_H/libexplain_acl_grammar_YACC_H/g' y.tab.h > \
>       libexplain/acl_grammar.yacc.h

The last two lines are not coming from Bison, and they are smashing
both YYerror and yyerror to acl_grammar_error.  So of course, it fails.

I don't understand why this is done this way.  The grammar file should use
%define api.prefix {acl_grammar_}, or the build system should pass
-Dapi.prefix={acl_grammar_}, or the sed sequence should be less crude.
I would go for

        s/yy/acl_grammar_/g; s/YY/ACL_GRAMMAR_/g;

But if this is not ok, and the package still wants to smash yy and YY
to the same string, you could *prepend* this to the sed grammar:

        s/YYerror/yyerror_token/g;

so that yyerror becomes acl_grammar_error, and YYerror become
acl_grammar_error_token.  But of course next time we introduce another
symbol which differs by the case of the prefix, the problem will
be back.

Cheers!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]