Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

warning Bison compilation

Tags:

yacc

bison

lex

am developping a compiler using flex/bison. I have this warning in my build output.

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

any help please?

like image 296
Aymanadou Avatar asked Sep 08 '11 10:09

Aymanadou


1 Answers

It seems to be related to your %token and %type declaration in your source. without the source line and the related token and type declaration it is difficult to help you.

If you specify an expr of type val and definer an ID token of type tptr

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

If you write without any action bison will emit a warning

expr : ID;

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

Note that the bison level I am currently using print a slighty different message in this case.

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

To fix this warning you need an explicit action:

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

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

like image 85
VGE Avatar answered Sep 27 '22 17:09

VGE