Warning Collecting Bison

I am developing a compiler using flex / bison. I have this warning in my build release.

warning: type clash ('s' '') on default action

any help please?

+5
source share
2 answers

This seems to be related to your% token and% type declaration in your source. without the source line and the associated token and type declaration, it's hard for you to help.

If you specify expr of type val and qualifier, then the identifier of type ID is tptr

%{
#include "parser.h"
%}
%type <val> expr
%token <tptr> ID

If you write without any action, the bison will issue a warning

expr : ID;

warning: type clash ('tptr' 'val') on default action

Note that the level of bison that I am currently using prints a small message in this case.

foo.by:10.12:warning: type clash on default action : <tptr> != <val>

To fix this warning, you need to take an explicit action:

expr : ID { $$ = some_conversion_code($1); }

http://www.gnu.org/s/bison/manual/bison.html#Token-Decl

+7

, lex.

0

All Articles