Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Jul 2006 09:00:07 -0700
From:      "Randall Hyde" <randyhyde@earthlink.net>
To:        <freebsd-hackers@freebsd.org>
Subject:   Re: contiguous memory allocation problem
Message-ID:  <001b01c69df0$973850c0$6302a8c0@pentiv>
References:  <200605271102.19799.hselasky@c2i.net><200606302029.28563.hselasky@c2i.net><20060630203226.GG734@turion.vk2pj.dyndns.org><200607011044.54872.hselasky@c2i.net> <20060701123444.GD8447@turion.vk2pj.dyndns.org>

next in thread | previous in thread | raw e-mail | index | archive | help


----- Original Message ----- 
From: "Peter Jeremy" <peterjeremy@optushome.com.au>
To: "Randall Hyde" <randyhyde@earthlink.net>
Sent: Saturday, July 01, 2006 11:10 PM
Subject: Re: FLEX, was Re: Return value of malloc(0)

The following compiles without error:
%{
typedef int YYSTYPE;
typedef int YYLTYPE;

/*
** Allow for a recursive version of Bison parser.
*/
#undef YY_DECL
#define YY_DECL int yylex( YYSTYPE *yylval, YYLTYPE *yylloc)
%}

%%
. ECHO;
%%

I'll accept that you are having a problem getting HLA to build.  No-one
else is reporting problems.  If you want assistance from other people
then you are going to need to help by either providing a test case to
reproduce the failure you are seeing or you are going to need to provide
the pre-processed context where the error occurs.

<<<<<<<<<<<<<<<<<<<<<<<

Uh, is the above *not* the test case you are asking for?
Does this particular code snippet compile for you? If so, then I've
definitely got some configuration problems with GCC on my machine.

BTW, if I haven't made myself clear, the problem with the code above is a
GCC error, not a FLEX error. That is, FLEX happily produces the yy.lex.c
output file, GCC under FreeBSD rejects the source code it produces. Yet that
*same exact* source code compiles just fine under Linux with GCC, Windows
with Borland C++, and Windows with VC++.

Creating a recursive lexer is a documented feature of FLEX. Indeed, I used
the example present in the FLEX documentation to pull this off. And I've
been using this code for about eight years on Windows and about four years
on Linux.  Perhaps FreeBSD types have never tried to create a recursive
parser/lexer and haven't had to deal with this issue, but as you can see
from the code snippet above, this really has nothing to do with HLA, per se,
other than the fact that it uses a recursive lexer/parser.

And the fact remains, the code compiles just fine under Windows and Linux.
The compilation uses a documented feature of FLEX. There *is* a problem with
the implementation of GCC under FreeBSD (or header files under FreeBSD).
It's not specific to HLA. And I can't imagine how to give you a better test
case than the code above.
Cheers,
Randy Hyde




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?001b01c69df0$973850c0$6302a8c0>