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: Hans Aberg
Subject: Re: problems compiling groff with gcc-3.0.3
Date: Thu, 24 Jan 2002 23:57:55 +0100

At 21:55 +0100 2002/01/24, Werner LEMBERG wrote:
>Sorry, Akim!  groff can't be compiled with gcc-3.0.3.  The files
>generated with bison (e.g. pic.cc) refer to `size_t' which is
>apparently only defined if `iostream' is included.  Former versions
>of gcc don't have this prerequisite.

This is not a requirement of GCC, but the C++ standard, which puts this
stuff into namespace std. In addition, old C++ compilers used header
<iostream.h> instead of <iostream>, but I could find no mentioning of the
former in the C++ standard -- perhaps it is wholly deprecated then.

The question is if deprecated C++ compiler should be supported: C++ is a
complex language, and old C++ compilers are not so good (buggy and may
produce in efficient code).

So I think the best thing would be that people out there update their C++
software of later compilers, which is not so difficult.

About groff: Is it only in the Bison generated code that the problem shows up?

If one wants to support deprecated C++ compilers, then one might introduce
the macro YYNO_CPP_STD_NAMESPACE, writing in bison.simple
#if !defined __cplusplus || defined YYNO_CPP_STD_NAMESPACE
# define YYSTD(x) x
#else
# define YYSTD(x) std::x
#endif

Then a
#define YYNO_CPP_STD_NAMESPACE
will zip out "std::".

Similarly, one might have a macro YYDEPRECATED_CPP_HEADERS, and code in
bison.simple
#  if defined __cplusplus && !defined YYDEPRECATED_CPP_HEADERS
#   include <cstdlib> /* INFRINGES ON USER NAME SPACE */
#   define YYSIZE_T YYSTD(size_t)
#  else
#   ifdef __STDC__ || (defined __cplusplus && defined YYDEPRECATED_CPP_HEADERS)
#    include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
#    define YYSIZE_T YYSTD(size_t)
#   endif
(or a simpler variation).

Then
#define YYDEPRECATED_CPP_HEADERS
will make sure that one will get the old C++ headers.

  Hans Aberg





reply via email to

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