[Libguestfs] [PATCH 1/3] builder: make the C index parser reentrant

Richard W.M. Jones rjones at redhat.com
Sat Mar 29 12:31:24 UTC 2014


On Wed, Mar 19, 2014 at 05:53:09PM +0100, Pino Toscano wrote:
> Switch the lex/yacc parser into reentrant mode, to ease the handling of
> parsing-specific data; introduce a new parser_context struct for that,
> which is added as extra data to the parser.
> 
> This should cause no behaviour changes in the parsing, just no more
> global variables used for getting data in/out the parser.
> +%code requires {
> +#include "index-parse.h"

There's a strange problem here with old Bison in Gentoo:

  CC       virt_index_validate-index-parse.o
In file included from index-parse.y:61:0,
                 from index-parse.y:61,
                 from index-parse.y:61,
                 from index-parse.y:61,
                 from index-parse.y:61,
                 from index-parse.y:61,
[etc]

Basically index-parse.h includes itself.

This seems to be fixed somewhere between Bison 2.4.3 and Bison 2.7.
In 2.7, Bison adds a #ifndef/#define to prevent recursive includes.

RHEL 6 bison 2.4.1 is < 2.4.3, but for reasons I don't quite
understand doesn't appear to be affected.

Not sure if we need to fix this, just noting it's a potential problem.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org




More information about the Libguestfs mailing list