Boost logo

Boost-Build :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-12-18 14:20:17

Hi everyone,

There's an issue with the current Boost.Jam sources which I hope someone has
an answer for. The only yacc I have at my disposal is Bison, which uses
alloca(). Unfortunately, alloca() isn't portable. There appears to be a way
to deal with that in Bison: if you #define yyoverflow, it is the name of a
function to use in place of alloca to deal with parsere stack overflows (see
the excerpt at the end of this message). The problem is that I can't find
any documentation on how to write an appropriate yyoverflow function (i.e.
what's required). If someone could contribute a yyoverflow that will allow
us to build on platforms without alloca, that would be a big help.


#ifdef yyoverflow
/* Each stack pointer address is followed by the size of
the data in use in that stack, in bytes. */
/* This used to be a conditional around just the two extra args,
but that might be undefined if yyoverflow is a macro. */
yyoverflow("parser stack overflow",
&yyss1, size * sizeof (*yyssp),
&yyvs1, size * sizeof (*yyvsp),
&yyls1, size * sizeof (*yylsp),
yyoverflow("parser stack overflow",
&yyss1, size * sizeof (*yyssp),
&yyvs1, size * sizeof (*yyvsp),

yyss = yyss1; yyvs = yyvs1;
yyls = yyls1;
#else /* no yyoverflow */
/* Extend the stack our own way. */
if (yystacksize >= YYMAXDEPTH)
yyerror("parser stack overflow");
return 2;
yystacksize *= 2;
if (yystacksize > YYMAXDEPTH)
yystacksize = YYMAXDEPTH;
yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
__yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
__yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
__yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
#endif /* no yyoverflow */

David Abrahams, C++ library designer for hire

C++ Booster (
email: david.abrahams_at_[hidden]


Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at