bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problems compiling groff with gcc-3.0.3


From: Paul Eggert
Subject: Re: problems compiling groff with gcc-3.0.3
Date: Mon, 28 Jan 2002 12:53:15 -0800 (PST)

> From: Akim Demaille <address@hidden>
> Date: 28 Jan 2002 11:11:45 +0100
> 
> Note that we defined YYSIZE_T and YYSTACK_ALLOC here.

I think this is the fundamental problem.  The code assumes that if alloca
is asked for, then size_t (or std::size_t) has already been declared.
Apparently that is not true in general.

> g++-3.0 -I. -I/tmp/groff-current/src/preproc/refer 
> -I/tmp/groff-current/src/include -I/tmp/groff-current/src/include 
> -DHAVE_CONFIG_H -g  -c label.cc
> y.tab.c: In function `int yyparse()':
> y.tab.c:903: `size_t' undeclared in namespace `std'

Unfortunately, I can't reproduce this problem with Bison 1.32 and GCC
3.0.3 on Solaris 8, either with groff-current (as of 2002-01-28) or
groff 1.17.2.  Since I can't reproduce the problem, it would be
helpful if you could test my fix enclosed below on your installation.

> If I change the first block [by] ...  adding cstddef, it works properly.

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).

===================================================================
RCS file: src/bison.simple,v
retrieving revision 1.1
retrieving revision 1.2
diff -pu -r1.1 -r1.2
--- src/bison.simple    2002/01/03 09:44:29     1.1
+++ src/bison.simple    2002/01/28 20:32:21     1.2
@@ -1,7 +1,9 @@
 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
 #line
 /* Skeleton output parser for bison,
-   Copyright (C) 1984, 1989, 1990, 2000, 2001 Free Software Foundation, Inc.
+
+   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
+   Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -47,12 +49,10 @@
 
 # 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]