[ofa-general] Re: [PATCH] osm: QoS parser - fixing yacc command

Yevgeny Kliteynik kliteyn at dev.mellanox.co.il
Sat Sep 1 15:34:35 PDT 2007


Sasha Khapyorsky wrote:
> Hi Ira,
> 
> On 15:55 Fri 31 Aug     , Ira Weiny wrote:
>> We just ran into a problem with this patch applied.
>>
>> It seems that the output file is not y.tab.h but osm_qos_parser_y.h so should
>> the move be: mv -f osm_qos_parser_y.h $(srcdir)/../include/opensm/osm_qos_parser_y.h
> 
> I applied this fix for now.
> 
>> weiny2 at woprjr0:~/OpenIB/git-trees/management/opensm/opensm
>> 15:51:42 > ls *.h
>> ls: *.h: No such file or directory
>>
>> weiny2 at woprjr0:~/OpenIB/git-trees/management/opensm/opensm
>> 15:52:02 > bison -d -o ./osm_qos_parser_y.c -p__qos_parser_ ./osm_qos_parser.y
>>
>> weiny2 at woprjr0:~/OpenIB/git-trees/management/opensm/opensm
>> 15:52:21 > ls *.h
>> osm_qos_parser_y.h
>>
>> weiny2 at woprjr0:~/OpenIB/git-trees/management/opensm/opensm
>> 15:53:17 > bison --version
>> bison (GNU Bison) 1.875c
> 
> I have bison-2.3 and similar results. With yacc-1.9.1 this line doesn't
> work at all. The only "compatible" rules I found are:
> 
>  yacc -d -b osm_qos_parser -p __qos_parser_ ./osm_qos_parser.y
> 
> , or
> 
>  bison -y -d -b osm_qos_parser -p __qos_parser_ ./osm_qos_parser.y
> 
> , and then I get osm_qos_parser.tab.h and osm_qos_parser.tab.c files in
> current directory.
> 
> Yevgeny! Is this could be useful?

How about dropping all these yacc/bison/lex/flex/version dependent commands
and going back to something like what I've submitted in the original patch:

osm_qos_parser_y.c: $(srcdir)/osm_qos_parser.y $(srcdir)/../include/opensm/osm_qos_policy.h
	$(YACC) -d $(srcdir)/osm_qos_parser.y
	mv -f y.tab.c $(srcdir)/osm_qos_parser_y.c
	mv -f y.tab.h $(srcdir)/../include/opensm/osm_qos_parser_y.h

osm_qos_parser_l.c: $(srcdir)/osm_qos_parser.l $(srcdir)/../include/opensm/osm_qos_policy.h
	$(LEX) $(srcdir)/osm_qos_parser.l
	mv -f lex.yy.c $(srcdir)/osm_qos_parser_l.c

And if we're really worried about prefixes, we can add it too:

	$(YACC) -d -p__qos_parser_ $(srcdir)/osm_qos_parser.y
and
	$(LEX) -P__qos_parser_ $(srcdir)/osm_qos_parser.l


-- Yevgeny

> Sasha
> 




More information about the general mailing list