[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: problems compiling groff with gcc-3.0.3
From: |
Hans Aberg |
Subject: |
Re: problems compiling groff with gcc-3.0.3 |
Date: |
Tue, 29 Jan 2002 16:01:28 +0100 |
At 12:53 -0800 2002/01/28, Paul Eggert wrote:
>How about the following patch instead? It's simpler and safer, and
>(if I understand your problem correctly) should have the same effect.
>
>Note to Akim: OK to install?
>
>2002-01-28 Paul Eggert <address@hidden>
>
> * src/bison.simple (YYSIZE_T): Do not define merely because
> YYSTACK_USE_ALLOCA is nonzero or alloca or _ALLOCA_H are
> defined. On some platforms, <alloca.h> apparently does not
> declare YYSTD (size_t).
...
> # if YYSTACK_USE_ALLOCA
> # define YYSTACK_ALLOC alloca
>-# define YYSIZE_T YYSTD (size_t)
> # else
> # ifndef YYSTACK_USE_ALLOCA
> # if defined (alloca) || defined (_ALLOCA_H)
> # define YYSTACK_ALLOC alloca
>-# define YYSIZE_T YYSTD (size_t)
> # else
> # ifdef __GNUC__
> # define YYSTACK_ALLOC __builtin_alloca
Is your intent to merely remove the definition of YYSIZE_T? -- I do not see
how you could escape with that, as alloca takes a size_t as an argument.
If I preprocess the .tab.cc code, I get:
...
if (yyn > -32768 && yyn < 115 )
{
std::size_t yysize = 0;
char *yymsg;
int yyx, yycount;
yycount = 0;
for (yyx = yyn < 0 ? -yyn : 0;
yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
if (yycheck[yyx + yyn] == yyx)
yysize += yystrlen (yytname[yyx]) + 15, yycount++;
yysize += yystrlen ("parse error, unexpected ") + 1;
yysize += yystrlen (yytname[ ((unsigned)(op_parserchar) <= 287 ?
yytranslate[op_parserchar] : 52) ]);
yymsg = (char *) __alloca(yysize) ;
...
Which looks as though that the code assumes that YYSIZE_T is defined (by
the use of yysize).
So one should have something like:
#ifdef __cplusplus
# include <cstddef>
# define YYSIZE_T YYSTD(size_t) /* or: std::size_t */
#elif defined __STDC__ || defined HAVE_STDDEF_H /* GNU config macro */
# include <stddef.h>
# define YYSIZE_T YYSTD(size_t) /* or: size_t */
#endif
This works on my platform (but I do not if it works with alloca on every
platform). Another traditional place to put size_t is in <stdio.h>, K&R
says.
If one does not have any of those (STD C, C++, <stddef.h>), then one will
have to define YYSIZE_T to whatever alloca is using, and include the right
header by hand.
Hans Aberg
- Re: problems compiling groff with gcc-3.0.3, (continued)
- Re: problems compiling groff with gcc-3.0.3, Hans Aberg, 2002/01/25
- Re: problems compiling groff with gcc-3.0.3, Akim Demaille, 2002/01/28
- Re: problems compiling groff with gcc-3.0.3, Akim Demaille, 2002/01/28
- Re: problems compiling groff with gcc-3.0.3, Paul Eggert, 2002/01/28
- Re: problems compiling groff with gcc-3.0.3, Hans Aberg, 2002/01/28
- Re: problems compiling groff with gcc-3.0.3, Akim Demaille, 2002/01/29
- Re: problems compiling groff with gcc-3.0.3, Paul Eggert, 2002/01/29
- Re: problems compiling groff with gcc-3.0.3,
Hans Aberg <=
- Re: problems compiling groff with gcc-3.0.3, Akim Demaille, 2002/01/29
- Re: problems compiling groff with gcc-3.0.3, Hans Aberg, 2002/01/29
- Re: problems compiling groff with gcc-3.0.3, Akim Demaille, 2002/01/29
- Re: problems compiling groff with gcc-3.0.3, Hans Aberg, 2002/01/29
- Re: problems compiling groff with gcc-3.0.3, Akim Demaille, 2002/01/30
- Re: problems compiling groff with gcc-3.0.3, Werner LEMBERG, 2002/01/25
- Re: problems compiling groff with gcc-3.0.3, Hans Aberg, 2002/01/25
- Re: problems compiling groff with gcc-3.0.3, Akim Demaille, 2002/01/25